eth_getCode - Base
eth_getCode. Retrieve the smart contract code at a given address
eth_getCode - base [Value: 24CU]
Is essential for developers to inspect and verify contract code deployed on the blockchain
Use cases
- Retrieve deployed smart contract bytecode from blockchain
- Retrieve bytecode for security analysis
- Verify contract code for upgrades
Constraints
- Requires precise contract address
- Limited to "latest" block state
- Dependent on network node availability
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key
Language
Request
Examples
curl https://base.drpc.org \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_getCode","params":["0x5B56438000bAc5ed2c6E0c1EcFF4354aBfFaf889","latest"],"id":1,"jsonrpc":"2.0"}'
'
Response
200
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x"
}
Request params
idinteger
jsonrpcstring
methodstring
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