eth_getCode - Avalanche

eth_getCode. Retrieve the smart contract code at a given address

eth_getCode - avalanche [Value: 24CU]
Is essential for developers to inspect and verify contract code deployed on the blockchain
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://avalanche.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
The block number or tag ("latest", "earliest", "pending") at which to get the balance.
  • latest [default] - The most recent block in the blockchain (default).
  • safe - A block that has been validated by the beacon chain.
  • finalized - a block confirmed by over two-thirds of validators
  • earliest - A block approved by more than two-thirds of the validators.
  • pending - Transactions that have been broadcast but not yet included in a block.

Response

200
The smart contract code (EVM bytecode) stored at the specified address, returned as a hexadecimal string.

Response params

object
idinteger
jsonrpcstring
resultstring