Polygon
Pronto para usar isso em produção?
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Polygon
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
On Polygon PoS a transaction is included in a Bor block within about 2 seconds, but inclusion is not the same as finality — the tip of the chain can still be reorganized until a Heimdall checkpoint anchors it to Ethereum L1. Counting confirmations is how you bridge that gap: each additional block built on top of the one holding your transaction makes a reversal less likely, and a checkpoint makes it effectively impossible. This guide shows how to count confirmations against https://polygon.therpc.io/YOUR_API_KEY, choose thresholds that match the value at stake in MATIC, and wait for the right level of finality before you treat a transaction on chain 137 as done.
M − N confirmations — exactly what the getConfirmations example computes from eth_getTransaction and eth_getBlockNumber.null receipt or a changed blockNumber means it was orphaned. Roll back any state you derived from it, then either wait for it to be re-mined or resubmit it, deduping by transaction hash so you never apply the effect twice.https://polygon.therpc.io/YOUR_API_KEY or subscribing to new headers, surface the count to users, and alert if a transaction stops gaining confirmations — a sign it was dropped from the mempool or orphaned by a reorg.