POSTfor all methods
JSON RPC 2.0
- endpoint URL varies by network:
https://rpc.betanet.near.org(may be unstable)
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
An easy way to test the examples below, would be to use an API request tool such as Postman. You will only need to configure two things:
Make sure you add a header with a key of
Content-Typeand value of
Then select the
Bodytab and choose the
rawradio button and ensure
JSONis the selected format.
After that is set up, just copy/paste the
JSON object example snippets below into the
body of your request, on Postman, and click
All of the queries listed below can be called using
near-api-jsinstallation and setup please refer to
near-api-jsquick reference documentation.
nearobject. For examples of how to instantiate, [ click here ].
If you prefer to use a command line interface, we have provided RPC examples you can use with HTTPie. Please note that params take either an object or array passed as a string.
http post https://rpc.testnet.near.org jsonrpc=2.0 id=dontcare method=network_info params:=''
block_idparam can take either the block number OR the block hash as an argument.
Note: The block IDs of transactions shown in NEAR Explorer are not necessarily the block ID of the executed transaction. Transactions may execute a block or two after its recorded, and in some cases, can take place over several blocks. Due to this, it is important to to check subsequent blocks to be sure all results related to the queried transaction are discovered.
finalityparam has two options:
optimisticuses the latest block recorded on the node that responded to your query (<1 second delay after the transaction is submitted)
finalis for a block that has been validated on at least 66% of the nodes in the network (usually takes 2 blocks / approx. 2 second delay)
Got a question?
Ask it on StackOverflow!>