Logo
New RPC users get 35% off their first monthView the offer
RPC Assistant

Mantle Endpoint: Chain Settings, RPC URLs, and Debugging

Summary

Learn how to connect to Mantle mainnet with the correct chain ID, RPC endpoint, and explorer settings. This page covers public and dedicated RPC options, common JSON-RPC methods, and troubleshooting steps for production dApps.

Mantle Endpoint at a Glance

Mantle is an Ethereum Layer 2 network that uses an optimistic rollup architecture with a modular data availability layer. If you are building a dApp, indexer, or backend service on Mantle, the first thing you need is a reliable RPC endpoint to read chain state and submit transactions.

Here are the essential network details for Mantle mainnet:

SettingValue
Chain ID5000
Network NameMantle
Native CurrencyMNT (18 decimals)
Block Explorerhttps://mantlescan.xyz
Public RPC URLhttps://mantle.api.onfinality.io/public

This table is the minimum you need to configure a wallet, a dApp, or a backend service. For production workloads, you will likely want a dedicated RPC endpoint rather than a shared public one. We will cover that decision in the next section.

Quick Recommendation: Public or Dedicated Endpoint?

Before you copy an RPC URL into your code, decide which type of endpoint fits your use case. The right choice depends on your traffic, your tolerance for rate limits, and whether you need archive data.

  • Prototyping or low-volume testing: A public endpoint like https://mantle.api.onfinality.io/public is fine. It lets you validate contract calls and send a few transactions without any setup.
  • Production dApp or backend: Use a dedicated RPC endpoint. Public endpoints are shared and can be rate-limited under heavy load. A dedicated node gives you consistent throughput and avoids noisy-neighbor issues.
  • Indexing or analytics: If you need historical state or want to avoid eth_getLogs limits, consider an archive node or a provider that supports archive data.

If you are unsure, start with a public endpoint for development, then migrate to a dedicated endpoint before launch. OnFinality offers both public RPC access and dedicated nodes for Mantle, so you can scale without changing your code.

Mantle RPC Endpoint Options

There are several ways to access Mantle RPC endpoints. Each option has tradeoffs in cost, reliability, and control.

Public Endpoints

Public endpoints are free and easy to use. They are suitable for development, small projects, and occasional queries. However, they are shared across many users, so they can be slower or rate-limited during peak times.

OnFinality provides a public Mantle endpoint at https://mantle.api.onfinality.io/public. This is a good starting point for testing.

Dedicated Nodes

A dedicated node gives you a private RPC endpoint with dedicated resources. You do not share the node with other users, which means more consistent performance and clear rate limits imposed by other tenants.

Dedicated nodes are ideal for production dApps, high-traffic services, and applications that need to make many requests per second. OnFinality's dedicated node service lets you deploy a Mantle node with your own endpoint, and you can choose between archive and full nodes depending on your needs.

Third-Party Providers

Many RPC providers offer Mantle endpoints. When comparing providers, look at the following:

  • Throughput limits: What is the maximum requests per second (RPS) on the plan you are considering?
  • Archive data: Does the provider offer archive nodes? If so, at what additional cost?
  • WebSocket support: Do you need real-time updates? Make sure the provider supports WSS.
  • Geographic distribution: Are the nodes located near your users to reduce latency?

OnFinality is one option among several. We recommend evaluating providers based on your specific workload, not just on price.

Chain Settings for Wallets and dApps

When you add Mantle to a wallet like MetaMask, or configure a dApp, you need the correct chain settings. Here is a JSON snippet you can use:

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

Note that the chain ID is 5000 in decimal, which is 0x1388 in hexadecimal. Some tools require the hex format, so it is useful to know both.

Making JSON-RPC Calls to Mantle

Once you have an endpoint, you can interact with Mantle using standard Ethereum JSON-RPC methods. Here is a basic curl example to get the latest block number:

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

You can also use libraries like ethers.js or viem in your dApp. Here is an example with ethers.js:

import { ethers } from "ethers";

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

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

getBlockNumber();

For real-time updates, you can use WebSocket. OnFinality's public endpoint supports WSS, but for production, you should use a dedicated endpoint with a stable WSS URL. Here is a simple WebSocket subscription example:

const WebSocket = require('ws');
const ws = new WebSocket('wss://mantle.api.onfinality.io/public');

ws.on('open', function open() {
  ws.send(JSON.stringify({
    jsonrpc: '2.0',
    method: 'eth_subscribe',
    params: ['newHeads'],
    id: 1
  }));
});

ws.on('message', function incoming(data) {
  console.log(data);
});

Common Failure Modes and How to Fix Them

Even with a correct endpoint, you may run into issues. Here are common problems and their solutions.

Rate Limiting

If you see errors like 429 Too Many Requests or rate limit exceeded, you are hitting the limits of the public endpoint. The fix is to either reduce your request frequency or upgrade to a dedicated node with higher limits.

Connection Timeouts

If your requests time out, the endpoint may be overloaded or your network connection may be unstable. Check your internet connection and try again. If the problem persists, consider using a dedicated node with a service-level agreement.

Incorrect Chain ID

If you are sending transactions and they fail, double-check that you are using the correct chain ID (5000). Using the wrong chain ID can cause transactions to be rejected.

Missing Archive Data

If you need historical data and your node is not an archive node, you may get errors when querying old states. In that case, you need an archive node. OnFinality offers archive nodes for Mantle; see our network page for details.

Debugging Your Mantle Connection

When something goes wrong, a systematic approach helps. Here is a debugging path:

  1. Check the endpoint: Verify that the URL is correct and reachable. Use curl to make a simple eth_chainId call.
  2. Check the chain ID: Ensure your client is using 5000.
  3. Check the method: Some methods may not be supported on public endpoints. For example, eth_getLogs with a wide block range may be restricted.
  4. Check the payload: Make sure your JSON-RPC request is well-formed.
  5. Check the response: Look at the error message. It often tells you exactly what is wrong.

Here is a curl command to check the chain ID:

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

If you get a response with result: "0x1388", your endpoint is working correctly.

Monitoring Your Endpoint Health

For production applications, you should monitor your RPC endpoint to detect issues early. You can set up a simple health check that calls eth_blockNumber every few seconds and alerts if the request fails or the block number does not advance.

Here is a simple monitoring script using Node.js:

const { ethers } = require("ethers");

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

async function checkHealth() {
  try {
    const blockNumber = await provider.getBlockNumber();
    console.log(`Healthy. Block: ${blockNumber}`);
  } catch (error) {
    console.error("Health check failed:", error);
  }
}

setInterval(checkHealth, 30000);

For more advanced monitoring, you can track response times, error rates, and block height lag. If you are using a dedicated node, you can also monitor node resource usage.

Key Takeaways

  • Mantle mainnet uses chain ID 5000 and the native token MNT.
  • The public RPC endpoint https://mantle.api.onfinality.io/public is suitable for development and testing.
  • For production workloads, consider a dedicated RPC endpoint to avoid rate limits and ensure consistent performance.
  • Always verify the chain ID and use the correct JSON-RPC methods.
  • Monitor your endpoint health to catch issues before they affect your users.

Frequently Asked Questions

What is the Mantle RPC URL?

The public RPC URL for Mantle mainnet is https://mantle.api.onfinality.io/public. For production use, you may want a dedicated endpoint from a provider like OnFinality.

What is the Mantle chain ID?

The Mantle chain ID is 5000 (decimal) or 0x1388 (hexadecimal).

How do I add Mantle to MetaMask?

You can add Mantle to MetaMask by using the chain settings provided in this article. Alternatively, you can use a network switcher tool that supports Mantle.

Why is my Mantle RPC request failing?

Common reasons include incorrect endpoint URL, wrong chain ID, rate limiting, or network issues. Check the error message and refer to the debugging section above.

Does OnFinality offer dedicated Mantle nodes?

Yes, OnFinality offers dedicated nodes for Mantle. You can find more information on our dedicated node page and Mantle network page.

For more details on pricing and supported networks, see our RPC pricing page and supported networks list.

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