Network guides

TRON: blocks and transactions

TRON apps often use TronWeb wallet/* paths. On RpcNode these are invoked as JSON-RPC methods (method string includes the path). Some eth_* aliases may also be available — check the TRON method list in docs.

tronwallet/getnowblockwallet/gettransactionbyid

← All guides

Steps

  1. Create a tron mainnet endpoint.
  2. Read the tip with wallet/getnowblock (or eth_blockNumber if listed for your endpoint).
  3. Fetch a block with wallet/getblockbynum / wallet/getblockbyid.
  4. Fetch a tx with wallet/gettransactionbyid.
  5. For TRC-20 balances use triggerconstantcontract / eth_call patterns as documented per method.

wallet/getnowblock (curl)

curl

curl https://holy-burned-sky-tron-mainnet.rpcnode.dev/7c9e6679-7425-40de-944b-e07fc1f90ae7 \
  -X POST \
  -H 'content-type: application/json' \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "wallet/getnowblock",
  "params": []
}'

wallet/getnowblock (JavaScript)

fetch

const response = await fetch('https://holy-burned-sky-tron-mainnet.rpcnode.dev/7c9e6679-7425-40de-944b-e07fc1f90ae7', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'wallet/getnowblock',
    params: [],
  }),
});

const data = await response.json();
console.log(data);

wallet/getblockbynum (curl)

curl

curl https://holy-burned-sky-tron-mainnet.rpcnode.dev/7c9e6679-7425-40de-944b-e07fc1f90ae7 \
  -X POST \
  -H 'content-type: application/json' \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "wallet/getblockbynum",
  "params": [
    {
      "num": 50000000
    }
  ]
}'

wallet/getblockbynum (JavaScript)

fetch

const response = await fetch('https://holy-burned-sky-tron-mainnet.rpcnode.dev/7c9e6679-7425-40de-944b-e07fc1f90ae7', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'wallet/getblockbynum',
    params: [
      {
        "num": 50000000
      }
    ],
  }),
});

const data = await response.json();
console.log(data);

wallet/gettransactionbyid (curl)

curl

curl https://holy-burned-sky-tron-mainnet.rpcnode.dev/7c9e6679-7425-40de-944b-e07fc1f90ae7 \
  -X POST \
  -H 'content-type: application/json' \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "wallet/gettransactionbyid",
  "params": [
    {
      "value": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
    }
  ]
}'

wallet/gettransactionbyid (JavaScript)

fetch

const response = await fetch('https://holy-burned-sky-tron-mainnet.rpcnode.dev/7c9e6679-7425-40de-944b-e07fc1f90ae7', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'wallet/gettransactionbyid',
    params: [
      {
        "value": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
      }
    ],
  }),
});

const data = await response.json();
console.log(data);

Tips

  • TRON addresses are base58check (T…); do not send 0x EVM addresses to wallet/* account APIs.
  • Sun units: 1 TRX = 1e6 sun.
  • See /tron in the sidebar for the exact method catalog and credits.

Related