DEV Community

OnFinality
OnFinality

Posted on Originally published at onfinality.io

Unichain Endpoint: Chain Settings, RPC, and Connection Guide

Quick Recommendation: Public vs Dedicated Unichain Endpoint

Before diving into configuration, decide which endpoint type fits your use case. For a quick prototype or a hackathon, the public endpoint is enough. For a production dApp, a dedicated node gives you predictable performance and avoids rate limits from shared infrastructure.

Use Case Recommended Endpoint Why
Testing on Sepolia Public testnet endpoint Free, low volume, easy setup
Mainnet dApp with light traffic Public mainnet endpoint Simple, no cost, but shared
Production dApp with heavy traffic Dedicated node Consistent performance, no noisy neighbors
Indexing or analytics Dedicated archive node Access to historical state

If you need a dedicated node, check the Unichain network page for availability and provisioning options. For pricing details, see RPC pricing.

What Is Unichain and Why Does the Endpoint Matter?

Unichain is an Ethereum Layer 2 network built on the OP Stack, launched by Uniswap Labs to provide fast, low-cost transactions for DeFi applications. It uses optimistic rollups to scale Ethereum, with a focus on improving liquidity and trading efficiency.

The endpoint is the URL your application uses to send JSON-RPC requests to the network. It's the gateway for reading blockchain data, submitting transactions, and interacting with smart contracts. Choosing the right endpoint affects latency, reliability, and cost.

Unichain Chain Settings at a Glance

Here are the key network parameters you need to configure your wallet or dApp:

Parameter Value
Network Name Unichain
Chain ID 130
Native Currency ETH (Ether)
Block Explorer https://uniscan.xyz
Public RPC URL https://unichain.api.onfinality.io/public

For the Sepolia testnet, use Chain ID 1301 and the explorer https://unichain-sepolia.blockscout.com.

How to Connect to Unichain: Wallet and dApp Configuration

Adding Unichain to MetaMask

  1. Open MetaMask and click the network dropdown.
  2. Click "Add network" and enter the details from the table above.
  3. Save and switch to the Unichain network.

Using ethers.js (v6)

import { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider('https://unichain.api.onfinality.io/public');

// Get the latest block number
const blockNumber = await provider.getBlockNumber();
console.log('Latest block:', blockNumber);
Enter fullscreen mode Exit fullscreen mode

Using viem

import { createPublicClient, http } from 'viem';

const client = createPublicClient({
  chain: {
    id: 130,
    name: '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('Latest block:', blockNumber);
Enter fullscreen mode Exit fullscreen mode

JSON-RPC Methods and Examples

Unichain supports standard Ethereum JSON-RPC methods. Here's a curl example to get the latest block:

curl -X POST https://unichain.api.onfinality.io/public \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
Enter fullscreen mode Exit fullscreen mode

Expected response:

{"jsonrpc":"2.0","id":1,"result":"0x1a2b3c"}
Enter fullscreen mode Exit fullscreen mode

Other common methods include eth_getBalance, eth_call, eth_sendRawTransaction, and eth_getLogs. For a full list, refer to the Ethereum JSON-RPC specification.

Debugging Common Connection Issues

If you're having trouble connecting, check these common pitfalls:

Symptom Likely Cause Fix
Connection timeout Network firewall or wrong URL Verify the URL and check your firewall settings
Invalid chain ID Wallet configured with wrong chain ID Use 130 for mainnet, 1301 for Sepolia
Rate limit exceeded Too many requests to public endpoint Switch to a dedicated node or implement caching
Transaction not mined Insufficient gas or nonce issues Check gas price and nonce

When to Move to a Dedicated Unichain Node

Public endpoints are convenient but shared. If your application experiences any of the following, consider a dedicated node:

  • High request volume that hits rate limits
  • Need for consistent low latency
  • Requirements for archive data or trace methods
  • Compliance or security needs for private infrastructure

OnFinality offers dedicated nodes for Unichain, giving you a private endpoint with dedicated resources. Visit the Unichain network page to learn more.

Key Takeaways

  • Unichain is an OP Stack-based Ethereum L2 with Chain ID 130.
  • Use the public endpoint https://unichain.api.onfinality.io/public for testing and light use.
  • For production, evaluate dedicated nodes to avoid rate limits and ensure performance.
  • Always verify chain settings and use the correct endpoint for mainnet vs testnet.

Frequently Asked Questions

What is the Unichain RPC endpoint?

The public RPC endpoint is https://unichain.api.onfinality.io/public. For Sepolia testnet, use https://unichain-sepolia.api.onfinality.io/public.

Is Unichain an Ethereum Layer 2?

Yes, Unichain is an Ethereum Layer 2 network built on the OP Stack, designed for fast and low-cost DeFi transactions.

How do I get a dedicated Unichain endpoint?

You can provision a dedicated node through OnFinality. Visit the Unichain network page for details.

What is the Unichain chain ID?

The chain ID is 130 for mainnet and 1301 for Sepolia testnet.

Can I use the public endpoint for production?

It's possible for light usage, but for production workloads, a dedicated node is recommended to avoid rate limits and ensure reliability.

For more information on supported networks, see the supported networks page.

Related resources

Originally published at OnFinality.

Top comments (0)