How to get all the Transactions from a block in NEAR?

Viewed 351
1 Answers

Transactions are included in chunk, so you need chunks (amount of chunks corresponds the amount of shards).

So basically you're getting the block https://docs.near.org/docs/api/rpc#block-details

http post https://rpc.testnet.near.org jsonrpc=2.0 id=dontcare method=block \
  params:='{
    "finality": "final"
  }'

Picking all chunk_hash from result.chunks

After that fetch each chunk

https://docs.near.org/docs/api/rpc#chunk-details

http post https://rpc.testnet.near.org jsonrpc=2.0 method=chunk params:='{"chunk_id": "71gaCoF2vgDp2td2BWemSfrQkPNEaXqEiybZpt1k3doZ"}' id=dontcare

And in the result.transactions you can find all the transactions.

Related