Flashblocks API Quickstart

Get started building on Unichain using Flashblocks

Introduction

Flashblocks on Unichain enable ultra-fast transaction confirmations by providing preconfirmations - instant signals that arrive before the next block is finalized. Instead of waiting up to 2 seconds for block confirmation, users receive transaction feedback in just 200 milliseconds, a 10x improvement.

Built as an “out-of-protocol” extension, Flashblocks work by streaming partial block updates every 200ms without modifying Unichain’s core consensus. This makes them perfect for developers building DeFi applications, marketplaces, payment systems, and other applications where instant confirmations create seamless user experiences.

Getting started instructions

Flashblocks is currently supported on both Unichain testnet and mainnet and can be accessed using your existing Alchemy Unichain RPC.

NetworkFlashblocks Availability
Unichain Sepolia
Unichain Mainnet

Flashblocks-enabled API Endpoints

eth_getBlockByNumber

Use the pending tag to retrieve the latest Flashblock:

$curl https://unichain-sepolia.g.alchemy.com/v2/<YOUR_API_KEY> -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://unichain-sepolia.g.alchemy.com/v2/<YOUR_API_KEY> -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://unichain-sepolia.g.alchemy.com/v2/<YOUR_API_KEY> -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://unichain-sepolia.g.alchemy.com/v2/<YOUR_API_KEY> -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://unichain-sepolia.g.alchemy.com/v2/<YOUR_API_KEY> -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://unichain-sepolia.g.alchemy.com/v2/<YOUR_API_KEY> -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://unichain-sepolia.g.alchemy.com/v2/<YOUR_API_KEY> -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://unichain-sepolia.g.alchemy.com/v2/<YOUR_API_KEY> -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://unichain-sepolia.g.alchemy.com/v2/<YOUR_API_KEY> -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
> }
> ]
>}

Also check out the Official Unichain Flashblocks Docs!