Base
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.
Base
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
A chain reorganization, or reorg, happens when the block your application saw as the head of Base gets replaced by a different block at the same height, so the canonical history is rewritten and some transactions you thought were included move, change order, or vanish. On Base this is far less common than on a proof-of-work chain because a single Coinbase-operated sequencer orders transactions, so there is normally no competing fork at the L2 head — most reorgs you encounter are shallow, affecting only the most recent block or two, and stem from propagation timing or the L1 derivation pipeline rather than miners racing. Rare as they are, they are not impossible, and if your app credits a balance, fires a webhook, or updates a database the moment it sees a transaction, a reorg can leave your off-chain state describing a chain that no longer exists. That is why any backend or dApp reading the Base head must detect reorgs and recover from them rather than assume the head is permanent.
parentHash of a new block does not match the hash of the block you last processed, when the block at a known height returns a different hash than before, or when a transaction receipt's blockNumber changes or becomes null. The monitorReorgs and findCommonAncestor helpers below build on exactly these signals.parentHash to the last hash you stored, as in monitorReorgs; in a subscription system, check parentHash continuity on every newHeads event. Either way, on a mismatch use findCommonAncestor to locate where the old and new chains diverge.newHeads subscription for prompt detection at Base's ~2s cadence, since it pushes each new head immediately; fall back to polling for backfill and as a safety net when the WebSocket connection drops. Combining both gives low latency plus resilience against missed events.