Node API
Supported Chains
API Reference
TRON

TRON


TRON API is available on Web3 API platform (opens in a new tab).

TRON is an open source public blockchain platform that supports smart contracts. TRON is compatible with Ethereum, which means that you can migrate smart contracts on Ethereum to TRON directly or with minor modifications. TRON relies on a unique consensus mechanism to realize the high TPS of the TRON network that is far beyond Ethereum, bringing developers a good experience of a faster transaction.

In order for your Web3 application to interact with TRON — either by reading blockchain data or sending transactions to the network — it must connect to a TRON node. Developers interact with the blockchain using the methods provided by the API.

We provide two interfaces to query TRON API:

Responses for both of them come in JSON format (opens in a new tab).


JSON-RPC methods

JSON-RPC is a stateless, lightweight remote procedure call (RPC) protocol. The JSON-RPC interface supported by the TRON network is compatible with Ethereum's. However, due to the difference in chain mechanism and design, TRON cannot support some interfaces on Ethereum. At the same time, TRON also provides dedicated APIs to create different types of transactions.


web3_clientVersion

Returns the current client version.

Parameters

  • id (integer; required): a request ID (example: 1).
  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).
  • method (string; required): a method used for the request.
  • params (array; required): None.

Returns

  • <string>: the current client version.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "web3_clientVersion",
      "params": [],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "TRON/v4.7.1/Linux/Java1.8"
}

web3_sha3

Returns Keccak-256 (not the standardized SHA3-256) of the given data.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    • <string> (data): the data to convert into a SHA3 hash.

Returns

  • <string> (data): the SHA3 result of the given string.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "web3_sha3",
      "params": ["0x68656c6c6f20776f726c64"],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad"
}

net_version

Returns the current network ID.

Parameters

  • id (integer; required): a request ID (example: 1).
  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).
  • method (string; required): a method used for the request.
  • params (array; required): None.

Returns

  • <string>: the current network ID.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "net_version",
      "params": [],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x2b6653dc"
}

net_listening

Returns true if client is actively listening for network connections.

Parameters

  • id (integer; required): a request ID (example: 1).
  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).
  • method (string; required): a method used for the request.
  • params (array; required): None.

Returns

  • <boolean>: true when listening, otherwise false.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "net_listening",
      "params": [],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": true
}

eth_syncing

Returns an object with data about the sync status or false.

Parameters

  • id (integer; required): a request ID (example: 1).
  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).
  • method (string; required): a method used for the request.
  • params (array; required): None.

Returns

  • <object>|<boolean>: an object with sync status data or FALSE, when not syncing:
    • startingBlock (quantity): the block at which the import started (will only be reset, after the sync reached its head).
    • currentBlock (quantity): the current block, same as eth_blockNumber.
    • highestBlock (quantity): the estimated highest block.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_syncing",
      "params": [],
      "id": 1
    }'

Response example (syncing)

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "startingBlock": "0x2fb6331",
        "currentBlock": "0x2fb6344",
        "highestBlock": "0x2fb6344"
    }
}

Response example (not syncing)

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": false
}

eth_gasPrice

Returns the current price per gas in wei.

Parameters

  • id (integer; required): a request ID (example: 1).
  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).
  • method (string; required): a method used for the request.
  • params (array; required): None.

Returns

  • <string> (quantity): the current gas price in wei.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_gasPrice",
      "params": [],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x1a4"
}

eth_accounts

Returns a list of addresses owned by client.

Parameters

  • id (integer; required): a request ID (example: 1).
  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).
  • method (string; required): a method used for the request.
  • params (array; required): None.

Returns

  • <array> (string; data, 20 bytes): addresses owned by the client.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_accounts",
      "params": [],
      "id": 1
    }'

Response example

{
    "id": 1,
    "jsonrpc": "2.0",
    "result": []
}

eth_blockNumber

Returns the number of most recent block.

Parameters

  • id (integer; required): a request ID (example: 1).
  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).
  • method (string; required): a method used for the request.
  • params (array; required): None.

Returns

  • <string> (quantity): the current block number the client is on.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_blockNumber",
      "params": [],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x2fb6363"
}

eth_getBalance

Returns the balance of the account specified by address.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <string> (data, 20 bytes): an address to check for balance.
    2. <string> (quantity|tag): either the hex value of a block number or one of the following block tag:
      • latest: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.

Returns

  • <string> (quantity): the current balance in wei.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getBalance",
      "params": ["41c2ad4ef36bf52f1a724783c822b3a8dd68ae7e00", "latest"],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x1717c"
}

eth_getStorageAt

Returns the value from a storage position at an address specified.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <string> (data, 20 bytes): an address of the storage (hex encoded).

    2. <string> (quantity): a slot position in the storage (hex encoded unsigned integer).

    3. <string> (quantity|tag): either the hex value of a block number or the following block tag:

      • latest: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.

Returns

  • <string> (data): the value at this storage position.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getStorageAt",
      "params": ["41c2ad4ef36bf52f1a724783c822b3a8dd68ae7e00", "0x0", "latest"],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x0000000000000000000000000000000000000000000000000000000000000000"
}

eth_getBlockTransactionCountByHash

Returns the number of transactions in a block specified by block hash.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <string> (data, 32 bytes): a block hash.

Returns

  • <string> (quantity): the number of transactions in this block.

Request example:

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getBlockTransactionCountByHash",
      "params": ["0000000002fb639b337bc09c3864b02ec550eedac1b6387707d0d8ed340e1c7a"],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x17a"
}

eth_getBlockTransactionCountByNumber

Returns the number of transactions in the block specified by number.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <string> (quantity|tag): either the hex value of a block number or one of the following block tags:
      • earliest: the lowest numbered block available on the client.
      • latest: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.

Returns

  • <string> (quantity): the number of transactions in this block.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getBlockTransactionCountByNumber",
      "params": ["0x2FB639B"],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x17a"
}

eth_getUncleCountByBlockHash

Returns the number of uncles in a block specified by block hash.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <string> (data, 32 bytes): a block hash.

Returns

  • <string> (quantity): the number of uncles in this block.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getUncleCountByBlockHash",
      "params": ["0000000002fb639b337bc09c3864b02ec550eedac1b6387707d0d8ed340e1c7a"],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x0"
}

eth_getUncleCountByBlockNumber

Returns the number of uncles in a block specified by block number.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <string> (quantity|tag): either the hex value of a block number or one of the following block tags:
      • earliest: the lowest numbered block available on the client.
      • finalized: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.
      • safe: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.
      • latest: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.
      • pending: a sample next block built by the client on top of the latest and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.

Returns

  • <string> (quantity): the number of uncles in this block.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getUncleCountByBlockNumber",
      "params": ["finalized"],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x0"
}

eth_getCode

Returns code at a given address.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <string> (data, 20 bytes): a contract address.

    2. <string> (quantity|tag): either the hex value of a block number or one of the following block tags:

      • latest: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.

Returns

  • <string> (data): the code from the given address.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getCode",
      "params": ["0xa614f803b6fd780986a42c78ec9c7f77e6ded13c", "latest"],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x"
}

eth_call

Executes a new message call immediately without creating a transaction on the blockchain.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <object> (hex encoded): the transaction object:

      • from (string; data, 20 bytes; optional): the address the transaction is sent from.
      • to (string; data, 20 bytes): the address the transaction is directed to.
      • gas (string; quantity; optional): Not supported. The value is 0x0.
      • gasPrice (string; quantity; optional): Not supported. The value is 0x0.
      • value (string; quantity; optional): Not supported. The value is 0x0.
      • data (string; data; optional): the hash of the method signature and encoded parameters.
    2. <string> (quantity|tag): either the hex value of a block number or the following block tag:

      • latest: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.

Returns

  • <string> (hex encoded bytes): the return value of executed contract.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
    "jsonrpc": "2.0",
    "method": "eth_call",
    "params": [{
        "from": "0xF0CC5A2A84CD0F68ED1667070934542D673ACBD8",
        "to": "0x70082243784DCDF3042034E7B044D6D342A91360",
        "gas": "0x0",
        "gasPrice": "0x0",
        "value": "0x0",
        "data": "0x70a08231000000000000000000000041f0cc5a2a84cd0f68ed1667070934542d673acbd8"
    }, "latest"],
    "id": 1
}'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x0000000000000000000000000000000000000000000000000858898f93629000"
}

eth_estimateGas

Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.

The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <object>: the transaction object:
      • from (string; data, 20 bytes; optional): the address the transaction is sent from.
      • to (string; data, 20 bytes; optional): the address the transaction is directed to.
      • gas (string; quantity; optional): unused.
      • gasPrice (string; quantity; optional): unused.
      • value (string; quantity; optional): the value sent with this transaction, in wei.
      • data (string; data; optional): the hash of the method signature and encoded parameters.

Returns

  • <string> (quantity): the amount of energy used.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "eth_estimateGas",
    "params": [{
        "from": "0x41F0CC5A2A84CD0F68ED1667070934542D673ACBD8",
        "to": "0x4170082243784DCDF3042034E7B044D6D342A91360",
        "gas": "0x01",
        "gasPrice": "0x8c",
        "value": "0x01",
        "data": "0x70a08231000000000000000000000041f0cc5a2a84cd0f68ed1667070934542d673acbd8"
    }]
}'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x0"
}

eth_getBlockByHash

Returns information for the block specified by block hash.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <string> (data, 32 bytes): the block hash.
    2. <boolean>: if true it returns the full transaction objects, if false — only the hashes of the transactions.

Returns

  • <object>: a block object, or null when no block was found:
    • number (string; quantity): the block number; null when it's a pending block.
    • hash (string; data, 32 bytes): the hash of the block; null when it's a pending block.
    • parentHash (string; data, 32 bytes): the hash of the parent block.
    • nonce (string; data, 8 bytes): the hash of the generated proof-of-work; null when it's a pending block.
    • sha3Uncles (string; data, 32 bytes): SHA3 of the uncles data in the block.
    • logsBloom (string; data, 256 bytes): the bloom filter for the logs of the block. null when its pending block.
    • transactionsRoot (string; data, 32 bytes): the root of the transaction trie of the block.
    • stateRoot (string; data, 32 bytes): the root of the final state trie of the block.
    • receiptsRoot (string; data, 32 bytes): the root of the receipts trie of the block.
    • miner (string; data, 20 bytes): the address of the beneficiary to whom the mining rewards were given.
    • difficulty (string; quantity): the difficulty for this block.
    • totalDifficulty (string; quantity): the total difficulty of the chain until this block.
    • extraData (string; data): the extra data field of this block.
    • size (string; quantity): the size of this block in bytes.
    • gasLimit (string; quantity): the maximum gas allowed in this block.
    • gasUsed (string; quantity): the total used gas by all transactions in this block.
    • timestamp (string; quantity): the unix timestamp for when the block was collated.
    • transactions (array of strings): an array of transaction objects, or 32 bytes transaction hashes depending on the last given parameter.
    • uncles (array of strings): an array of uncle hashes.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
    "jsonrpc": "2.0",
    "method": "eth_getBlockByHash",
    "params": ["0000000002fb64e09010fed562392f3dca79d29c9bd823e18c1aed9083058a3f", false],
    "id": 1
}'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "baseFeePerGas": "0x0",
        "difficulty": "0x0",
        "extraData": "0x",
        "gasLimit": "0x1dcf14400",
        "gasUsed": "0x3b090b",
        "hash": "0x0000000002fb64e09010fed562392f3dca79d29c9bd823e18c1aed9083058a3f",
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "miner": "0x78c842ee63b253f8f0d2955bbc582c661a078c9d",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x0000000000000000",
        "number": "0x2fb64e0",
        "parentHash": "0x0000000002fb64df62e0d38a5e5275c78b42653925f47986a4d1db77aa645e3e",
        "receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "sha3Uncles": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "size": "0x173d6",
        "stateRoot": "0x",
        "timestamp": "0x642d7b08",
        "totalDifficulty": "0x0",
        "transactions": [
            "0x92327d478923335c581d1ca59fb70163548838f2b766d0199fbf64d4860344ad",
            "0xf113fda5cb23e30880c5968e221cef2f23f048470150dd8c04f38d3c227c7002",
            "0x2a8fc9a2e6e2391d330d9a7a41ae5ab494628951da36909fc98b91c9f1dacb8e",
            "0xb173d5070ba0aa5afefe40b67bbb63e8d6bc6ec57019afe426131c565b258ec3",
            "0xecd84aa22c5935bcaf2be7f98e06eadacdada8b262640162364b08ac7aa3e4fa",
            "0xf4c2239f422820a22da6b9e1d4d52493384fbd596457e428c072cd0693671d98",
            "0x22bab3772a77043e10e4cb9f993c9450fcd117ffdcb1bc82288504acb36e6e6b",
            "0xfa5d8defac3e3291ca56f8f44b7aa0db5170e3756ac1c1eade30fd31eaa4d5da",
            "0x2e5c7e1af56f4bd20592671ddf8e5dc0097daf6ca579d26d53c1f643d85618e2",
            "0xa1cfe2e6b9e08d6939bf6c01b1d6b1f2892f0e915df9343a86e8d728ae3630ae"
        ],
        "transactionsRoot": "0x448c3eb29eb9e065a8a22441c0973d70d67e614c498ea748a1af1bead9d22410",
        "uncles": []
    }
}

eth_getBlockByNumber

Returns information for the block specified by block number.

Parameters


  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <string> (quantity|tag): either the hex value of a block number or one of the following block tags:

      • earliest: the lowest numbered block available on the client.
      • latest: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.
    2. <boolean>: if true it returns the full transaction objects, if false — only the hashes of the transactions.

Returns

  • <object>: a block object, or null when no block was found:
    • number (string; quantity): the block number; null when it's a pending block.
    • hash (string; data, 32 bytes): the hash of the block; null when it's a pending block.
    • parentHash (string; data, 32 bytes): the hash of the parent block.
    • nonce (string; data, 8 bytes): the hash of the generated proof-of-work; null when it's a pending block.
    • sha3Uncles (string; data, 32 bytes): SHA3 of the uncles data in the block.
    • logsBloom (string; data, 256 bytes): the bloom filter for the logs of the block. null when its pending block.
    • transactionsRoot (string; data, 32 bytes): the root of the transaction trie of the block.
    • stateRoot (string; data, 32 bytes): the root of the final state trie of the block.
    • receiptsRoot (string; data, 32 bytes): the root of the receipts trie of the block.
    • miner (string; data, 20 bytes): the address of the beneficiary to whom the mining rewards were given.
    • difficulty (string; quantity): the difficulty for this block.
    • totalDifficulty (string; quantity): the total difficulty of the chain until this block.
    • extraData (string; data): the extra data field of this block.
    • size (string; quantity): the size of this block in bytes.
    • gasLimit (string; quantity): the maximum gas allowed in this block.
    • gasUsed (string; quantity): the total used gas by all transactions in this block.
    • timestamp (string; quantity): the unix timestamp for when the block was collated.
    • transactions (array of strings): an array of transaction objects, or 32 bytes transaction hashes depending on the last given parameter.
    • uncles (array of strings): an array of uncle hashes.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getBlockByNumber",
      "params": ["0x1b4", false],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "baseFeePerGas": "0x0",
        "difficulty": "0x0",
        "extraData": "0x",
        "gasLimit": "0x0",
        "gasUsed": "0x0",
        "hash": "0x00000000000001b471ba79b1cf4cfe70ff48558f7a2218f52541d54f3403d091",
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "miner": "0x5095d4f4d26ebc672ca12fc0e3a48d6ce3b169d2",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x0000000000000000",
        "number": "0x1b4",
        "parentHash": "0x00000000000001b36c300ca00603e1f4145045fc9667d4b5e1c8e89d91d6446c",
        "receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "sha3Uncles": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "size": "0xad",
        "stateRoot": "0x",
        "timestamp": "0x5b304fee",
        "totalDifficulty": "0x0",
        "transactions": [],
        "transactionsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "uncles": []
    }
}

eth_getTransactionByHash

Returns information on a transaction specified by transaction hash.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <string> (data, 32 bytes): a transaction hash.

Returns

  • blockHash (string; data, 32 bytes): a hash of the block containing the transaction; null when it's pending.
  • blockNumber (string; quantity): a number of the block containing the transaction; null when it's pending.
  • from (string; data, 20 bytes): an address of the sender.
  • gas (string; quantity): the gas provided by the sender.
  • gasPrice (string; quantity): the gas price provided by the sender in wei.
  • hash (string; data, 32 bytes): the hash of the transaction.
  • input (string; data): the data send along with the transaction.
  • nonce (string; quantity): the number of transactions made by the sender prior to this one.
  • to (string: data, 20 bytes): an address of the receiver: null when it's a contract creation transaction.
  • transactionIndex (string; quantity): the transaction index position in the block; null when it's pending.
  • value (string; quantity): the value transferred in wei.
  • v (string; quantity): ECDSA recovery ID.
  • r (string; quantity): ECDSA signature r.
  • s (string; quantity): ECDSA signature s.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getTransactionByHash",
      "params": ["5f72a4ff71f906fb53958a68e8a56613ff56752649ca9ed0fa879890f5f06098"],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "blockHash": "0x0000000002fb6540b72dbe6efa2568db23bdc1155c30253ecbeb180b344c7366",
        "blockNumber": "0x2fb6540",
        "from": "0x7507386fe92eed44c61281ac9513c9c64f8e65d2",
        "gas": "0x0",
        "gasPrice": "0x1a4",
        "hash": "0x5f72a4ff71f906fb53958a68e8a56613ff56752649ca9ed0fa879890f5f06098",
        "input": "0x",
        "nonce": "0x0000000000000000",
        "r": "0x352d87789df75779efd5abbd5dc2b36fdadd64c5b98848107d98a7d46c2cbffe",
        "s": "0x17d117d81dd5a7336ebd3fe5453fce71fa35a1f50b633eaf032ae8bb5d9d9662",
        "to": "0x08b0a04bdfbb7ee6258b19a4d8a57bd41a88f9f1",
        "transactionIndex": "0x6c",
        "type": "0x0",
        "v": "0x1b",
        "value": "0x1"
    }
}

eth_getTransactionByBlockHashAndIndex

Returns information on a transaction specified by block hash and transaction index position.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <string> (data, 32 bytes): a block hash.
    2. <string> (quantity): a transaction index position.

Returns

  • blockHash (string; data, 32 bytes): a hash of the block containing the transaction; null when it's pending.
  • blockNumber (string; quantity): a number of the block containing the transaction; null when it's pending.
  • from (string; data, 20 bytes): an address of the sender.
  • gas (string; quantity): the gas provided by the sender.
  • gasPrice (string; quantity): the gas price provided by the sender in wei.
  • hash (string; data, 32 bytes): the hash of the transaction.
  • input (string; data): the data send along with the transaction.
  • nonce (string; quantity): the number of transactions made by the sender prior to this one.
  • to (string: data, 20 bytes): an address of the receiver: null when it's a contract creation transaction.
  • transactionIndex (string; quantity): the transaction index position in the block; null when it's pending.
  • value (string; quantity): the value transferred in wei.
  • v (string; quantity): ECDSA recovery ID.
  • r (string; quantity): ECDSA signature r.
  • s (string; quantity): ECDSA signature s.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getTransactionByBlockHashAndIndex",
      "params": ["00000000020ef11c87517739090601aa0a7be1de6faebf35ddb14e7ab7d1cc5b", "0x0"],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "blockHash": "0x00000000020ef11c87517739090601aa0a7be1de6faebf35ddb14e7ab7d1cc5b",
        "blockNumber": "0x20ef11c",
        "from": "0xb4f1b6e3a1461266b01c2c4ff9237191d5c3d5ce",
        "gas": "0x0",
        "gasPrice": "0x8c",
        "hash": "0x8dd26d1772231569f022adb42f7d7161dee88b97b4b35eeef6ce73fcd6613bc2",
        "input": "0x",
        "nonce": "0x0000000000000000",
        "r": "0x6212a53b962345fb8ab02215879a2de05f32e822c54e257498f0b70d33825cc5",
        "s": "0x6e04221f5311cf2b70d3aacfc444e43a5cf14d0bf31d9227218efaabd9b5a812",
        "to": "0x047d4a0a1b7a9d495d6503536e2a49bb5cc72cfe",
        "transactionIndex": "0x0",
        "type": "0x0",
        "v": "0x1b",
        "value": "0x203226"
    }
}

eth_getTransactionByBlockNumberAndIndex

Returns information on a transaction by block number and transaction index position.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <string> (quantity|tag): either the hex value of a block number or one of the following block tags:
      • earliest: the lowest numbered block available on the client.
      • latest: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.
    2. <string> (quantity): the transaction index position.

Returns

  • blockHash (string; data, 32 bytes): a hash of the block containing the transaction; null when it's pending.
  • blockNumber (string; quantity): a number of the block containing the transaction; null when it's pending.
  • from (string; data, 20 bytes): an address of the sender.
  • gas (string; quantity): the gas provided by the sender.
  • gasPrice (string; quantity): the gas price provided by the sender in wei.
  • hash (string; data, 32 bytes): the hash of the transaction.
  • input (string; data): the data send along with the transaction.
  • nonce (string; quantity): the number of transactions made by the sender prior to this one.
  • to (string: data, 20 bytes): an address of the receiver: null when it's a contract creation transaction.
  • transactionIndex (string; quantity): the transaction index position in the block; null when it's pending.
  • value (string; quantity): the value transferred in wei.
  • v (string; quantity): ECDSA recovery ID.
  • r (string; quantity): ECDSA signature r.
  • s (string; quantity): ECDSA signature s.

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getTransactionByBlockNumberAndIndex",
      "params": ["0x2FB6562", "0x0"],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "blockHash": "0x0000000002fb6562c886d5f844a697b99c73e25b79cb8d3de8771cca9c3700d4",
        "blockNumber": "0x2fb6562",
        "from": "0x9d959e29ca58da6583b460e54d329e3975ddc3b4",
        "gas": "0xacc4",
        "gasPrice": "0x1a4",
        "hash": "0x50f952272174ec81359e91a229b171e881e3a7db44400b53f81ccecf038b2564",
        "input": "0x23b872dd0000000000000000000000417db40dca0d40898c18ab574303c5ff139176b11d0000000000000000000000419339b7a574abc3f201ab56dd66b72964402080fe0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x0000000000000000",
        "r": "0x513d8b9990aa2f18cb744d2a1056b75be4fa16bd48108e2010ae904fcffa45d7",
        "s": "0xa622e4e997445f1cff980be4d205c44d2fd1781ab5e863453f8e8fc57d97ec77",
        "to": "0xa614f803b6fd780986a42c78ec9c7f77e6ded13c",
        "transactionIndex": "0x0",
        "type": "0x0",
        "v": "0x1b",
        "value": "0x0"
    }
}

eth_getTransactionReceipt

Returns the receipt of a transaction by transaction hash.

The receipt is not available for pending transactions.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (array; required):

    1. <string> (data, 32 bytes): a hash of the transaction.

Returns

  • object: a transaction receipt object, or null when no receipt was found:

    • transactionHash (string; data, 32 bytes): a hash of the transaction.

    • transactionIndex (string; quantity): the transactions index position in the block.

    • blockHash (string; data, 32 bytes): a hash of the block containing the transaction.

    • blockNumber (string; quantity): a number of the block containing the transaction.

    • from (string; data, 20 bytes): an address of the sender.

    • to (string; data, 20 bytes): an address of the receiver; null when it's a contract creation transaction.

    • cumulativeGasUsed (string; quantity): the total amount of gas used when this transaction was executed in the block.

    • effectiveGasPrice (string; quantity): the sum of the base fee and tip paid per unit of gas.

    • gasUsed (string; quantity): the amount of gas used by this specific transaction alone.

    • contractAddress (string; data, 20 bytes): the contract address created, if the transaction was a contract creation, otherwise null.

    • logs (array): an array of log objects, which this transaction generated.

    • logsBloom (string; data, 256 bytes): a bloom filter for light clients to quickly retrieve related logs.

    • type (string; data): the transaction type, 0x00 for legacy transactions, 0x01 for access list types, 0x02 for dynamic fees. It also returns either of the following:

      • root (string; data, 32 bytes): a post-transaction stateroot (pre Byzantium).
      • status (string; quantity): either 1 (success) or 0 (failure).

Request example

curl -X POST https://rpc.ankr.com/tron_jsonrpc \
-H 'Content-Type: application/json' \
-d '{
      "jsonrpc": "2.0",
      "method": "eth_getTransactionReceipt",
      "params": ["c9af231ad59bcd7e8dcf827afd45020a02112704dce74ec5f72cb090aa07eef0"],
      "id": 1
    }'

Response example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {