Docs

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 key

Why 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:

Polygon RPC Endpoints
HTTPS
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:

MethodDescriptionLink
eth_blockNumberGet the latest block numberView docs
eth_getBalanceQuery MATIC/POL balance of an addressView docs
eth_getBlockByNumberRetrieve block details by numberView docs
eth_callExecute smart contract callsView docs
eth_getTransactionByHashGet transaction detailsView docs
eth_getTransactionReceiptFetch transaction receiptsView docs
eth_sendRawTransactionBroadcast signed transactionsView docs
eth_estimateGasEstimate gas for transactionsView docs
eth_gasPriceGet current gas priceView docs
eth_getLogsQuery event logsView docs

Debug & Trace Methods

Advanced methods for debugging and analyzing transactions:

MethodDescriptionLink
debug_traceTransactionDetailed transaction execution traceView docs
debug_traceBlockTrace all transactions in a blockView docs
debug_traceBlockByNumberTrace block by numberView docs

Network Information

Chain Details

ParameterMainnetTestnet (Amoy)
Chain ID13780002
CurrencyMATIC (transitioning to POL)MATIC
Block Time~2 seconds~2 seconds
Block Gas Limit30M30M
RPC Endpointhttps://api-polygon-mainnet-full.n.dwellir.comhttps://api-polygon-amoy.n.dwellir.com

Important Addresses

ContractAddress
WMATIC0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270
USDC0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
USDT0xc2132D05D31c914a87C6611C10748AEb04B58e8F
Multicall30xcA11bde05977b3631167028862bE2a173976CA11

Best Practices

1. Optimize Gas Usage

Polygon has low fees, but optimizing gas usage is still important:

JavaScript
// 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:

JavaScript
// Implement dynamic gas pricing
const gasPrice = await provider.getGasPrice();
const adjustedGasPrice = gasPrice * 110n / 100n; // 10% buffer

3. Leverage Polygon's Speed

Take advantage of fast block times for better UX:

JavaScript
// Quick confirmation monitoring
const tx = await wallet.sendTransaction(transaction);
const receipt = await tx.wait(1); // Usually confirms in 1 block (~2 seconds)

Resources

Support

Need help? Our team is available 24/7:

Start building on Polygon with Dwellir's enterprise-grade infrastructure today.