eth_getCode
Tron / https://triport.io/rpc/tron
Minimum tier: Free
Last updated:
eth_getCode returns the byte sequence stored as contract code at a 20-byte EVM
address. The result uses EVM data encoding: 0x followed by an even number of
hexadecimal characters. 0x represents an empty byte sequence.
The state read is available only at latest; historical block quantities are
not accepted. Use this method to distinguish deployed bytecode from an empty
address. Native contract metadata is available from
getcontractinfo.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| address | EVMAddress | Yes | |
| block | LatestBlockTag | Yes |
Returns
| Field | Type |
|---|---|
| code | Data |
Examples
curl https://triport.io/rpc/tron \
-X POST -H 'Content-Type: application/json' \
-H 'Authorization: Bearer <api-key>' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getCode","params":["<address>","<block>"]}'const res = await fetch("https://triport.io/rpc/tron", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getCode",
"params": [
"<address>",
"<block>"
]
}),
});
const data = await res.json();import requests
resp = requests.post(
"https://triport.io/rpc/tron",
headers={"Authorization": "Bearer <api-key>"},
json={"jsonrpc":"2.0","id":1,"method":"eth_getCode","params":["<address>","<block>"]},
)
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Chain: Tron.
- Clusters: mainnet.
- Credit cost: 1 per call.
FAQ
- What does eth_getCode do?
- Returns the bytecode stored at an EVM address in the current Tron state.
- How many credits does eth_getCode cost?
- eth_getCode costs 1 credit(s) per call on Triport by default.
- Is eth_getCode available over WebSocket?
- eth_getCode is an HTTP JSON-RPC method.