Reference · Web3 with Go & Polygon

Polygon Amoy Cheat Sheet

Everything you retype every session, on one printable page.

Network facts

Chain id
80002 — if client.ChainID(ctx) prints anything else, you dialed the wrong network.
Primary RPC
https://rpc-amoy.polygon.technology/ (official public endpoint).
Backup RPCs
If the primary rate-limits you, pick another from the official endpoint list — public endpoints come and go, so the list is the source of truth. Errors and timeouts on a public RPC are usually rate-limiting, not your code: re-run first.
Block time
~2 seconds.
Explorer
amoy.polygonscan.com — paste any address, tx hash, or block number.
Gas token
Test POL (worthless, faucet-supplied).

Faucet field-craft

Go snippets you'll retype forever

connect + sanity-check

client, err := ethclient.Dial("https://rpc-amoy.polygon.technology/")
// client.ChainID(ctx)      -> *big.Int, must be 80002
// client.BlockNumber(ctx)  -> uint64, climbs every ~2s

read a balance (wei)

addr := common.HexToAddress("0x…")
wei, err := client.BalanceAt(ctx, addr, nil) // nil = latest block

big.Int survival rules

a.Cmp(b)   // -1 / 0 / 1 — the ONLY way to compare (== compares pointers)
a.Sign()   // -1 / 0 / 1 — quick zero-check
sum := new(big.Int).Add(a, b)   // results write into the receiver
// money math: integer wei only; big.Float ONLY to format for display

wei ↔ POL

1 POL  = 1_000_000_000_000_000_000 wei   (10^18)
0.01 POL = 10_000_000_000_000_000 wei    (10^16)
max int64 ≈ 9.22 POL in wei — hence *big.Int everywhere

See also

Course glossary · Ethereum Development with Go · ethclient GoDoc