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.
Block space on BNB Smart Chain is finite. Every transaction competes for it inside a block whose total gas is capped, and the fee a user pays comes down to where that transaction lands in the competition. Miss the block-level mechanics and your dApp will intermittently emit transactions that stall in the mempool, get dropped, or cost far more BNB than necessary once blocks fill during busy PancakeSwap or Venus periods. Get it right and the payoff is concrete: contract calls confirm within a block or two, users pay close to the minimum viable fee, and your backend sizes and prices transactions deliberately rather than guessing. The sections below break down the BSC block gas limit, how fees compose, and the levers that keep costs low and inclusion fast.
gasUsed nears gasLimit, nothing more fits, so a single oversized call can crowd out others, and your own transaction has to respect the same ceiling.baseFeePerGas that the protocol adjusts to how full the previous block ran, and senders add a priority tip (maxPriorityFeePerGas) on top, bounded by maxFeePerGas, to buy prompt inclusion.eth_estimateGas for the gas units a transaction needs, sample baseFeePerGas from recent blocks the way the helper below does, or query eth_gasPrice. Estimation deliberately overshoots to dodge out-of-gas reverts, so you typically trade a little headroom for reliability.baseFeePerGas from the last several blocks, add a tip sized to your urgency, and recompute before each send. That way you ride the current market rather than a stale hardcoded price.gasUsed runs well under the limit, often outside major-market trading hours. Push non-urgent jobs like reward harvesting into those quieter blocks and you shave the base fee.eth_estimateGas result plus a modest buffer. Set it too low and the transaction reverts out of gas, wasting the fee; set it too high and you tie up funds and may overpay. Calibrate against the actual call.maxFeePerGas with a generous tip. For routine, latency-tolerant transactions, keep a tighter cap near the prevailing base fee to minimize spend.