/wallet/getcontractinfo¶
Get the full runtime info for a contract (includes runtime code, state, and energy info).
- Source:
framework/src/main/java/org/tron/core/services/http/GetContractInfoServlet.java - Method:
GET/POST - Response:
protocol.SmartContractDataWrapper(smart_contract.proto)
Request parameters¶
GET reads these fields from URL query parameters; POST reads them from a JSON request body.
| Field | Method | Type | Required | Description |
|---|---|---|---|---|
value |
GET / POST | string | No | Contract address; omitted uses empty bytes for the lookup and returns {} |
visible |
GET / POST | bool | No | Address format |
Example:
curl --request POST \
--url https://nile.trongrid.io/wallet/getcontractinfo \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"value": "41eca9bc828a3005b9a3b909f2cc5c2a54794de05f"
}
'
Response¶
| Field | Type | Description |
|---|---|---|
smart_contract |
SmartContract | Contract metadata (same as /wallet/getcontract) |
runtimecode |
string(hex) | On-chain runtime bytecode (proto field name has no underscore) |
contract_state |
ContractState | Contract state: energy_usage, energy_factor, update_cycle |
Response example (Nile TetherToken):
{
"smart_contract": {
"origin_address": "4165fa68800fff5a10346d1a3aa1fb2ce92f2e2971",
"contract_address": "41eca9bc828a3005b9a3b909f2cc5c2a54794de05f",
"abi": { "entrys": [/* 46 entries */] },
"bytecode": "60806040526000600260146101000a81548160ff021916908315150217905550...",
"name": "TetherToken",
"origin_energy_limit": 1000000000,
"code_hash": "1c32379f645df32d2a8e45de37319983d01d47185588337985aeefb4672a91f2"
},
"runtimecode": "608060405234801561001057600080fd5b50d3801561001d57600080fd5b50d28...",
"contract_state": {
"energy_usage": 236150,
"update_cycle": 256749
}
}
contract_state.energy_factoris omitted when 0 (proto default values are not serialized).
Returns {} if not found.
Error responses¶
| Method | Trigger | Response |
|---|---|---|
| GET / POST | Request body exceeds node.http.maxMessageSize |
Usually HTTP 413 Payload Too Large when rejected by SizeLimitHandler |
| GET / POST | value is not valid base58check (visible=true) |
Non-base58 characters throw {"Error": "class java.lang.IllegalArgumentException : <details>"} only when the input is exactly 34 characters long. Incorrect input length, bad checksum, or an invalid decoded address causes Util.getHexAddress to return an empty hex string, so no contract is found and {} is returned. |
| GET / POST | value is not valid hex (visible=false) |
{"Error": "class org.tron.core.services.http.JsonFormat$ParseException : <details>"} |
| POST | Request body is not valid JSON (POST) | {"Error": "class org.tron.json.JSONException : <parser info>"} |
| GET / POST | Other exceptions | {"Error": "<exceptionClass> : <message>"} |