Summary
Unichain is an Ethereum Layer 2 network built to reduce latency and lower costs for DeFi applications. This article explains what a Unichain node is, how to connect to the network via RPC endpoints, and how to choose between public, managed, and dedicated node options for your project.
Quick decision: which Unichain node option fits your project?
Before diving into the technical details, here is a quick way to decide which Unichain node approach is right for you:
- Prototyping or low-volume dApp: Use the public RPC endpoint or a free tier from a managed provider. This is enough for development, testing, and small-scale usage.
- Production dApp with moderate traffic: Use a managed RPC service that offers load-balanced endpoints, WebSocket support, and scaling. This avoids the operational overhead of running your own node.
- High-throughput or data-heavy workloads: Consider a dedicated node. This gives you isolated resources, consistent performance, and the ability to handle bursts without affecting other users.
- Compliance or data control: A dedicated node gives you full control over the node configuration and data, which can be important for certain institutional use cases.
If you are unsure, start with a managed RPC service and upgrade to a dedicated node when you hit consistent limits or need more predictable performance.
What is a Unichain node?
A Unichain node is a client that participates in the Unichain network, an Ethereum Layer 2 (L2) solution designed to provide fast, low-cost transactions for DeFi applications. Nodes validate transactions, store the network state, and expose an RPC interface that allows applications to read and write data to the blockchain.
Running a Unichain node means running a client that syncs with the network, processes blocks, and serves requests. However, for most developers, running a node is not the primary goal—they need a reliable way to interact with the network. This is where RPC endpoints come in.
Unichain chain settings at a glance
Here are the key network parameters for Unichain mainnet and its Sepolia testnet:
| Parameter | Unichain Mainnet | Unichain Sepolia Testnet |
|---|---|---|
| Chain ID | 130 | 1301 |
| Network Name | Unichain | Unichain Sepolia Testnet |
| Native Currency | ETH | Sepolia ETH |
| Block Explorer | uniscan.xyz | unichain-sepolia.blockscout.com |
| Public RPC Endpoint | https://unichain.api.onfinality.io/public | https://unichain-sepolia.api.onfinality.io/public |
These settings are essential when configuring your wallet, dApp, or backend service.
How to connect to Unichain: RPC endpoints and configuration
To interact with Unichain, you need an RPC endpoint. Here is how to configure your wallet or dApp using the public endpoint.
Wallet configuration
If you want to add Unichain to MetaMask or another wallet, use the following network settings:
{
"chainId": "0x82",
"chainName": "Unichain",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"rpcUrls": ["https://unichain.api.onfinality.io/public"],
"blockExplorerUrls": ["https://uniscan.xyz"]
}
For the Sepolia testnet, use chain ID 0x515 and the testnet RPC URL.
Using ethers.js or viem
Here is an example using ethers.js to connect to Unichain:
const { ethers } = require("ethers");
const provider = new ethers.JsonRpcProvider("https://unichain.api.onfinality.io/public");
async function getBlockNumber() {
const blockNumber = await provider.getBlockNumber();
console.log("Current block number:", blockNumber);
}
getBlockNumber();
With viem:
import { createPublicClient, http } from "viem";
const client = createPublicClient({
chain: {
id: 130,
name: "Unichain",
network: "unichain",
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
rpcUrls: {
default: { http: ["https://unichain.api.onfinality.io/public"] },
},
},
transport: http(),
});
const blockNumber = await client.getBlockNumber();
console.log("Current block number:", blockNumber);
Making JSON-RPC calls with curl
You can also test the endpoint directly with curl:
curl https://unichain.api.onfinality.io/public \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
This should return the latest block number in hexadecimal format.
Public vs. managed vs. dedicated Unichain nodes
When you search for "unichain node," you are likely trying to decide how to access the network. Here are the three main options:
Public RPC endpoints
Public endpoints are free and easy to use, but they are often rate-limited and can be unreliable under heavy load. They are suitable for development and testing, but not for production applications that require consistent performance.
Managed RPC services
Managed RPC providers like OnFinality offer reliable, scalable endpoints with features like:
- Load balancing across multiple nodes
- WebSocket support for real-time data
- Archive data for historical queries
- Dedicated support and SLAs (subject to plan)
Managed services abstract away the complexity of running and maintaining nodes, letting you focus on your application.
Dedicated nodes
A dedicated node gives you exclusive access to a node instance. This means:
- No shared rate limits
- Consistent performance
- Full control over node configuration
- Ability to run custom queries or use specialized features
Dedicated nodes are ideal for high-traffic applications, data analytics, or when you need to comply with strict data policies.
How to choose a Unichain node provider
When evaluating a Unichain node provider, consider the following criteria:
| Criterion | What to check | Why it matters |
|---|---|---|
| Reliability | Uptime history, redundancy | Downtime can break your dApp |
| Performance | Latency, throughput | Slow responses hurt user experience |
| Scalability | Ability to handle traffic spikes | Your app may grow unexpectedly |
| Data access | Archive data, trace support | Historical queries may be needed |
| WebSocket support | Real-time subscriptions | Essential for live updates |
| Pricing | Free tier, pay-as-you-go, dedicated plans | Cost should align with your usage |
| Support | Documentation, community, SLAs | Good support reduces resolution time |
OnFinality offers both managed RPC and dedicated node options for Unichain. You can start with the public endpoint or a free tier, then scale to a dedicated node as your needs grow. Check the RPC pricing page for details.
Common pitfalls and how to avoid them
1. Using the wrong chain ID
Make sure you use chain ID 130 for mainnet and 1301 for Sepolia. A wrong chain ID will cause transactions to fail or be sent to the wrong network.
2. Rate limiting on public endpoints
Public endpoints often have rate limits. If you are building a production app, use a managed service or dedicated node to avoid hitting these limits.
3. Not handling WebSocket reconnections
If you use WebSocket subscriptions, implement reconnection logic to handle network drops. This is critical for real-time applications.
4. Ignoring archive data needs
If your app needs historical state, ensure your provider offers archive nodes. Not all endpoints provide archive data.
Monitoring your Unichain node
Once you have a node or RPC endpoint, monitoring is essential. Here is a simple health check using curl:
curl https://unichain.api.onfinality.io/public \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}'
If the node is synced, the response will be false. If it is still syncing, you will get a status object. For production, set up automated monitoring to alert you when the endpoint is down or slow.
Key Takeaways
- Unichain is an Ethereum L2 with chain ID 130 (mainnet) and 1301 (Sepolia testnet).
- You can connect using public RPC endpoints, but for production, consider managed RPC or dedicated nodes.
- Evaluate providers based on reliability, performance, scalability, data access, and support.
- Use the correct chain settings and handle WebSocket reconnections to avoid common issues.
- Monitor your node health regularly to ensure uptime.
Frequently Asked Questions
What is a Unichain node?
A Unichain node is a client that participates in the Unichain network, validating transactions and serving RPC requests. Most developers use RPC endpoints to interact with the network without running their own node.
How do I get a Unichain RPC endpoint?
You can use the public endpoint https://unichain.api.onfinality.io/public or sign up for a managed RPC service like OnFinality for production use.
What is the Unichain chain ID?
The Unichain mainnet chain ID is 130, and the Sepolia testnet chain ID is 1301.
Do I need a dedicated Unichain node?
If your application has high traffic, requires consistent performance, or needs custom node configuration, a dedicated node is recommended. For smaller projects, a managed RPC service may suffice.
Can I use WebSocket with Unichain?
Yes, managed RPC providers typically offer WebSocket endpoints for real-time subscriptions. Check your provider's documentation for the WebSocket URL.
How do I add Unichain to MetaMask?
Use the network settings provided above, including the correct chain ID and RPC URL. You can also use a wallet that supports custom networks.
Where can I find more information about Unichain?
Visit the Unichain network page on OnFinality for details, or explore the supported networks list.