Summary
Sonic is a high-performance EVM Layer-1 blockchain with sub-second finality. This page covers the official Sonic network RPC settings, how to connect your wallet or dApp, and how to evaluate RPC providers for production workloads. We also explain when a managed or dedicated Sonic RPC endpoint is the right choice.
Quick decision guide: which Sonic RPC should you use?
Before diving into the chain settings, decide which type of Sonic RPC fits your use case. The right choice depends on your workload, not just the lowest latency.
- Prototyping or wallet setup: Use the official public endpoint
https://rpc.soniclabs.comor the OnFinality public endpointhttps://sonic.api.onfinality.io/public. These are fine for testing, adding the network to a wallet, or low-volume requests. - Production dApp or indexer: A managed RPC provider with a dedicated endpoint is safer. Public endpoints can throttle or rate-limit heavy usage, and they rarely offer archive data or WebSocket reliability guarantees.
- High-throughput or data-heavy workloads: If you need
eth_getLogsover large ranges, trace methods, or consistent WebSocket streams, consider a dedicated Sonic node. Dedicated nodes give you isolated resources and predictable performance. - Compliance or data retention: If you need historical state or trace data, check whether the provider offers archive nodes. Not all Sonic RPC endpoints provide archive data.
For a deeper look at provider evaluation, see our guide on choosing an RPC provider.
Sonic network at a glance
Sonic is an EVM-compatible Layer-1 blockchain designed for high throughput and sub-second finality. It is the successor to Fantom and uses the S token for gas, staking, and governance. For developers, the key takeaway is that Sonic is fully EVM-compatible, so existing Ethereum tooling works with minimal changes.
The official chain settings are:
| Setting | Value |
|---|---|
| Network name | Sonic Mainnet |
| RPC URL | https://rpc.soniclabs.com |
| Chain ID | 146 (0x92) |
| Currency symbol | S |
| Block explorer | https://sonicscan.org |
These settings are what you need to add Sonic to a wallet or configure a dApp. The OnFinality public endpoint https://sonic.api.onfinality.io/public is also available and can be used as an alternative.
Adding Sonic to MetaMask or other wallets
Most wallets let you add a custom network manually. The process is similar across MetaMask, Rabby, and other EVM wallets.
- Open your wallet and go to the network selection dropdown.
- Click Add Network or Add a network manually.
- Enter the following details:
- Network name: Sonic
- New RPC URL:
https://rpc.soniclabs.comorhttps://sonic.api.onfinality.io/public - Chain ID: 146
- Currency symbol: S
- Block explorer URL:
https://sonicscan.org
- Save the network and switch to it.
If you are using a wallet that supports WalletConnect or chainlist, you can also use a one-click add. However, manually entering the details ensures you control which RPC endpoint you use.
Connecting a dApp with ethers or viem
For developers, connecting to Sonic is straightforward. Here is an example using ethers.js:
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider("https://sonic.api.onfinality.io/public");
const network = await provider.getNetwork();
console.log("Chain ID:", network.chainId); // 146
const blockNumber = await provider.getBlockNumber();
console.log("Latest block:", blockNumber);
With viem:
import { createPublicClient, http } from "viem";
const client = createPublicClient({
chain: {
id: 146,
name: "Sonic",
nativeCurrency: { name: "Sonic", symbol: "S", decimals: 18 },
rpcUrls: {
default: { http: ["https://sonic.api.onfinality.io/public"] },
},
},
transport: http(),
});
const blockNumber = await client.getBlockNumber();
console.log("Latest block:", blockNumber);
Making JSON-RPC calls with curl
If you are debugging or testing, a simple curl request can verify connectivity:
curl https://sonic.api.onfinality.io/public \
-X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
A successful response returns the latest block number in hexadecimal format.
WebSocket support and real-time data
For applications that need real-time updates, such as transaction monitoring or order books, WebSocket endpoints are essential. The official Sonic RPC supports WebSocket, and many providers offer WSS endpoints.
A WebSocket subscription example using viem:
import { createPublicClient, webSocket } from "viem";
const client = createPublicClient({
chain: {
id: 146,
name: "Sonic",
nativeCurrency: { name: "Sonic", symbol: "S", decimals: 18 },
rpcUrls: {
default: { webSocket: ["wss://sonic-rpc.publicnode.com"] },
},
},
transport: webSocket(),
});
const unwatch = client.watchBlockNumber({
onBlockNumber: (blockNumber) => {
console.log("New block:", blockNumber);
},
});
Note that public WebSocket endpoints may have connection limits. For production, a dedicated WebSocket endpoint is recommended.
Sonic RPC provider comparison
When evaluating Sonic RPC providers, consider the following criteria. The table below compares typical offerings, but always verify current details on each provider's site.
| Provider | Endpoint type | Archive data | WebSocket | Dedicated nodes |
|---|---|---|---|---|
| OnFinality | Public, managed, dedicated | Yes (on request) | Yes | Yes |
| dRPC | Public, premium | Yes (premium) | Yes | No |
| Dwellir | Public, dedicated | Yes | Yes | Yes |
| Ankr | Public, premium | Yes (premium) | Yes | No |
OnFinality offers both a public endpoint and dedicated Sonic nodes. Dedicated nodes give you isolated resources, which is important for high-throughput applications. You can see the full list of supported networks on our networks page.
When to choose a dedicated Sonic node
A dedicated node is a single-tenant RPC endpoint that is not shared with other users. This is useful when:
- Your application generates a high volume of requests and you need consistent performance.
- You need archive data or trace methods that are not available on public endpoints.
- You want to avoid rate limits and throttling.
- You need a private WebSocket endpoint for real-time data.
OnFinality's dedicated node service provides Sonic nodes with isolated resources. You can choose the node size and configuration that matches your workload.
Common pitfalls and troubleshooting
Even with the right endpoint, you may run into issues. Here are common problems and how to fix them:
- Wrong chain ID: Ensure your wallet or dApp uses chain ID 146. A mismatch causes transaction signing errors.
- Rate limiting: Public endpoints often limit requests per second. If you hit limits, switch to a managed or dedicated endpoint.
- Missing archive data: Some RPC methods like
eth_getLogswith large ranges require archive nodes. If you get errors, check if your provider offers archive data. - WebSocket disconnects: Public WebSocket endpoints may drop connections. Use a dedicated WebSocket endpoint for production.
- Block explorer discrepancies: If the explorer shows a different block height than your RPC, it may be a sync issue. Verify with multiple sources.
Monitoring your Sonic RPC health
To ensure your application stays healthy, monitor your RPC endpoint. A simple health check script can alert you to issues:
#!/bin/bash
RPC_URL="https://sonic.api.onfinality.io/public"
response=$(curl -s -X POST $RPC_URL \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}')
if echo "$response" | grep -q "result"; then
echo "RPC is healthy"
else
echo "RPC is down"
fi
For production, consider using a monitoring service that tracks latency, error rates, and block height lag.
Key Takeaways
- Sonic is an EVM Layer-1 with chain ID 146 and the S token.
- The official RPC is
https://rpc.soniclabs.com; OnFinality also provides a public endpoint athttps://sonic.api.onfinality.io/public. - For production, evaluate managed or dedicated RPC providers to avoid rate limits and get archive data.
- Dedicated Sonic nodes are ideal for high-throughput or data-heavy workloads.
- Always monitor your RPC endpoint health to ensure reliability.
Frequently Asked Questions
What is the Sonic network RPC URL?
The official Sonic mainnet RPC URL is https://rpc.soniclabs.com. OnFinality also provides a public endpoint at https://sonic.api.onfinality.io/public.
What is the Sonic chain ID?
The Sonic mainnet chain ID is 146 (0x92).
Does Sonic support WebSocket?
Yes, Sonic supports WebSocket RPC. Public WSS endpoints are available, but for production, a dedicated WebSocket endpoint is recommended.
Can I use Sonic with MetaMask?
Yes, you can add Sonic as a custom network in MetaMask using the chain settings above.
Does OnFinality offer Sonic RPC?
Yes, OnFinality provides a public Sonic endpoint and dedicated Sonic nodes. See our Sonic network page for details.
What is the Sonic block explorer?
The official Sonic block explorer is https://sonicscan.org.
Is Sonic an EVM-compatible chain?
Yes, Sonic is fully EVM-compatible, so you can deploy Ethereum smart contracts without modification.
How do I get Sonic testnet tokens?
Sonic testnet is separate from mainnet. You can get testnet tokens from the Sonic faucet, which is available in the Sonic documentation.
For more information on RPC pricing and supported networks, visit our RPC pricing page and networks page.