getcontract - Tron

getcontract. Returns the bytecode and metadata of a deployed smart contract by address.

getcontract - tron [Value: 20CU]
Returns the bytecode and metadata of a deployed smart contract by address.
Use cases

Use cases

  • Also available as GET
  • Check the energy-sharing configuration of a contract you're calling
Constraints

Constraints

  • Returns an empty object if the address has no deployed contract
Get started
Unlock Access to 100+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
curl --request POST \
     --url https://lb.drpc.live/tron/{API-KEY}/wallet/getcontract \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '{"value": "example", "visible": true}'
Copy
Response
200
{
  "origin_address": "4165fa68800fff5a10346d1a3aa1fb2ce92f2e2971",
  "contract_address": "41eca9bc828a3005b9a3b909f2cc5c2a54794de05f",
  "abi": {
    "entrys": [
      {
        "outputs": [{ "type": "string" }],
        "constant": true,
        "name": "name",
        "stateMutability": "View",
        "type": "Function"
      }
    ]
  },
  "bytecode": "60806040526000600260146101000a81548160ff02191690831515021790555060...",
  "name": "TetherToken",
  "origin_energy_limit": 1000000000,
  "code_hash": "1c32379f645df32d2a8e45de37319983d01d47185588337985aeefb4672a91f2"
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersobject
object
valuestring
The smart contract's address
visibleboolean
When true, addresses are base58check strings; when false (default), hex strings

Response

200
Returns the bytecode and metadata of a deployed smart contract by address.

Response params

object
origin_addressstring
The address that originally deployed this smart contract, in hex format.
contract_addressstring
The address of the smart contract being queried, in hex format.
abiobject
The contract's Application Binary Interface, describing its callable functions and events.
object
entrysarray_of_objects
The list of individual ABI entries (functions, events, constructors) exposed by this contract.
object
outputsarray_of_objects
The list of return value types produced by this function.
constantboolean
Whether this function is read-only and doesn't modify contract state.
namestring
The name of this function or event.
stateMutabilitystring
The function's state-mutability category (e.g. View, Pure, Nonpayable, Payable).
typestring
The kind of ABI entry this is (e.g. Function, Event, Constructor).
bytecodestring
The hex-encoded compiled EVM bytecode currently deployed on-chain for this contract.
namestring
The human-readable name assigned to this smart contract.
origin_energy_limitinteger
The maximum amount of Energy the contract's deployer is willing to cover per call, capping the owner-paid share.
code_hashstring
The hash of the contract's deployed bytecode, used to identify or verify its exact code.