Mantle Network - Build on the First Modular Layer 2
Chain RPC
With Dwellir, you get access to our global Chain network which always routes your API requests to the nearest available location, ensuring low latency and the fastest speeds.
Why 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:
🔗 RPC Endpoints
https://api-mantle-mainnet.n.dwellir.com/YOUR_API_KEY
Quick Connect:
curl -X POST https://api-mantle-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
Installation & Setup
- Ethers.js
- Web3.js
- Python
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();
import Web3 from 'web3';
// Connect to Mantle
const web3 = new Web3(
'https://api-mantle-mainnet.n.dwellir.com/YOUR_API_KEY'
);
// Get chain ID
const chainId = await web3.eth.getChainId();
console.log('Chain ID:', chainId); // 5000n
// Query blockchain
const block = await web3.eth.getBlock('latest');
const balance = await web3.eth.getBalance('0x...');
const gasPrice = await web3.eth.getGasPrice();
from web3 import Web3
# Connect to Mantle mainnet
w3 = Web3(Web3.HTTPProvider(
'https://api-mantle-mainnet.n.dwellir.com/YOUR_API_KEY'
))
# Verify connection
if w3.is_connected():
print(f"Connected to Mantle")
print(f"Chain ID: {w3.eth.chain_id}") # 5000
print(f"Latest block: {w3.eth.block_number}")
# Get MNT balance
address = "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
balance = w3.eth.get_balance(address)
print(f"Balance: {w3.from_wei(balance, 'ether')} MNT")
Network Information
Mainnet Configuration
- Network Name: Mantle Network
- Chain ID:
5000
(0x1388) - Currency: MNT
- Block Explorer: https://explorer.mantle.xyz
- Bridge: https://bridge.mantle.xyz
Testnet Configuration (Sepolia)
- 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
Available JSON-RPC Methods
📊 Reading Blockchain Data
Query blocks, transactions, and account states
📤 Sending Transactions
Submit and manage transactions
📝 Smart Contract Interaction
Call and interact with smart contracts
🔧 Node & Network Info
Query node status and network information
Ready to integrate Base into your dApp?
Get your API key →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 MNT
Bridging 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.