Ronin RPC
Overview
The Ronin RPC (remote procedure call) services are built to power any web3 application on Ronin that needs a reliable source of blockchain data. Using the RPC services, developers don't have to set up and maintain their own Ronin nodes to interact with the blockchain.
API reference: Ronin JSON-RPC API
RPC endpoints
Public RPC endpoints
Public RPC endpoints provide universal access to the blockchain via straightforward URLs, no authentication needed. This open-door approach ensures that anyone can start interacting with Ronin’s blockchain effortlessly.
Name | Endpoint |
---|---|
Luganodes | https://ronin.lgns.net/rpc |
Ronin mainnet | https://api.roninchain.com/rpc |
Saigon testnet | https://saigon-testnet.roninchain.com/rpc |
Private RPC endpoints
Opt for our private RPC endpoints for enhanced control and scalability, maintained by dedicated node providers. These nodes come in various service tiers, from complimentary basic access to premium levels offering higher request limits and advanced features.
Sky Mavis's endpoints
Node | Endpoint | Rate limit |
---|---|---|
Mainnet RPC | https://api-gateway.skymavis.com/rpc | 100 requests per second; 140,000 requests per day |
Testnet RPC | https://api-gateway.skymavis.com/rpc/testnet | 100 requests per second; 140,000 requests per day |
Mainnet archive RPC | https://api-gateway.skymavis.com/rpc/archive | 100 requests per second; 140,000 requests per day |
Testnet archive RPC | https://api-gateway.skymavis.com/rpc/testnet-archive | 100 requests per second; 140,000 requests per day |
RPC over WebSocket | wss://api-gateway.skymavis.com/rpc/socket | 10 requests per second; 100 requests per day |
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('https://api-gateway.skymavis.com/rpc', options);
const web3 = new Web3(web3Provider);
console.log('Latest block number:', await web3.eth.getBlockNumber());
Ethers.js example
const connection = {
url: 'https://api-gateway.skymavis.com/rpc',
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('https://api-gateway.skymavis.com/rpc?apikey=' + apiKey);
const apiKey = 'YOUR_API_KEY';
const provider = new ethers.providers.JsonRpcProvider('https://api-gateway.skymavis.com/rpc?apikey=' + apiKey);
curl --location --request POST 'https://api-gateway.skymavis.com/rpc?apikey=YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [
],
"id": 1
}'