Mantle - Modular L2 Documentation
Complete guide to Mantle Network integration with Dwellir RPC. Learn how to build on Mantle's modular Layer 2, access JSON-RPC methods, and optimize your dApp performance.
Mantle RPC
With Dwellir, you get access to our global Mantle network which always routes your API requests to the nearest available location, ensuring low latency and the fastest speeds.
Get your API keyWhy Build on Mantle?
Mantle Network is the first modular Layer 2 solution, pioneering the use of EigenDA for data availability. Built on the OP Stack with innovative architectural designs, Mantle offers:
Modular Performance
- Sub-second block times - Fast finality with optimistic rollup
- Up to 500x lower costs than Ethereum mainnet
- 20,000+ TPS capacity - High throughput for demanding applications
Advanced Security
- EigenDA integration - First L2 with decentralized data availability
- Optimistic rollup security - Fraud proof protection with 7-day challenge period
- Ethereum inheritance - Full L1 security guarantees
Developer Excellence
- Full EVM compatibility - Deploy existing contracts without changes
- MNT gas token - Native token for gas and governance
- OP Stack foundation - Battle-tested infrastructure
Quick Start with Mantle
Connect to Mantle in seconds with Dwellir's optimized endpoints:
curl -sS -X POST https://api-mantle-mainnet.n.dwellir.com/<API_Keys_Are_Not_Made_for_Bots> \ -H 'Content-Type: application/json' \ -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'import { JsonRpcProvider } from 'ethers';const provider = new JsonRpcProvider( 'https://api-mantle-mainnet.n.dwellir.com/<API_Keys_Are_Not_Made_for_Bots>');const latest = await provider.getBlockNumber();console.log('block', latest);import requestsurl = 'https://api-mantle-mainnet.n.dwellir.com/<API_Keys_Are_Not_Made_for_Bots>'payload = { 'jsonrpc': '2.0', 'id': 1, 'method': 'eth_blockNumber', 'params': []}resp = requests.post(url, json=payload)print(resp.json())package mainimport ( "bytes" "fmt" "io" "net/http")func main() { url := "https://api-mantle-mainnet.n.dwellir.com/<API_Keys_Are_Not_Made_for_Bots>" payload := []byte(`{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}`) resp, err := http.Post(url, "application/json", bytes.NewBuffer(payload)) if err != nil { panic(err) } defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body))}Installation & Setup
import { JsonRpcProvider } from 'ethers';
// Connect to Mantle mainnet
const provider = new JsonRpcProvider(
'https://api-mantle-mainnet.n.dwellir.com/YOUR_API_KEY'
);
// Get network info
const network = await provider.getNetwork();
console.log('Connected to Mantle:', network.chainId); // 5000
// Query blockchain data
const blockNumber = await provider.getBlockNumber();
const balance = await provider.getBalance('0x...');
const gas = await provider.getFeeData();Network Information
Mainnet Configuration
| Parameter | Value | Details |
|---|---|---|
| Network Name | Mantle Network | |
| Chain ID | 5000 (0x1388) | |
| Currency | MNT | |
| Block Explorer | https://explorer.mantle.xyz | |
| Bridge | https://bridge.mantle.xyz |
Testnet Configuration (Sepolia)
| Parameter | Value | Details |
|---|---|---|
| Network Name | Mantle Sepolia | |
| Chain ID | 5003 (0x138B) | |
| Currency | MNT (Testnet) | |
| Block Explorer | https://explorer.testnet.mantle.xyz | |
| Faucet | https://faucet.testnet.mantle.xyz |
Available RPC Methods
Mantle supports all standard Ethereum JSON-RPC methods plus L2-specific extensions:
Core Methods
- Transaction Management - Send, sign, and track transactions
- State Queries - Get balances, code, storage
- Block Information - Query blocks and receipts
- Event Logs - Filter and retrieve events
- Gas Estimation - Estimate fees including L1 costs
L2-Specific Methods
eth_estimateL1Fee- Calculate L1 data posting costsrollup_gasPrices- Get current L1/L2 gas pricesrollup_getInfo- Query rollup configuration
Debug & Trace Methods
debug_traceTransaction- Detailed transaction execution tracesdebug_traceBlock- Trace all transactions in a blockdebug_traceCall- Simulate and trace calls
Architecture Overview
Modular Design
Mantle's modular architecture separates core blockchain functions for optimal performance:
- Execution Layer - Processes transactions using the EVM
- Settlement Layer - Posts state commitments to Ethereum
- Data Availability Layer - Uses EigenDA for efficient data storage
- Consensus Layer - Inherits security from Ethereum L1
EigenDA Integration
As the first L2 to integrate EigenDA, Mantle benefits from:
- Lower costs - Reduced data storage expenses
- Higher throughput - More efficient data availability
- Decentralization - Distributed DA layer
- ETH restaking - Additional security through EigenLayer
Transaction Lifecycle
- Submission - Users submit transactions to Mantle sequencer
- Execution - Transactions processed in batches
- Data Posting - Transaction data posted to EigenDA
- Settlement - State root submitted to Ethereum L1
- Finality - After 7-day challenge period
Development Resources
Smart Contract Deployment
Deploy your contracts to Mantle without modifications:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract MantleApp {
mapping(address => uint256) public balances;
function deposit() public payable {
balances[msg.sender] += msg.value;
}
function withdraw(uint256 amount) public {
require(balances[msg.sender] >= amount, "Insufficient balance");
balances[msg.sender] -= amount;
payable(msg.sender).transfer(amount);
}
}Using MNT Token
MNT is used for gas payments on Mantle:
// Send MNT
const tx = await signer.sendTransaction({
to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
value: ethers.parseEther('1.0') // 1 MNT
});
// Estimate gas in MNT
const gasEstimate = await provider.estimateGas(tx);
const gasPrice = await provider.getFeeData();
const gasCost = gasEstimate * gasPrice.gasPrice; // Cost in MNTBridging Assets
Bridge assets between Ethereum and Mantle:
// Bridge configuration
const BRIDGE_ADDRESS = '0x...'; // Mantle Bridge contract
const L1_TOKEN = '0x...'; // Token on Ethereum
const L2_TOKEN = '0x...'; // Token on Mantle
// Deposit from L1 to L2
async function depositToMantle(amount) {
const bridge = new Contract(BRIDGE_ADDRESS, BRIDGE_ABI, l1Signer);
const tx = await bridge.depositERC20(
L1_TOKEN,
L2_TOKEN,
amount,
{ value: bridgeFee }
);
await tx.wait();
}Gas Optimization
Understanding Mantle Fees
Mantle fees consist of two components:
- L2 Execution Fee - Cost to run transaction on Mantle
- L1 Data Fee - Cost to post data to Ethereum (via EigenDA)
// Calculate total fee
const l2GasPrice = await provider.getGasPrice();
const l2GasUsed = await provider.estimateGas(tx);
const l1Fee = await provider.send('eth_estimateL1Fee', [tx]);
const totalFee = (l2GasPrice * l2GasUsed) + BigInt(l1Fee);
console.log('Total fee:', ethers.formatEther(totalFee), 'MNT');Optimization Tips
- Batch Operations - Combine multiple operations in one transaction
- Use Events - Cheaper than storage for data that doesn't need to be on-chain
- Optimize Calldata - Minimize transaction input data
- Storage Packing - Pack multiple values into single storage slots
Common Use Cases
DeFi Protocols
- Lower fees enable more frequent rebalancing and smaller trades
- High throughput supports order book DEXs
- Fast finality improves user experience
Gaming & NFTs
- Affordable minting and trading
- High-frequency game actions
- Complex on-chain game logic
DAOs & Governance
- Cost-effective voting
- More frequent proposal submissions
- On-chain treasury management
Best Practices
Error Handling
try {
const tx = await contract.someMethod();
const receipt = await tx.wait();
if (receipt.status === 0) {
throw new Error('Transaction reverted');
}
} catch (error) {
if (error.code === 'CALL_EXCEPTION') {
console.error('Contract reverted:', error.reason);
} else if (error.code === 'INSUFFICIENT_FUNDS') {
console.error('Not enough MNT for gas');
}
}Rate Limiting
// Implement exponential backoff
async function retryWithBackoff(fn, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (error) {
if (i === maxRetries - 1) throw error;
const delay = Math.pow(2, i) * 1000;
await new Promise(resolve => setTimeout(resolve, delay));
}
}
}Support & Resources
Official Resources
- Documentation: docs.mantle.xyz
- GitHub: github.com/mantlenetworkio
- Discord: discord.gg/mantle
- Twitter: @0xMantle
Dwellir Support
- Dashboard: dashboard.dwellir.com
- Status Page: status.dwellir.com
- Support: support@dwellir.com
Start Building
Ready to build on Mantle? Get your free API key and start developing:
Launch Your Mantle dApp Today
Get instant access to Mantle's modular L2 with our high-performance RPC endpoints
Get Your Free API Key
Need help? Check our API reference or contact support.
eth_coinbase
Check the legacy eth_coinbase compatibility method on Manta Pacific. Public endpoints may return an address, `unimplemented`, or another unsupported-method response depending on the client.
eth_blockNumber
Get the current block height on Mantle. Essential for syncing dApps, monitoring transaction confirmations, and blockchain state tracking.

