pending block tag.
- In production, point your app to a subblocks-aware RPC endpoint from your provider of choice. If your provider doesn’t support subblocks yet, let us know on Discord and we’ll work with them to get it added.
- To run your own subblocks-aware node, start
op-rethwith--flashblocks-url=<websocket-url>pointing at the chain’s stream. The node then servespendingfrom the subblock state. OP Mainnet and OP Sepolia stream URLs are listed on the network information page.
This guide covers reading pre-confirmed state through an RPC endpoint, which is what most apps want.
If you consume the WebSocket stream directly instead, four payload fields are zeroed and need handling — see the Subblocks notice.
Supported RPC methods
You read subblock state with the same Ethereum JSON-RPC calls you already use. The difference is using the “pending” tag in some of them to explicitly query the pre-confirmed state instead of the last finalized block.-
eth_getBlockByNumber: Use thependingtag to retrieve the latest subblock snapshot. -
eth_call: Use thependingtag to execute calls against the most recent pre-confirmed state. -
eth_getBalance/eth_getTransactionCount: Use thependingtag to fetch balances or transaction counts respectively as they evolve within the block window. Other methods, likeeth_getTransactionReceipt,eth_getTransactionByHashoreth_simulateV1, return data from pre-confirmed transactions without requiring thependingtag. Consult the Flashblocks specification for more details on each of these methods.
Libraries
You need a subblocks‑aware RPC endpoint to use the following libraries:Viem
Ethers
Next steps
- Understand how subblocks affect gas usage and large transactions.
- Learn how subblocks work in the Subblocks explainer.
- Review the technical specs for architecture details.
- Join our community to share best practices and get support!