Skip to main content

Ronin JSON-RPC API reference


The Ronin JSON-RPC API provides a robust interface for developers to interact programmatically with Ronin nodes. This API facilitates a variety of blockchain-related operations, including:

  • Querying blockchain data: blocks, transactions, and balances.
  • Smart contract interaction: Query and execute contract functions.
  • Transaction management: send transactions and estimate gas requirements.


Access to this API requires an API key. Retrieve your API key from the Developer Console > your app > Information > KEY section. For more information, see Get started.

Using the API with Web3.js and ethers.js

Web3.js example

const options = {
headers: [
{ name: 'x-api-key', value: 'xxxxxx' },

const web3Provider = new Web3.providers.HttpProvider('', options);
const web3 = new Web3(web3Provider);

console.log('Latest block number:', await web3.eth.getBlockNumber());

Ethers.js example

const connection = {
url: '',
headers: {
'x-api-key': 'xxxxx'

const provider = new ethers.providers.JsonRpcProvider(connection);

console.log('Latest block number:', await provider.getBlockNumber());

Adding API key in request header

For simpler scenarios, you can include your API key directly in the query string:

const apiKey = 'YOUR_API_KEY';
const web3Provider = new Web3.providers.HttpProvider('' + apiKey);
const apiKey = 'YOUR_API_KEY';
const provider = new ethers.providers.JsonRpcProvider('' + apiKey);
curl --location --request POST '' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [
"id": 1

Status codes and error handling

Understand common error codes to troubleshoot API requests effectively:

-32700Parse errorInvalid JSON format.
-32600Invalid requestJSON is not a valid request object.
-32601Method not foundSpecified method does not exist.
-32602Invalid paramsParameters do not match method requirements.
-32603Internal errorAn internal JSON-RPC error occurred. error

Error object format

Errors are structured to provide clear and actionable information:

"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32602,
"message": "too many arguments, want at most 0"

See also

Was this page helpful?
Happy React is loading...