BNB Smart Chain
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.
BNB Smart Chain
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
A chain reorganization, or reorg, is when the node you read from switches its view of the canonical chain: it discards one or more recently seen blocks and adopts a different sequence at the same heights. On BNB Smart Chain reorgs stay uncommon and nearly always shallow. PoSA hands each ~3s slot to a scheduled validator, and fast finality commits blocks within a couple of slots, so the only window where the tip can move is the brief one created by propagation timing. That window is small, but it is real. If your application credits a balance, emits a webhook, or mutates internal state the instant a block appears, a reorg can pin those actions to a block that no longer exists, and out come duplicated events, phantom balances, inconsistent records. Any backend or dApp that acts on recent BSC blocks has to handle reorgs.
parentHash does not match the block you last recorded as the tip. Either one means the canonical chain moved.monitorReorgs helper does. Subscription system: verify each new header's parentHash chains cleanly onto the previous one, and flag a reorg when it does not.findCommonAncestor, roll back each state change derived from the orphaned blocks, then replay your processing against the new canonical blocks above that ancestor.newBlockHeaders subscriptions give low-latency detection on live BSC traffic and are the default choice. Fall back to interval polling for batch indexers, or when a stable long-lived socket to the endpoint is impractical.