POST
/
95e61622bf6a8af293978377718e3b77
/
jsonrpc
/
eth_getCode
eth_getCode
curl --request POST \
  --url https://tron-mainnet.core.chainstack.com/95e61622bf6a8af293978377718e3b77/jsonrpc/eth_getCode \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "eth_getCode",
  "id": 1,
  "params": [
    "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
    "latest"
  ]
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}
TRON API method that returns the bytecode of a smart contract at a specified address, providing an Ethereum-compatible interface for accessing TRON blockchain data.
Get you 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

  • jsonrpc — the JSON-RPC protocol version (always “2.0”)
  • method — the method name (always “eth_getCode”)
  • params — array containing method parameters
    • address — the contract address to retrieve code from
    • blockParameter — the block number in hexadecimal format or “latest”, “earliest”, “pending”
  • id — request identifier (number or string)

Response

  • jsonrpc — the JSON-RPC protocol version (“2.0”)
  • id — the request identifier that matches the request
  • result — the contract bytecode as a hex string (returns “0x” for non-contract addresses)

Use case

The jsonrpc eth_getCode method is used for:
  • Verifying smart contract deployment and retrieving contract bytecode through Web3 interfaces
  • Building contract verification and analysis tools for TRON smart contracts
  • Implementing contract existence checks in dApps and development tools
  • Developing security analysis tools that examine contract code patterns

Body

application/json
jsonrpc
string
default:2.0
required
method
string
default:eth_getCode
required
id
integer
default:1
required
params
string[]
required
Required array length: 2 elements

Response

200 - application/json

Contract bytecode at the specified address

jsonrpc
string
id
integer
result
string

Contract bytecode as hex string (returns '0x' for non-contract addresses)