nearprotocol

unable to get near protocol transaction status via RPC


Given a transaction https://explorer.near.org/transactions/JBb2DDe3i1CtBwESisLuhxXkWVZpCKYL4J1AdYwAQPsQ

When I query NEAR rpc:

http post https://rpc.mainnet.near.org jsonrpc=2.0 method=tx params:='["JBb2DDe3i1CtBwESisLuhxXkWVZpCKYL4J1AdYwAQPsQ","wasmgit.near"]' id=dontcare

Then I expect to get the transaction status

Instead I get the following response:

{
    "error": {
        "code": -32000,
        "data": "Transaction JBb2DDe3i1CtBwESisLuhxXkWVZpCKYL4J1AdYwAQPsQ doesn't exist",
        "message": "Server error"
    },
    "id": "dontcare",
    "jsonrpc": "2.0"
}

Solution

  • source: https://docs.near.org/docs/api/rpc#setup

    Querying historical data (older than 5 epochs or ~2.5 days), you may get responses that the data is not available anymore. In that case, archival RPC nodes will come to your rescue:

    You can see this interface defined in nearcore here.

    via near-cli

    near --nodeUrl https://archival-rpc.mainnet.near.org \
    tx-status JBb2DDe3i1CtBwESisLuhxXkWVZpCKYL4J1AdYwAQPsQ \
    --accountId wasmgit.near
    

    via http

    http post https://archival-rpc.mainnet.near.org \
    jsonrpc=2.0 method=tx \
    params:='["JBb2DDe3i1CtBwESisLuhxXkWVZpCKYL4J1AdYwAQPsQ","wasmgit.near"]' \
    id=dontcare