New to Flashblocks? Start with the Flashblocks Overview to understand the architecture and how transactions flow through the system.
Integration Methods
There are two ways to integrate with Flashblocks:
RPC API — Query Flashblocks-aware endpoints using familiar JSON-RPC methods with the pending tag
WebSocket API — Stream real-time Flashblock data for lowest latency (see Node Providers )
For most apps, the RPC API is recommended. WebSocket is best for traders and infrastructure providers who need the absolute lowest latency.
Frontend developers using eth_subscribe : With Flashblocks, subscriptions emit events every 200ms instead of every 2 seconds. If your UI performs heavy rendering on each event, consider throttling or debouncing updates to avoid jitter.
RPC API
Base offers the following public Flashblocks aware RPC endpoints. These are rate limited and may not be suitable for production use - we recommend using a node provider that runs Flashblocks integrated nodes.
Major node providers such as Alchemy, Infura, QuickNode and dRPC have Flashblocks-aware RPCs that can be leveraged
The following RPC methods can return Flashblocks specific data. All standard Ethereum JSON-RPC methods are still supported as usual.
eth_getBlockByNumber
Use the pending tag to retrieve the latest Flashblock:
curl https://sepolia-preconf.base.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["pending",true],"id":1}'
Example Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"number": "0x1234",
"hash": "0x...",
"transactions": [...]
}
}
eth_getTransactionReceipt
Use the existing receipt RPC to get preconfirmed receipts:
curl https://sepolia-preconf.base.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0x..."],"id":1}'
Example Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"transactionHash": "0x...",
"blockNumber": "0x1234",
"status": "0x1"
}
}
eth_getBalance
Use the pending tag to get the address balance in the latest Flashblock:
curl https://sepolia-preconf.base.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x...","pending"],"id":1}'
Example Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0234"
}
eth_getTransactionCount
Use the pending tag to get the address nonce in the latest Flashblock:
curl https://sepolia-preconf.base.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0x...","pending"],"id":1}'
Example Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x1b" // 27 transactions
}
eth_getTransactionByHash
Use the existing get transaction by hash RPC to get preconfirmed transactions:
curl https://sepolia-preconf.base.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x..."],"id":1}'
Example Response
{
"type": "0x2",
"chainId": "...",
"nonce": "...",
...
}
eth_call
Use the pending tag to execute a smart contract call against the latest Flashblock:
curl https://sepolia-preconf.base.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_call","params":[{"to":"0x...","data":"0x..."},"pending"],"id":1}'
Example Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0000000000000000000000000000000000000000000000000000000000000001"
}
eth_simulateV1
Use the pending tag to simulate transactions against the latest Flashblock:
curl https://sepolia-preconf.base.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_simulateV1","params":[{"blockStateCalls":[{"calls":[{"to":"0x...","data":"0x..."}],"stateOverrides":{}}],"traceTransfers":true,"validation":true},"pending"],"id":1}'
Example Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"calls": [
{
"status": "0x1",
"gasUsed": "0x5208",
"returnData": "0x"
}
]
}
]
}
eth_estimateGas
Use the pending tag to estimate gas against the latest Flashblock:
curl https://sepolia-preconf.base.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"to":"0x...","data":"0x..."},"pending"],"id":1}'
Example Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x5208"
}
eth_getLogs
Use the pending tag for toBlock to retrieve logs from the latest Flashblock:
curl https://sepolia-preconf.base.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlock":"latest","toBlock":"pending","address":"0x...","topics":["0x..."]}],"id":1}'
Example Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0x...",
"topics": ["0x..."],
"data": "0x...",
"blockNumber": "0x1234",
"transactionHash": "0x...",
"transactionIndex": "0x0",
"blockHash": "0x...",
"logIndex": "0x0",
"removed": false
}
]
}
Libraries
You will need to use a Flashblocks-aware RPC endpoint to use Flashblocks with the following libraries:
To use Flashblocks with Wagmi, you will need to use the basePreconf chain in the Wagmi Config (see config.ts).
Example.tsx
App.tsx
config.ts
import { useSendTransaction , useWaitForTransactionReceipt } from "wagmi" ;
function SendTransaction () {
const { data : hash , sendTransaction } = useSendTransaction ();
const { data : receipt } = useWaitForTransactionReceipt ({ hash });
return (
< div >
< button
onClick = { () => sendTransaction ({
to: "0x..." ,
value: parseEther ( '0.0001' ),
}) }
>
Send Transaction
</ button >
{ hash && < div > Hash: { hash } </ div > }
{ receipt && < div > Included on block number: { receipt . blockNumber } </ div > }
</ div >
)
}
import { createWalletClient , http , parseEther , publicActions } from "viem" ;
import { privateKeyToAccount } from "viem/accounts" ;
import { baseSepoliaPreconf } from "viem/chains" ;
// Create client with the Flashblocks-aware chain.
const account = privateKeyToAccount ( `0x ${ process . env . PRIVATE_KEY } ` );
const client = createWalletClient ({
account ,
chain: baseSepoliaPreconf ,
transport: http (),
})
. extend ( publicActions );
const submissionTime = new Date ();
console . log ( `Submitting transaction at: ${ submissionTime . toISOString () } ` );
// Send transaction.
const hash = await client . sendTransaction ({
to: "0x..." ,
value: parseEther ( '0.0001' ),
});
console . log ( `Transaction hash: ${ hash } ` );
// Wait for transaction to be included.
const receipt = await client . waitForTransactionReceipt ({ hash });
const confirmTime = new Date ();
console . log ( `Transaction included at: ${ confirmTime . toISOString () } ` );
console . log ( `Time difference: ${ confirmTime - submissionTime } ms` );
You should see the confirmation time significantly lower than the standard RPC endpoint.
Support
For feedback, support or questions about Flashblocks, please don’t hesitate to contact us in the #developer-chat channel in the Base Discord .