eth_getCode
Optimism node API
eth_getCode | Optimism
Optimism API method eth_getCode retrieves the code stored at a specific address. Available on Optimism via Chainstack JSON-RPC nodes.
POST
eth_getCode
Optimism API methodDocumentation Index
Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
Use this file to discover all available pages before exploring further.
eth_getCode retrieves the code stored at a specific address. This method is typically used to inspect the bytecode of smart contracts on the Optimism blockchain.
This example retrieves the bytecode of the Chainlink token on the Optimism Mainnet.
When called against a block older than the latest ~128 blocks, this method is treated as an archive request (2 RUs instead of 1 RU). See request units.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
address— the address to get the code from.block— the block number (in hexadecimal) or one of the strings"earliest","latest", or"pending", indicating the state to consider. The default is"latest".
Response
result— the code from the specified address, returned as a hexadecimal string.
Use case
Theeth_getCode method is essential for:
- Developers and auditors who need to verify the deployed bytecode of smart contracts.
- DApps that interact with contracts dynamically based on their code.
- Tools and services that monitor and analyze contract deployments and updates.
Last modified on May 18, 2026