Base
¿Listo para usar esto en producción?
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Base
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Gas on Base is paid in ETH, and although fees here are a small fraction of Ethereum mainnet thanks to the OP Stack rollup design, block-level gas mechanics still decide whether your transactions land promptly and what they cost. The per-block gas limit caps how much work fits in each ~2s block; the EIP-1559 base fee moves with demand; and a transaction that underprices its fee can stall while one that overprices it wastes ETH. Understanding these at the block level is what makes a Base app reliable under load. Get gas management right and you give users transactions that confirm quickly and predictably, while keeping your own costs — and theirs — as low as the L2 allows.
block.gasLimit as in the helper below. The sum of gas used by all transactions in a block cannot exceed it, so any single transaction must request less than the limit, and during busy periods only so much work fits per ~2s block — the rest waits for the next.baseFeePerGas (burned, algorithmically adjusted up or down based on how full the previous block was) plus a priority fee (tip) you add to incentivize quick inclusion. You set maxFeePerGas (the ceiling you will pay) and maxPriorityFeePerGas (the tip); you are charged the base fee plus your tip, never more than the max.eth_estimateGas gives the gas units a call needs; reading recent blocks' baseFeePerGas (as getOptimalGasPrice does) informs the fee. The trade-off is freshness versus cost — sampling more historical blocks smooths spikes but adds latency, while estimating from only the latest block reacts fast but can misprice during a sudden surge. Always add a buffer above the estimate to absorb the next block's base-fee change.baseFeePerGas before each send and set maxFeePerGas to roughly twice the base fee plus your tip, so the transaction survives a base-fee increase in the next ~2s block without you overpaying when demand is calm. Recompute per transaction rather than hardcoding a value.https://basescan.org or via RPC and queue deferrable work for the troughs.eth_estimateGas plus a modest safety margin. Too low and the transaction reverts out-of-gas, wasting the fee; too high wastes nothing directly (unused gas is refunded) but can crowd your nonce planning — aim for accurate estimates with a small buffer.maxFeePerGas and a healthy tip to win inclusion in the next block; for routine or background transactions on Base, a conservative maxFeePerGas near the current base fee with a minimal tip saves ETH at the cost of possibly waiting a few more blocks.