RPC Endpoint Setup
POSTfor all methodsJSON RPC 2.0id: "dontcare"- endpoint URL varies by network:
- mainnet
https://rpc.mainnet.near.org - testnet
https://rpc.testnet.near.org - betanet
https://rpc.betanet.near.org(may be unstable) - localnet
http://localhost:3030
- mainnet
Limits
- Maximum number of requests per IP for mainnet: 30 req/min, 75 req per 10 mins
- Maximum number of requests per IP for testnet: 30 req/min, 75 req per 10 mins
Querying Historical Data
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:- mainnet
https://archival-rpc.mainnet.near.org - testnet
https://archival-rpc.testnet.near.org
nearcore here.
Limits
- Maximum number of requests per IP for mainnet: 4 req/min, 10 req per 10 mins
- Maximum number of requests per IP for testnet: 20 req/min, 50 req per 10 mins
Postman Setup
An easy way to test the queries in this documentation page is to use an API request tool such as Postman. You only need to configure two things:-
Make sure you add a header with a key of
Content-Typeand value ofapplication/json. -
Then select the
Bodytab and choose therawradio button and ensureJSONis the selected format.
JSON object example snippets below into the body of your request, on Postman, and click send.
JavaScript Setup
All of the queries listed in this documentation page can be called usingnear-api-js.
- For
near-api-jsinstallation and setup please refer tonear-api-jsquick reference documentation.
HTTPie Setup
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.Using block_id param
The block_id param can take either the block number (e.g. 27912554) or the block hash (e.g. '3Xz2wM9rigMXzA2c5vgCP8wTgFBaePucgUmVYPkMqhRL') as an argument.
Using finality param
The finality param has three options: optimistic, near-final and final:
optimistic- the transaction is in a block that - though unlikely - might be skipped (~1s after submission)near-final- the transaction is in a block that is irreversible, unless at least one block producer is slashed (~2s after submission)final- the block is final and irreversible (~3s after submission)
near-final finality has enough guarantees for any normal operations, and thus should be preferred for most applications. You can learn more about it in this official blog post.