Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ To run the node using a supported client, you can use the following command:
`CLIENT=supported_client docker compose up --build`

Supported clients:
- reth (with Flashblocks support option, see [Reth Node README](./reth/README.md))
- reth (runs vanilla node by default, Flashblocks mode enabled by providing RETH_FB_WEBSOCKET_URL, see [Reth Node README](./reth/README.md))
- geth
- nethermind

Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ services:
command: ["bash", "./execution-entrypoint"]
volumes:
- ${HOST_DATA_DIR}:/data
environment:
- NODE_TYPE=${NODE_TYPE:-vanilla}
env_file:
- ${NETWORK_ENV:-.env.mainnet} # Use .env.mainnet by default, override with .env.sepolia for testnet
node:
Expand Down
19 changes: 2 additions & 17 deletions reth/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,6 @@ RUN . /tmp/versions.env && git clone $OP_NODE_REPO --branch $OP_NODE_TAG --singl
RUN . /tmp/versions.env && cd op-node && \
make VERSION=$OP_NODE_TAG op-node

FROM rust:1.88 AS reth

WORKDIR /app

COPY versions.env /tmp/versions.env

RUN apt-get update && apt-get -y upgrade && apt-get install -y git libclang-dev pkg-config curl build-essential

RUN . /tmp/versions.env && git clone $OP_RETH_REPO --branch $OP_RETH_TAG --single-branch . && \
git switch -c branch-$OP_RETH_TAG && \
bash -c '[ "$(git rev-parse HEAD)" = "$OP_RETH_COMMIT" ]'

RUN cargo build --bin op-reth --profile maxperf --manifest-path crates/optimism/bin/Cargo.toml

FROM rust:1.88 AS reth-base

WORKDIR /app
Expand All @@ -41,7 +27,7 @@ RUN . /tmp/versions.env && git clone $BASE_RETH_NODE_REPO . && \
git checkout tags/$BASE_RETH_NODE_TAG && \
bash -c '[ "$(git rev-parse HEAD)" = "$BASE_RETH_NODE_COMMIT" ]' || (echo "Commit hash verification failed" && exit 1)

RUN cargo build --bin base-reth-node --release
RUN cargo build --bin base-reth-node --profile maxperf

FROM ubuntu:24.04

Expand All @@ -53,8 +39,7 @@ RUN mkdir -p /var/log/supervisor
WORKDIR /app

COPY --from=op /app/op-node/bin/op-node ./
COPY --from=reth /app/target/maxperf/op-reth ./
COPY --from=reth-base /app/target/release/base-reth-node ./
COPY --from=reth-base /app/target/maxperf/base-reth-node ./
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY ./reth/reth-entrypoint ./execution-entrypoint
COPY op-node-entrypoint .
Expand Down
19 changes: 8 additions & 11 deletions reth/README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
# Running a Reth Node

This is a unified implementation of the Reth node setup that supports running both OP Reth and Base Reth with Flashblocks support.
This is an implementation of the Reth node setup that supports Flashblocks mode based on configuration.

## Setup

- See hardware requirements mentioned in the master README
- For Base Reth mode: Access to a Flashblocks websocket endpoint (for `RETH_FB_WEBSOCKET_URL`)
- For Flashblocks mode: Access to a Flashblocks websocket endpoint (for `RETH_FB_WEBSOCKET_URL`)
- We provide public websocket endpoints for mainnet and devnet, included in `.env.mainnet` and `.env.sepolia`

## Node Type Selection

Use the `NODE_TYPE` environment variable to select the implementation:
The node determines its mode based on the presence of the `RETH_FB_WEBSOCKET_URL` environment variable:

- `NODE_TYPE=vanilla` - OP Reth implementation (default)
- `NODE_TYPE=base` - Base L2 Reth implementation with Flashblocks support
- **Vanilla Mode** (default): When no `RETH_FB_WEBSOCKET_URL` is provided.
- **Flashblocks Mode**: When `RETH_FB_WEBSOCKET_URL` is provided.

## Running the Node

The node follows the standard `docker-compose` workflow in the master README.

```bash
# Run OP Reth node
# To run Reth node with Flashblocks support, set RETH_FB_WEBSOCKET_URL in your .env file
CLIENT=reth docker-compose up

# Run Base L2 Reth node with Flashblocks support
NODE_TYPE=base CLIENT=reth docker-compose up
```

## Testing Flashblocks RPC Methods

When running in Base mode (`NODE_TYPE=base`), you can query a pending block using the Flashblocks RPC:
When running in Flashblocks mode (with `RETH_FB_WEBSOCKET_URL` configured), you can query a pending block using the Flashblocks RPC:

```bash
curl -X POST \
Expand All @@ -42,4 +39,4 @@ curl -X POST \
For a complete list of supported RPC methods, refer to:

- [Standard Ethereum JSON-RPC](https://ethereum.org/en/developers/docs/apis/json-rpc/)
- [Flashblocks RPC Methods](https://docs.base.org/chain/flashblocks#rpc-api) (Base mode only)
- [Flashblocks RPC Methods](https://docs.base.org/chain/flashblocks#rpc-api) (Flashblocks mode only)
17 changes: 5 additions & 12 deletions reth/reth-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,23 @@ METRICS_PORT="${METRICS_PORT:-6060}"
DISCOVERY_PORT="${DISCOVERY_PORT:-30303}"
P2P_PORT="${P2P_PORT:-30303}"
ADDITIONAL_ARGS=""
NODE_TYPE="${NODE_TYPE:-base}"
BINARY="./base-reth-node"

if [[ -z "${RETH_CHAIN:-}" ]]; then
echo "expected RETH_CHAIN to be set" 1>&2
exit 1
fi

# Add Flashblocks support for base mode
if [[ "$NODE_TYPE" == "base" && -n "${RETH_FB_WEBSOCKET_URL:-}" ]]; then
# Enable Flashblocks support if websocket URL is provided
if [[ -n "${RETH_FB_WEBSOCKET_URL:-}" ]]; then
ADDITIONAL_ARGS="--websocket-url=$RETH_FB_WEBSOCKET_URL"
echo "Enabling Flashblocks support with endpoint: $RETH_FB_WEBSOCKET_URL"
fi

# Select binary based on NODE_TYPE
if [[ "$NODE_TYPE" == "base" ]]; then
echo "Starting Base Reth node"
BINARY="./base-reth-node"
else
echo "Starting OP Reth node"
BINARY="./op-reth"
echo "Running in vanilla node mode (no Flashblocks URL provided)"
fi

# Add pruning for base
if [[ "$NODE_TYPE" == "base" && "${RETH_PRUNING_ARGS+x}" = x ]]; then
if [[ "${RETH_PRUNING_ARGS+x}" = x ]]; then
echo "Adding pruning arguments: $RETH_PRUNING_ARGS"
ADDITIONAL_ARGS="$ADDITIONAL_ARGS $RETH_PRUNING_ARGS"
fi
Expand Down
Loading