Immutable zkEVM - Build on the Premier Gaming Blockchain
Immutable zkEVM RPC
With Dwellir, you get access to our global Immutable zkEVM network which always routes your API requests to the nearest available location, ensuring low latency and the fastest speeds.
Why Build on Immutable zkEVM?
Immutable zkEVM is the first EVM-compatible blockchain built specifically for gaming, offering seamless Web3 integration for game developers. Powered by zero-knowledge technology, Immutable zkEVM delivers:
🎮 Gaming-First Design
- Purpose-built for games - Optimized infrastructure for gaming workloads
- Seamless Web3 integration - Add blockchain features without sacrificing UX
- Developer-friendly tools - Comprehensive SDK and gaming-specific APIs
⚡ High-Performance Infrastructure
- Instant transactions - Fast block times for real-time gaming
- Massive scale - Handle thousands of concurrent players
- Zero-knowledge proofs - Efficient transaction batching and verification
🛡️ Enterprise-Grade Security
- Ethereum security - Inherits L1 security guarantees
- Battle-tested technology - Built on proven zkEVM architecture
- Immutable backing - Supported by leading Web3 gaming infrastructure
Quick Start with Immutable zkEVM
Connect to Immutable zkEVM in seconds with Dwellir's optimized endpoints:
🔗 RPC Endpoints
https://api-immutable-zkevm-mainnet.n.dwellir.com/YOUR_API_KEY
Quick Connect:
curl -X POST https://api-immutable-zkevm-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 v6
- Web3.js
- Viem
import { JsonRpcProvider } from 'ethers';
// Connect to Immutable zkEVM mainnet
const provider = new JsonRpcProvider(
'https://api-immutable-zkevm-mainnet.n.dwellir.com/YOUR_API_KEY'
);
// Get the latest block
const block = await provider.getBlock('latest');
console.log('Latest block:', block.number);
// Query account balance
const balance = await provider.getBalance('0x...');
console.log('Balance:', balance.toString());
const Web3 = require('web3');
// Connect to Immutable zkEVM mainnet
const web3 = new Web3(
'https://api-immutable-zkevm-mainnet.n.dwellir.com/YOUR_API_KEY'
);
// Get chain ID to verify connection
const chainId = await web3.eth.getChainId();
console.log('Connected to Immutable zkEVM:', chainId === 13371);
// Get gas price for optimal transaction pricing
const gasPrice = await web3.eth.getGasPrice();
console.log('Current gas price:', gasPrice);
import { createPublicClient, http } from 'viem';
import { defineChain } from 'viem';
// Define Immutable zkEVM chain
const immutableZkEvm = defineChain({
id: 13371,
name: 'Immutable zkEVM',
network: 'immutable-zkevm',
nativeCurrency: { name: 'IMX', symbol: 'IMX', decimals: 18 },
rpcUrls: {
default: { http: ['https://api-immutable-zkevm-mainnet.n.dwellir.com/YOUR_API_KEY'] },
public: { http: ['https://rpc.immutable.com'] },
},
blockExplorers: {
default: { name: 'Immutable Explorer', url: 'https://explorer.immutable.com' },
},
});
// Create Immutable zkEVM client
const client = createPublicClient({
chain: immutableZkEvm,
transport: http('https://api-immutable-zkevm-mainnet.n.dwellir.com/YOUR_API_KEY'),
});
// Read contract data
const data = await client.readContract({
address: '0x...',
abi: contractAbi,
functionName: 'balanceOf',
args: ['0x...'],
});
Network Information
Chain ID
13371
MainnetBlock Time
2 seconds
AverageGas Token
IMX
Native tokenRPC Standard
Ethereum
JSON-RPC 2.0JSON-RPC API Reference
Immutable zkEVM supports the full Ethereum JSON-RPC API specification. Access all standard methods optimized for gaming workloads.
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 build games on Immutable zkEVM?
Get your API key →Common Integration Patterns
🎮 Gaming Transaction Patterns
Handle high-frequency gaming transactions efficiently:
// Batch multiple game actions in a single transaction
async function batchGameActions(actions) {
const receipt = await provider.waitForTransaction(txHash, 1);
// Fast confirmation for real-time gaming
console.log('Transaction confirmed in:', receipt.blockNumber);
return receipt;
}
💎 NFT and Asset Management
Optimize for gaming assets and NFTs:
// Efficient gas estimation for gaming transactions
const gasEstimate = await provider.estimateGas(tx);
// Immutable zkEVM optimized for gaming workloads
const optimizedGas = Math.ceil(gasEstimate * 1.1); // 10% buffer
// Set gas with gaming-optimized pricing
const txWithGas = {
...tx,
gasLimit: optimizedGas,
maxFeePerGas: await provider.getFeeData().maxFeePerGas
};
🔍 Game Event Tracking
Efficiently query game-related events:
// Query game events with optimized batching
async function getGameEvents(contract, eventName, fromBlock = 0) {
const filter = contract.filters[eventName]();
const events = [];
const batchSize = 5000; // Immutable zkEVM optimized batch size
for (let i = fromBlock; i <= currentBlock; i += batchSize) {
const batch = await contract.queryFilter(
filter,
i,
Math.min(i + batchSize - 1, currentBlock)
);
events.push(...batch);
}
return events;
}
Performance Best Practices
1. Batch Requests
Combine multiple RPC calls for optimal performance:
const batch = [
{ method: 'eth_blockNumber', params: [] },
{ method: 'eth_gasPrice', params: [] },
{ method: 'eth_getBalance', params: [address, 'latest'] }
];
const results = await provider.send(batch);
2. Connection Pooling
Reuse provider instances to minimize connection overhead:
// Singleton pattern for provider
class ImmutableProvider {
static instance = null;
static getInstance() {
if (!this.instance) {
this.instance = new JsonRpcProvider(
'https://api-immutable-zkevm-mainnet.n.dwellir.com/YOUR_API_KEY'
);
}
return this.instance;
}
}
3. Smart Caching
Cache immutable data to reduce API calls:
const cache = new Map();
async function getCachedBlockData(blockNumber) {
const key = `block_${blockNumber}`;
if (!cache.has(key)) {
const block = await provider.getBlock(blockNumber);
cache.set(key, block);
}
return cache.get(key);
}
Troubleshooting Common Issues
Error: "Insufficient funds"
Immutable zkEVM transactions require IMX for gas fees:
// Check IMX balance for gas fees
const balance = await provider.getBalance(address);
const gasEstimate = await provider.estimateGas(tx);
const gasPrice = await provider.getGasPrice();
const totalRequired = gasEstimate * gasPrice + (tx.value || 0n);
if (balance < totalRequired) {
throw new Error(`Need ${totalRequired - balance} more IMX`);
}
Error: "Transaction underpriced"
Immutable zkEVM uses EIP-1559 pricing with minimum 10 gwei priority fee:
// Get current fee data with gaming-optimized settings
const feeData = await provider.getFeeData();
const tx = {
to: recipient,
value: amount,
maxFeePerGas: feeData.maxFeePerGas,
maxPriorityFeePerGas: Math.max(
feeData.maxPriorityFeePerGas,
10000000000n // 10 gwei minimum
),
gasLimit: 21000n
};
Error: "Rate limit exceeded"
Implement exponential backoff for resilient applications:
async function callWithRetry(fn, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (error) {
if (error.code === 429 && i < maxRetries - 1) {
await new Promise(r => setTimeout(r, 2 ** i * 1000));
} else {
throw error;
}
}
}
}
Migration Guide
From Ethereum Mainnet
Moving from L1 to Immutable zkEVM requires minimal changes:
// Before (Ethereum)
const provider = new JsonRpcProvider('https://eth-rpc.example.com');
// After (Immutable zkEVM)
const provider = new JsonRpcProvider(
'https://api-immutable-zkevm-mainnet.n.dwellir.com/YOUR_API_KEY'
);
// ✅ Smart contracts work identically
// ✅ Same tooling and libraries
// ⚠️ Different chain ID (13371)
// ⚠️ Separate block numbers
// ⚠️ IMX used for gas fees
// ⚠️ Minimum 10 gwei priority fee
From Other Gaming Chains
Migrating gaming applications to Immutable zkEVM:
// Enhanced gaming features available
const gameContract = new Contract(address, abi, provider);
// Optimized for high-frequency gaming transactions
const batchTx = await gameContract.batchMint(
playerAddresses,
tokenIds,
{ gasLimit: 500000 } // Gaming-optimized gas limits
);
Resources & Tools
Official Resources
Developer Tools
Gaming Ecosystem
- Gods Unchained - Leading TCG on Immutable
- Guild of Guardians - Mobile RPG
- Illuvium - Open-world RPG
Need Help?
- 📧 Email: support@dwellir.com
- 📚 Docs: You're here!
- 🎯 Dashboard: dashboard.dwellir.com
Start building games on Immutable zkEVM with Dwellir's enterprise-grade RPC infrastructure. Get your API key →