Polygon - Ethereum Layer 2
Complete guide to Polygon PoS integration with Dwellir RPC. Learn how to build on Polygon, access JSON-RPC methods, and optimize your dApp performance.
Polygon RPC
With Dwellir, you get access to our global Polygon 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 Polygon?
Polygon is a leading Ethereum scaling solution, providing a framework for building and connecting Ethereum-compatible blockchain networks. Built with Proof of Stake consensus, Polygon offers:
Lightning Fast Performance
- 2 second block times - Fast transaction confirmations
- Up to 65,000 TPS - Massive throughput capacity
- $0.01 average transaction cost - 10,000x cheaper than Ethereum
Enterprise Security
- 100+ validators - Highly decentralized network
- $2B+ staked - Strong economic security
- Battle-tested since 2020 - Processing billions of transactions
Massive Ecosystem
- 50M+ unique addresses - One of the largest L2 user bases
- 7,000+ dApps - Comprehensive DeFi, Gaming, and NFT ecosystem
- Major integrations - Aave, Uniswap, OpenSea, Chainlink
Quick Start with Polygon
Connect to Polygon in seconds with Dwellir's optimized endpoints:
curl -sS -X POST https://api-polygon-mainnet-full.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-polygon-mainnet-full.n.dwellir.com/<API_Keys_Are_Not_Made_for_Bots>');const latest = await provider.getBlockNumber();console.log('block', latest);import requestsurl = 'https://api-polygon-mainnet-full.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-polygon-mainnet-full.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
Available Methods
Core JSON-RPC Methods
Essential methods for interacting with the Polygon network:
| Method | Description | Link |
|---|---|---|
eth_blockNumber | Get the latest block number | View docs |
eth_getBalance | Query MATIC/POL balance of an address | View docs |
eth_getBlockByNumber | Retrieve block details by number | View docs |
eth_call | Execute smart contract calls | View docs |
eth_getTransactionByHash | Get transaction details | View docs |
eth_getTransactionReceipt | Fetch transaction receipts | View docs |
eth_sendRawTransaction | Broadcast signed transactions | View docs |
eth_estimateGas | Estimate gas for transactions | View docs |
eth_gasPrice | Get current gas price | View docs |
eth_getLogs | Query event logs | View docs |
Debug & Trace Methods
Advanced methods for debugging and analyzing transactions:
| Method | Description | Link |
|---|---|---|
debug_traceTransaction | Detailed transaction execution trace | View docs |
debug_traceBlock | Trace all transactions in a block | View docs |
debug_traceBlockByNumber | Trace block by number | View docs |
Network Information
Chain Details
| Parameter | Mainnet | Testnet (Amoy) |
|---|---|---|
| Chain ID | 137 | 80002 |
| Currency | MATIC (transitioning to POL) | MATIC |
| Block Time | ~2 seconds | ~2 seconds |
| Block Gas Limit | 30M | 30M |
| RPC Endpoint | https://api-polygon-mainnet-full.n.dwellir.com | https://api-polygon-amoy.n.dwellir.com |
Important Addresses
| Contract | Address |
|---|---|
| WMATIC | 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270 |
| USDC | 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 |
| USDT | 0xc2132D05D31c914a87C6611C10748AEb04B58e8F |
| Multicall3 | 0xcA11bde05977b3631167028862bE2a173976CA11 |
Best Practices
1. Optimize Gas Usage
Polygon has low fees, but optimizing gas usage is still important:
// Use gas estimation for accurate pricing
const gasEstimate = await contract.estimateGas.transfer(to, amount);
const gasPrice = await provider.getGasPrice();
const txCost = gasEstimate * gasPrice;2. Handle Network Congestion
Monitor and adapt to network conditions:
// Implement dynamic gas pricing
const gasPrice = await provider.getGasPrice();
const adjustedGasPrice = gasPrice * 110n / 100n; // 10% buffer3. Leverage Polygon's Speed
Take advantage of fast block times for better UX:
// Quick confirmation monitoring
const tx = await wallet.sendTransaction(transaction);
const receipt = await tx.wait(1); // Usually confirms in 1 block (~2 seconds)Resources
- Official Polygon Documentation
- Polygon Network Explorer
- Polygon Developer Portal
- Get Your Dwellir API Key
Support
Need help? Our team is available 24/7:
- Email: support@dwellir.com
- Documentation: You're already here!
Start building on Polygon with Dwellir's enterprise-grade infrastructure today.

