Network guides

NEAR: block and tx

NEAR uses its own JSON-RPC method names (block, tx, query, …). Prefer finality: "final" for settled reads.

nearblocktx

← All guides

Steps

  1. Create a near endpoint.
  2. Call block with finality final (or a block_id).
  3. Use tx / EXPERIMENTAL_tx_status style methods as listed in the NEAR catalog for transaction lookup.
  4. Use query for view-state / view-function reads.

Latest final block (curl)

curl

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

Latest final block (JavaScript)

fetch

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

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

Tips

  • Account IDs are human-readable (e.g. example.near), not 0x addresses.
  • Check /near for the exact method list enabled on RpcNode.

Related