Logo
RPC Assistant

Mantle RPC: Chain Settings, Endpoints, and How to Choose a Provider

Summary

Mantle is an EVM-compatible Layer 2 rollup that uses a modular architecture with Ethereum for security and its own data availability layer. To connect wallets and dApps, you need the correct Mantle RPC endpoint, chain ID, and network settings. This page covers the essential chain settings, public and private endpoint options, and how to evaluate RPC providers for production workloads.

Quick Reference: Mantle Chain Settings

Before you connect to Mantle, you need the correct network parameters. Here are the essential settings for Mantle Mainnet:

ParameterValue
Network NameMantle
RPC URL (public)https://rpc.mantle.xyz
Chain ID5000 (0x1388)
Currency SymbolMNT
Block Explorerhttps://mantlescan.xyz
WebSocket (public)wss://mantle-rpc.publicnode.com

For Mantle Sepolia testnet, the chain ID is 5003 and the public RPC is https://rpc.sepolia.mantle.xyz. Always verify these values against the official Mantle documentation, as they can change.

How to Choose a Mantle RPC Provider

If you are building a production dApp, the public RPC endpoint is not enough. Public endpoints are rate-limited and can become unreliable under load. You need a provider that offers:

  • High availability: Multiple redundant nodes and automatic failover.
  • Low latency: Global edge network to reduce round-trip time.
  • Scalability: Ability to handle spikes in traffic without throttling.
  • Support: Access to archive data, trace methods, and WebSocket subscriptions.

Evaluate providers based on your workload. A simple wallet can use a public endpoint, but a DeFi protocol or NFT marketplace needs a dedicated or shared private endpoint with a service-level agreement.

What Is Mantle Network?

Mantle is an Ethereum Layer 2 optimistic rollup that uses a modular architecture. It separates execution, consensus, settlement, and data availability into distinct layers. The execution layer is EVM-compatible, so you can use standard Ethereum tools like ethers.js, viem, and Hardhat without modification. Mantle uses Ethereum for consensus and settlement, and its own data availability layer (Mantle DA) to reduce costs and increase throughput.

Connecting to Mantle with a Wallet

To add Mantle to MetaMask or another wallet, you can use Chainlist or manually enter the network details. Here is a manual configuration example:

{
  "chainId": "0x1388",
  "chainName": "Mantle",
  "nativeCurrency": {
    "name": "MNT",
    "symbol": "MNT",
    "decimals": 18
  },
  "rpcUrls": ["https://rpc.mantle.xyz"],
  "blockExplorerUrls": ["https://mantlescan.xyz"]
}

You can also use the wallet_addEthereumChain RPC method to programmatically add the network from your dApp.

Making Your First JSON-RPC Request

Once you have an RPC endpoint, you can test it with a simple eth_chainId request:

curl -X POST https://rpc.mantle.xyz \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}'

Expected response:

{"jsonrpc":"2.0","result":"0x1388","id":1}

The result 0x1388 is the hexadecimal representation of 5000, confirming you are on Mantle Mainnet.

Using ethers.js with Mantle

Here is a minimal example using ethers.js to read the latest block number:

import { ethers } from "ethers";

const provider = new ethers.JsonRpcProvider("https://rpc.mantle.xyz");

async function getBlockNumber() {
  const blockNumber = await provider.getBlockNumber();
  console.log("Latest block:", blockNumber);
}

getBlockNumber();

Public vs Private Mantle RPC Endpoints

Public endpoints are convenient for testing, but they have limitations:

  • Rate limits: Public endpoints often throttle requests per IP.
  • No guarantees: They can go down or become slow without notice.
  • Limited methods: Some advanced methods like trace_* may be disabled.

Private endpoints, such as those from OnFinality, offer dedicated or shared infrastructure with higher rate limits, better performance, and additional features like archive data and WebSocket support. For production dApps, a private endpoint is recommended.

WebSocket Subscriptions for Real-Time Data

If your dApp needs real-time updates, use WebSocket. Here is an example using viem:

import { createPublicClient, webSocket } from "viem";

const client = createPublicClient({
  transport: webSocket("wss://mantle-rpc.publicnode.com"),
});

const unwatch = client.watchBlockNumber({
  onBlockNumber: (blockNumber) => {
    console.log("New block:", blockNumber);
  },
});

Common Pitfalls and Troubleshooting

  • Wrong chain ID: Ensure you use 5000 for mainnet and 5003 for testnet.
  • Rate limiting: If you get 429 Too Many Requests, switch to a private endpoint.
  • WebSocket disconnects: Use a provider that supports persistent connections and auto-reconnect.
  • Missing methods: Some providers do not support eth_getLogs with large ranges; use a provider with archive data.

Key Takeaways

  • Mantle is an EVM-compatible L2 with chain ID 5000 and native token MNT.
  • Public RPC endpoints are fine for testing, but production apps need reliable private infrastructure.
  • Use standard Ethereum tools and JSON-RPC methods to interact with Mantle.
  • Evaluate providers based on uptime, latency, scalability, and support.

Frequently Asked Questions

What is the Mantle RPC URL?

The public RPC URL is https://rpc.mantle.xyz. For WebSocket, use wss://mantle-rpc.publicnode.com.

What is the Mantle chain ID?

Mantle Mainnet chain ID is 5000 (0x1388). Mantle Sepolia testnet uses 5003.

How do I get MNT tokens for gas?

You can bridge MNT from Ethereum using the official Mantle bridge, or use a faucet for testnet.

Can I use Ethereum tools with Mantle?

Yes, Mantle is EVM-compatible, so ethers.js, viem, Hardhat, and other Ethereum tools work without changes.

Where can I find a reliable Mantle RPC provider?

OnFinality offers managed Mantle RPC endpoints. Check our RPC pricing and supported networks for details.

RPC Knowledge Base

Related RPC details

Never Worry about Infrastructure Again

OnFinality takes away the heavy lifting of DevOps so you can build smarter and faster.

Get Started