Skip to content

Node provider docs for flashblocks #2263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Flashblocks
slug: /flashblocks
slug: /flashblocks/apps
description: Experience lightning-fast transaction confirmations on Base by using Flashblocks. Preconfirmations happen in just 200 milliseconds—designed for real-time apps, games, and seamless UX.
---

Expand All @@ -14,9 +14,87 @@ Flashblocks enable up to 200 millisecond transaction confirmations on Base by le

Flashblocks is enabled for developers on Base Sepolia with full support for mainnet coming very soon. There are two ways you can integrate with Flashblocks data. You can either use the WebSocket API to stream real-time block updates, or use the RPC API to query the Flashblocks-aware RPC endpoint.

### RPC API
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think app devs use RPC more so I moved it to the top


You can utilize our Flashblock aware RPC endpoint at `https://sepolia-preconf.base.org`.

In addition to these flashblock-specific methods, all standard Ethereum JSON-RPC methods are 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
}
```

### WebSocket API

Use our API to stream realtime block updates over a WebSocket.
You can also use our WebSocket API to stream realtime flashblocks updates.

You can connect to the websocket endpoint with any WebSocket library of CLI tool. The endpoint is available at wss://sepolia.flashblocks.base.org/ws.

Expand Down Expand Up @@ -114,83 +192,7 @@ To minimize the amount of data sent to clients, each Flashblock only includes th
}
```

### RPC API

You can also utilize our Flashblock aware RPC endpoint at `https://sepolia-preconf.base.org`.

In addition to these flashblock-specific methods, all standard Ethereum JSON-RPC methods are 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
}
```

## Support

Expand Down
51 changes: 51 additions & 0 deletions apps/base-docs/docs/pages/chain/flashblocks/node-providers.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: Flashblocks
slug: /flashblocks/node-providers
description: Experience lightning-fast transaction confirmations on Base by using Flashblocks. Preconfirmations happen in just 200 milliseconds—designed for real-time apps, games, and seamless UX.
---

# How to host Flashblocks-aware RPC nodes

## Quick Start

1. **Prerequisites**:

- Docker and Docker Compose
- Minimum hardware requirements (see [node README](https://github.com/base/node?tab=readme-ov-file#hardware-requirements))
- Access to a Flashblocks websocket endpoint, we provide public endpoints in the env files in the repo

2. **Set Up Environment**:

```bash
# Clone the repository
git clone https://github.com/base/node.git
cd node
```

3. **Start the Node with Flashblocks Support**:
```bash
NODE_TYPE=base CLIENT=reth docker-compose up
```

## Configuration Options

- **Node Type**: Use `NODE_TYPE=base` to enable base reth node withFlashblocks functionality
- **Network**: Use `NETWORK_ENV=.env.mainnet` for mainnet or `NETWORK_ENV=.env.sepolia` for testnet

## Verifying Flashblocks Functionality

Test that your node is properly supporting Flashblocks by querying a pending block:

```bash
curl -X POST \
--data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["pending", false],"id":1}' \
http://localhost:8545
```

## Available RPC Methods

Flashblocks-aware nodes provide all standard Ethereum JSON-RPC methods plus specialized Flashblocks endpoints. For more details, see the [Flashblocks RPC API documentation](https://docs.base.org/chain/flashblocks/apps#rpc-api).

## Further Resources

For detailed information about node setup, including hardware requirements and additional configuration options, refer to the [Reth node README](https://github.com/base/op-geth/blob/main/node/reth/README.md).
6 changes: 5 additions & 1 deletion apps/base-docs/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,11 @@ export const sidebar: Sidebar = [
},
{
text: 'Flashblocks ↗',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can drop the arrow since it isn't going offsite (so just Flashblocks with no arrow after)

Sorry, this was an artifact from when I added the page, but we should remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

link: '/chain/flashblocks',
collapsed: true,
items: [
{ text: 'Apps', link: '/chain/flashblocks/apps' },
{ text: 'Node Providers', link: '/chain/flashblocks/node-providers' },
],
},
{
text: 'Base Contracts',
Expand Down