Gnosis Chain (formerly xDai) is an EVM-compatible, proof-of-stake blockchain designed for fast, low-cost transactions with a stablecoin gas token (xDAI). To interact with the network—whether reading on-chain data or sending transactions—you need an RPC endpoint. This article covers the essential chain settings, how to evaluate RPC providers, and common issues developers face.
Gnosis Chain RPC Decision Checklist
Before choosing an RPC provider for Gnosis Chain, evaluate the following criteria:
| Criterion | What to check | Why it matters |
|---|---|---|
| Reliability | Uptime SLA, historical availability | Downtime breaks your dApp; production apps need guaranteed access |
| Latency | Geographic distribution, response times | Slow RPCs degrade user experience, especially for time-sensitive DeFi |
| Throughput | Rate limits, requests per second (RPS) | High-traffic apps require sufficient capacity to avoid throttling |
| Archive data | Access to historical state | Needed for analytics, explorers, and certain dApp features |
| WebSocket support | WSS endpoint availability | Essential for real-time updates (e.g., order books, event listeners) |
| Security | TLS encryption, API key authentication | Protects data integrity and prevents unauthorized access |
| Pricing model | Pay-as-you-go vs. flat fee vs. free tier | Aligns cost with your usage pattern and budget |
| Support | Documentation, community, SLAs | Helps resolve issues quickly during development and production |
Gnosis Chain Network Settings
To connect to Gnosis Chain, you need the following parameters:
- Network Name: Gnosis Chain (Mainnet)
-
RPC URL:
https://rpc.gnosischain.com(public, no SLA) or a provider-specific endpoint -
Chain ID:
100(hex:0x64) - Currency Symbol: xDAI
- Block Explorer: https://gnosisscan.io or https://gnosis.blockscout.com
For the Chiado testnet:
-
Chain ID:
10200(hex:0x27D8) -
RPC URL:
https://rpc.chiadochain.net
Adding Gnosis Chain to MetaMask
You can add Gnosis Chain automatically via Chainlist or manually with the settings above.
How to Choose a Gnosis Chain RPC Provider
While the public RPC endpoint (https://rpc.gnosischain.com) is fine for testing, production dApps require a reliable provider. Here’s what to consider:
1. Reliability and Uptime
Look for providers that offer an uptime SLA (e.g., high or higher). Check their historical performance and whether they have redundant infrastructure across multiple regions.
2. Latency and Geographic Coverage
If your users are global, choose a provider with points of presence (PoPs) near your user base. Low latency reduces transaction confirmation times and improves dApp responsiveness.
3. Throughput and Rate Limits
Understand the provider’s rate limits. Free tiers often cap requests per second (RPS). For high-traffic dApps, consider a dedicated node or a plan with higher throughput.
4. Archive and Trace APIs
If your dApp needs historical data (e.g., past balances, event logs), ensure the provider offers archive nodes. Trace APIs (e.g., debug_traceTransaction) are useful for debugging but may not be available on all plans.
5. WebSocket Support
Real-time features like price feeds or transaction monitoring require WebSocket endpoints. Verify that the provider offers WSS and its reliability.
6. Pricing
Compare pricing models: pay-as-you-go (per request), flat monthly fee, or free tier. Some providers offer unlimited requests at a fixed price, which can be cost-effective for high-volume apps.
7. Security
Use providers that support API keys and TLS encryption. Avoid public endpoints for production workloads.
Example: Making a JSON-RPC Call to Gnosis Chain
Here’s a simple curl command to get the latest block number:
curl -X POST https://rpc.gnosischain.com \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
Response:
{"jsonrpc":"2.0","id":1,"result":"0x2d2f3e6"}
To send a transaction, you’ll need to sign it first (e.g., using ethers.js):
const { ethers } = require("ethers");
const provider = new ethers.providers.JsonRpcProvider("https://rpc.gnosischain.com");
const signer = new ethers.Wallet("YOUR_PRIVATE_KEY", provider);
async function sendTx() {
const tx = await signer.sendTransaction({
to: "0xRecipientAddress",
value: ethers.utils.parseEther("0.01")
});
console.log("Transaction hash:", tx.hash);
}
sendTx();
Common Pitfalls and Troubleshooting
1. Nonce Errors
Gnosis Chain uses the same nonce system as Ethereum. If you get "nonce too low" or "nonce already consumed", ensure you’re using the correct nonce for the account. Use eth_getTransactionCount with "pending" parameter to get the next nonce.
2. Gas Estimation Failures
Gnosis Chain has a block gas limit of 30M gas units. If your transaction consistently fails, check that your gas limit is within bounds and that you have sufficient xDAI balance.
3. WebSocket Disconnections
Some public WSS endpoints may drop idle connections. Use a provider with stable WebSocket support or implement reconnection logic in your client.
4. Rate Limiting
Public endpoints often throttle requests. If you encounter HTTP 429 errors, switch to a provider with higher limits or a dedicated node.
When to Use a Dedicated Node vs. Shared RPC
- Shared RPC: Suitable for low-to-medium traffic dApps, prototyping, and testing. Cost-effective but subject to rate limits and potential noisy neighbors.
- Dedicated Node: Ideal for high-traffic production apps, DeFi protocols, and applications requiring consistent performance. Provides full control over resources and clear rate limits.
OnFinality offers both shared and dedicated node options for Gnosis Chain. You can start with a free tier and upgrade as your needs grow. Check our RPC pricing and supported networks for details.
Key Takeaways
- Gnosis Chain is an EVM-compatible chain with chain ID 100 and xDAI as gas token.
- Public RPC endpoints are available but lack SLA; production apps should use a professional provider.
- Evaluate providers on reliability, latency, throughput, archive support, WebSocket, pricing, and security.
- Common issues include nonce errors, gas estimation failures, and rate limiting—mitigate by choosing the right provider and implementing best practices.
- For high-traffic dApps, consider dedicated nodes for predictable performance.
Frequently Asked Questions
Q: What is the Gnosis Chain RPC URL?
A: The public RPC URL is https://rpc.gnosischain.com. For production, use a provider-specific endpoint.
Q: What is the Gnosis Chain chain ID?
A: The mainnet chain ID is 100 (hex 0x64). The Chiado testnet chain ID is 10200.
Q: Does Gnosis Chain support WebSocket?
A: Yes, the public WSS endpoint is wss://rpc.gnosischain.com/wss. Provider endpoints may differ.
Q: How do I get xDAI for gas?
A: You can bridge DAI from Ethereum to Gnosis Chain via the official bridge or use a faucet for testnet xDAI.
Q: Can I use Gnosis Chain with MetaMask?
A: Yes, add the network manually or via Chainlist.
For a full list of supported networks and to get started with Gnosis Chain RPC, visit our Gnosis Chain page.
Related resources
Originally published at OnFinality.
Top comments (0)