Optimism
¿Listo para usar esto en producción?
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Optimism
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Blocks are the unit of progress on OP Mainnet: every transaction, balance change, and event is ordered inside a block, and on this OP Stack rollup (chain ID 10) a new one arrives roughly every two seconds. Reading blocks correctly is therefore the foundation of almost everything you build — tracking the head, confirming transactions, indexing Velodrome or Synthetix activity, or reacting to on-chain events. After this guide you will be able to retrieve OP Mainnet blocks by number or hash over JSON-RPC against https://optimism.therpc.io/YOUR_API_KEY, understand the fields a block carries, monitor new blocks as the sequencer produces them, count confirmations, and reason about when a block is final relative to Ethereum L1.
parentHash, timestamp, gasLimit, gasUsed, baseFeePerGas, and the list of transactions. Because it is an OP Stack chain, blocks also surface fields tied to L1 settlement; note that uncles is always an empty array since OP Mainnet has no ommer blocks.eth_blockNumber returns the current head, eth_getBlockByNumber and eth_getBlockByHash return a block, and a boolean flag chooses whether transactions come back as full objects or just hashes — exactly what the web3.eth.getBlock calls above wrap.newBlockHeaders subscription is the efficient way to keep up.https://optimism.therpc.io/YOUR_API_KEY and retry with exponential backoff. Treat a missing block at the head as "not produced yet, retry" rather than a hard error, since you may be querying microseconds ahead of the next ~2s block.parentHash links to the previous one and be ready to roll back if it does not. Wait for L1 finalization before treating high-value state as permanent.baseFeePerGas and gasUsed versus gasLimit to gauge congestion and price transactions well. Because OP Mainnet cost also includes an L1 data fee, tracking block-level gas signals helps you choose cheaper windows and avoid underpaying during demand spikes.