Optimism Flashblocks
Optimism runs on the OP Stack (chain ID 10), the reference implementation for which Flashblocks' Rollup-Boost sidecar was built. Flashblocks are available on Optimism Mainnet and Optimism Sepolia (chain ID 11155420), served over the standard Optimism RPC interface so existing tooling reads preconfirmed state without modification.
Endpoints
| Transport | URL |
|---|---|
| HTTP | https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ |
| WebSocket | wss://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ |
The pending tag works over HTTP. Flashblocks subscriptions require the WebSocket endpoint.
Flashblocks-Aware Methods
| Method | Usage |
|---|---|
eth_getTransactionCount | Pass "pending" for a nonce that accounts for Flashblock transactions |
eth_getStorageAt | Pass "pending" for storage at preconfirmed state |
eth_getBalance | Pass "pending" for the balance at the latest Flashblock state |
eth_getBlockByNumber | Pass "pending" to retrieve the current Flashblock |
eth_getBlockReceipt | Pass "pending" to get receipts for all pre-confirmed transactions in the current Flashblock. |
eth_getBlockTransactionCountByNumber | Pass "pending" to get the count of pre-confirmed transactions in the current Flashblock. |
eth_estimateGas | Pass "pending" to estimate gas against preconfirmed state |
eth_call | Pass "pending" to execute against preconfirmed state |
eth_simulateV1 | Simulates against the latest preconfirmed state |
eth_getLogs | Pass "fromBlock": "pending" and "toBlock": "pending" to query logs from pre-confirmed transactions, updated every ~200ms. |
eth_getCode | Pass "pending" for contract code at preconfirmed state |
eth_subscribe | Opens a Flashblocks WebSocket subscription |
eth_unsubscribe | Cancels an active Flashblocks subscription |
Example
The example below reads the pending balance of the Optimism WETH contract 0x4200000000000000000000000000000000000006. Substitute any supported method and parameters; the "pending" tag is what selects Flashblock state.
bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0x4200000000000000000000000000000000000006", "pending"],
"id": "getblock.io"
}'example.js
javascriptconst axios = require('axios');
const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0',
method: 'eth_getBalance',
params: ['0x4200000000000000000000000000000000000006', 'pending'],
id: 'getblock.io'
}, {
headers: { 'Content-Type': 'application/json' }
});
console.log(response.data.result);example.py
pythonimport requests
response = requests.post(
'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'eth_getBalance',
'params': ['0x4200000000000000000000000000000000000006', 'pending'],
'id': 'getblock.io'
}
)
print(response.json())example.rs
rustuse reqwest::Client;
use serde_json::{json, Value};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let response = client
.post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
.header("Content-Type", "application/json")
.json(&json!({
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0x4200000000000000000000000000000000000006", "pending"],
"id": "getblock.io"
}))
.send()
.await?
.json::<Value>()
.await?;
println!("Result: {}", response["result"]);
Ok(())
}Response
json{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": "0x0de0b6b3a7640000"
}The result is the hex-encoded balance in wei at the latest Flashblock. The same request with the "latest" tag returns the value at the last sealed block.
Use Cases
- Trading Platforms: Surface preconfirmed order and swap results with sub-second latency.
- Prediction Markets: Reflect changes in market state as soon as transactions are preconfirmed.
- Wallets: Show instant transaction feedback and real-time balance updates before a block is sealed.
- Nonce Management: Use
eth_getTransactionCountwithpendingto avoid nonce collisions during rapid submission. - Preconfirmed Receipts: Poll
eth_getTransactionReceiptto confirm inclusion at Flashblock cadence.