eth_getCode - Ethereum

eth_getCode. Returns code at a given address

eth_getCode - ethereum [Value: 24CU]
Returns code at a given address.
Use cases

Use cases

  • Retrieve deployed smart contract bytecode from blockchain
  • Retrieve bytecode for security analysis
  • Verify contract code for upgrades
Constraints

Constraints

  • Requires precise contract address
  • Limited to "latest" block state
  • Dependent on network node availability
Get started
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
curl https://eth.drpc.org \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"eth_getCode","params":["0x5B56438000bAc5ed2c6E0c1EcFF4354aBfFaf889","latest"],"id":1,"jsonrpc":"2.0"}'
'
Copy
Response
200
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x"
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersarray of strings
array of strings
addressstring
blockNumberstring
Either the hex value of a block number OR a block hash OR One of the following block tags:
  • latest [default] - the blockchain's most recent block
  • earliest - the first or genesis block
  • pending - transactions broadcasted but not yet included in a block

Response

200
Returns the code from the given address.

Response params

object
idinteger
jsonrpcstring
resultstring