DEV Community

OnFinality
OnFinality

Posted on Originally published at onfinality.io

Polygon Amoy RPC Endpoint: Chain Settings & Debugging

Quick Reference: Polygon Amoy Endpoint and Chain Settings

If you're building on Polygon Amoy, the testnet for Polygon's PoS network, you need the correct RPC endpoint and chain configuration to connect your wallet, deploy contracts, or run automated tests. Here's the essential information at a glance:

Setting Value
Network Name Amoy
Chain ID 80002
Native Currency POL (18 decimals)
Block Explorer https://amoy.polygonscan.com
Public RPC Endpoint https://polygon-amoy.api.onfinality.io/public

This public endpoint is free to use for development and testing. For production-grade testnet workloads, consider a dedicated node or a higher-tier RPC service to avoid rate limits and ensure reliability. OnFinality provides RPC services for Polygon Amoy and many other networks, with flexible pricing options.

Decision Guide: Choosing the Right Amoy RPC Access

Before you start coding, decide how you'll access the Amoy RPC. Your choice depends on your workload and reliability needs:

  • Quick prototyping or one-off scripts: Use the public endpoint. It's free and sufficient for occasional requests.
  • Active development with frequent calls: A shared RPC service with higher rate limits is better. Public endpoints can throttle or fail under load.
  • Automated CI/CD or load testing: Consider a dedicated node to ensure consistent performance and avoid IP-based rate limiting.
  • Production dApp that uses testnet for staging: A managed RPC service with SLAs and failover is recommended.

For most developers, starting with the public endpoint is fine, but if you hit rate limits or need WebSocket support, upgrade to a managed service. OnFinality offers both shared and dedicated options, and you can compare plans on our RPC pricing page.

What Is Polygon Amoy and Why Use It?

Polygon Amoy is the official testnet for Polygon PoS, replacing the older Mumbai testnet. It allows developers to test smart contracts and dApps in an environment that mirrors mainnet without spending real funds. Key features:

  • Chain ID 80002 – distinct from mainnet (137) to prevent transaction replay.
  • POL token – the native gas token, obtained from a faucet.
  • PolygonScan Amoy – block explorer for verifying transactions and contracts.

Using a testnet is essential for development because it lets you iterate quickly, debug failures, and simulate user interactions without financial risk. Amoy is also used by infrastructure providers to test new features before mainnet deployment.

Configuring Your Wallet or dApp

To connect a wallet like MetaMask or a dApp using ethers.js or viem, you need to add the Amoy network. Here's how to configure it manually in MetaMask:

  1. Open MetaMask and click the network dropdown.
  2. Click "Add Network" and fill in the details:
    • Network Name: Amoy
    • New RPC URL: https://polygon-amoy.api.onfinality.io/public
    • Chain ID: 80002
    • Currency Symbol: POL
    • Block Explorer URL: https://amoy.polygonscan.com
  3. Save and switch to the Amoy network.

For programmatic access, here's an example using ethers.js:

import { ethers } from "ethers";

const provider = new ethers.JsonRpcProvider("https://polygon-amoy.api.onfinality.io/public");
const network = await provider.getNetwork();
console.log("Chain ID:", network.chainId); // 80002
Enter fullscreen mode Exit fullscreen mode

And with viem:

import { createPublicClient, http } from 'viem';

const client = createPublicClient({
  chain: {
    id: 80002,
    name: 'Amoy',
    nativeCurrency: { name: 'POL', symbol: 'POL', decimals: 18 },
    rpcUrls: { default: { http: ['https://polygon-amoy.api.onfinality.io/public'] } },
  },
  transport: http()
});

const blockNumber = await client.getBlockNumber();
console.log("Block number:", blockNumber);
Enter fullscreen mode Exit fullscreen mode

Getting Test POL from the Faucet

To pay for gas on Amoy, you need test POL. The official faucet is available at faucet.polygon.technology. You'll need to connect a wallet and request tokens. Some community faucets also exist, but always verify their legitimacy.

If you're automating tests, you can request POL programmatically, but be mindful of rate limits. For CI/CD, consider pre-funding a wallet and using a private key in your test environment.

Common RPC Errors and How to Fix Them

When working with Amoy RPC, you may encounter errors. Here's a quick troubleshooting table:

Error Likely Cause Solution
network does not support Wrong chain ID in your config Ensure chain ID is 80002
nonce too low Transaction nonce mismatch Reset your account nonce or use eth_getTransactionCount
insufficient funds No POL for gas Get test POL from the faucet
rate limit exceeded Too many requests to public endpoint Use a managed RPC service or dedicated node
connection refused Network issue or endpoint down Check your internet, try again, or use an alternative endpoint

For nonce issues, you can query the pending nonce:

curl -X POST https://polygon-amoy.api.onfinality.io/public \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0xYourAddress","pending"],"id":1}'
Enter fullscreen mode Exit fullscreen mode

Public vs. Shared vs. Dedicated RPC for Amoy

Choosing the right RPC access model is crucial for your development workflow. Here's a comparison:

Access Type Pros Cons Best For
Public Endpoint Free, easy to start Rate limits, no SLA, may be slow Prototyping, small scripts
Shared RPC Service Higher limits, better reliability, WebSocket support Costs money, shared resources Active development, dApp staging
Dedicated Node Full control, clear rate limits, consistent performance More expensive, requires management High-volume testing, production-like staging

OnFinality offers both shared and dedicated options. Our RPC pricing page details the plans, and you can see all supported networks on our networks page.

Debugging with WebSocket and JSON-RPC

For real-time applications, you might need WebSocket support. The public endpoint above is HTTP-only, but OnFinality provides WebSocket endpoints for dedicated nodes. To test WebSocket connectivity, you can use a simple script:

const WebSocket = require('ws');
const ws = new WebSocket('wss://polygon-amoy.api.onfinality.io/public');

ws.on('open', () => {
  ws.send(JSON.stringify({jsonrpc: '2.0', method: 'eth_subscribe', params: ['newHeads'], id: 1}));
});

ws.on('message', (data) => {
  console.log('Received:', data.toString());
});
Enter fullscreen mode Exit fullscreen mode

Note: The public endpoint may not support WebSocket; check your provider's documentation. For production, use a dedicated node with WebSocket support.

Key Takeaways

  • Polygon Amoy is the testnet for Polygon PoS with chain ID 80002 and POL as gas token.
  • The public RPC endpoint is https://polygon-amoy.api.onfinality.io/public.
  • Configure your wallet or dApp with the correct chain settings to avoid errors.
  • Get test POL from the official faucet to pay for transactions.
  • For reliable, high-volume access, consider a managed RPC service or dedicated node from OnFinality.
  • Always test on Amoy before deploying to Polygon mainnet.

Frequently Asked Questions

What is the Polygon Amoy RPC endpoint?

The public RPC endpoint is https://polygon-amoy.api.onfinality.io/public. You can also use other providers, but this one is free and reliable for development.

How do I add Amoy to MetaMask?

Go to Settings > Networks > Add Network and enter the chain details: RPC URL, chain ID 80002, symbol POL, and explorer URL.

Where can I get test POL?

Use the official Polygon faucet at faucet.polygon.technology. Connect your wallet and request tokens.

Can I use WebSocket with Amoy?

The public endpoint may not support WebSocket. For WebSocket, you'll need a dedicated node or a provider that offers it. OnFinality's dedicated nodes support WebSocket.

What is the difference between Amoy and Mumbai?

Mumbai is deprecated. Amoy is the current testnet with a different chain ID (80002 vs 80001) and uses POL instead of MATIC.

Is the public endpoint rate-limited?

Yes, public endpoints typically have rate limits to prevent abuse. For heavy usage, consider a paid RPC service.

How do I check if my RPC connection works?

Use a simple curl command to call eth_chainId and verify the response is 0x13882 (80002 in hex).

Related resources

Originally published at OnFinality.

Top comments (0)