⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

eth_getCode

Get the contract code at a given address on Avalanche C-Chain.

Parameters

  1. DATA, 20 Bytes - address
  2. QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending"
{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": [
"0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86",
"latest"
],
"id": 1
}

Returns

DATA - The code from the given address.

Implementation Example

curl -X POST https://api-avalanche-mainnet-archive.n.dwellir.com/YOUR_API_KEY/ext/bc/C/rpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": [
"0xa41d19F4258a388c639B7CcD938FCE3fb7D05e86",
"latest"
],
"id": 1
}'

Response Example

{
"jsonrpc": "2.0",
"id": 1,
"result": "0x608060405234801561001057600080fd5b50..."
}

Note: Returns "0x" for externally owned accounts (EOAs) and the bytecode for smart contracts.


Need help? Contact our support team or check the Avalanche documentation.