Skip to content

Commit d6794bb

Browse files
authored
Add setup for node-reth (#446)
1 parent c673c87 commit d6794bb

8 files changed

Lines changed: 94 additions & 6 deletions

File tree

.env.mainnet

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@ OP_NODE_ROLLUP_LOAD_PROTOCOL_VERSIONS=true
5252
# OP_GETH_BOOTNODES=enode://87a32fd13bd596b2ffca97020e31aef4ddcc1bbd4b95bb633d16c1329f654f34049ed240a36b449fda5e5225d70fe40bc667f53c304b71f8e68fc9d448690b51@3.231.138.188:30301,enode://ca21ea8f176adb2e229ce2d700830c844af0ea941a1d8152a9513b966fe525e809c3a6c73a2c18a12b74ed6ec4380edf91662778fe0b79f6a591236e49e176f9@184.72.129.189:30301,enode://acf4507a211ba7c1e52cdf4eef62cdc3c32e7c9c47998954f7ba024026f9a6b2150cd3f0b734d9c78e507ab70d59ba61dfe5c45e1078c7ad0775fb251d7735a2@3.220.145.177:30301,enode://8a5a5006159bf079d06a04e5eceab2a1ce6e0f721875b2a9c96905336219dbe14203d38f70f3754686a6324f786c2f9852d8c0dd3adac2d080f4db35efc678c5@3.231.11.52:30301,enode://cdadbe835308ad3557f9a1de8db411da1a260a98f8421d62da90e71da66e55e98aaa8e90aa7ce01b408a54e4bd2253d701218081ded3dbe5efbbc7b41d7cef79@54.198.153.150:30301
5353
# OP_NETHERMIND_BOOTNODES=enode://87a32fd13bd596b2ffca97020e31aef4ddcc1bbd4b95bb633d16c1329f654f34049ed240a36b449fda5e5225d70fe40bc667f53c304b71f8e68fc9d448690b51@3.231.138.188:30301,enode://ca21ea8f176adb2e229ce2d700830c844af0ea941a1d8152a9513b966fe525e809c3a6c73a2c18a12b74ed6ec4380edf91662778fe0b79f6a591236e49e176f9@184.72.129.189:30301,enode://acf4507a211ba7c1e52cdf4eef62cdc3c32e7c9c47998954f7ba024026f9a6b2150cd3f0b734d9c78e507ab70d59ba61dfe5c45e1078c7ad0775fb251d7735a2@3.220.145.177:30301,enode://8a5a5006159bf079d06a04e5eceab2a1ce6e0f721875b2a9c96905336219dbe14203d38f70f3754686a6324f786c2f9852d8c0dd3adac2d080f4db35efc678c5@3.231.11.52:30301,enode://cdadbe835308ad3557f9a1de8db411da1a260a98f8421d62da90e71da66e55e98aaa8e90aa7ce01b408a54e4bd2253d701218081ded3dbe5efbbc7b41d7cef79@54.198.153.150:30301
5454
# OP_GETH_SYNCMODE=snap
55+
56+
# For Flashblocks node
57+
# RETH_FB_WEBSOCKET_URL=wss://mainnet.flashblocks.base.org/ws

.env.sepolia

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,6 @@ OP_NODE_ROLLUP_LOAD_PROTOCOL_VERSIONS=true
4848
# OP_GETH_BOOTNODES=enode://548f715f3fc388a7c917ba644a2f16270f1ede48a5d88a4d14ea287cc916068363f3092e39936f1a3e7885198bef0e5af951f1d7b1041ce8ba4010917777e71f@18.210.176.114:30301,enode://6f10052847a966a725c9f4adf6716f9141155b99a0fb487fea3f51498f4c2a2cb8d534e680ee678f9447db85b93ff7c74562762c3714783a7233ac448603b25f@107.21.251.55:30301
4949
# OP_NETHERMIND_BOOTNODES=enode://548f715f3fc388a7c917ba644a2f16270f1ede48a5d88a4d14ea287cc916068363f3092e39936f1a3e7885198bef0e5af951f1d7b1041ce8ba4010917777e71f@18.210.176.114:30301,enode://6f10052847a966a725c9f4adf6716f9141155b99a0fb487fea3f51498f4c2a2cb8d534e680ee678f9447db85b93ff7c74562762c3714783a7233ac448603b25f@107.21.251.55:30301
5050
# OP_GETH_SYNCMODE=snap
51+
52+
# For Flashblocks node
53+
# RETH_FB_WEBSOCKET_URL=wss://sepolia.flashblocks.base.org/ws

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/geth-data/
33
/reth-data/
44
/nethermind-data/
5-
.DS_Store
5+
.DS_Store

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ docker compose up --build
7474
>
7575
> Supported clients:
7676
> - geth
77-
> - reth
77+
> - reth (with Flashblocks support option, see [Reth Node README](./reth/README.md))
7878
> - nethermind
7979
8080
4. You should now be able to `curl` your Base node:

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ services:
1212
command: [ "bash", "./execution-entrypoint" ]
1313
volumes:
1414
- ${HOST_DATA_DIR}:/data
15+
environment:
16+
- NODE_TYPE=${NODE_TYPE:-vanilla}
1517
env_file:
1618
- ${NETWORK_ENV:?.env.mainnet} # Requires NETWORK_ENV to be set, defaults to mainnet
1719
node:

reth/Dockerfile

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,31 @@ WORKDIR /app
2222
RUN apt-get update && apt-get -y upgrade && apt-get install -y git libclang-dev pkg-config curl build-essential
2323

2424
ENV REPO=https://github.com/paradigmxyz/reth.git
25-
ENV VERSION=v1.3.11
26-
ENV COMMIT=e0e85aa10b98fa92d32c3e820c7ed2cee0b02931
25+
ENV VERSION=v1.3.12
26+
ENV COMMIT=6f8e7258f4733279080e4bd8345ce50538a40d6e
2727
RUN git clone $REPO --branch $VERSION --single-branch . && \
2828
git switch -c branch-$VERSION && \
2929
bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]'
3030

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

33+
FROM rust:1.85 AS reth-base
34+
35+
WORKDIR /app
36+
37+
RUN apt-get update && apt-get -y upgrade && \
38+
apt-get install -y git libclang-dev pkg-config curl build-essential && \
39+
rm -rf /var/lib/apt/lists/*
40+
41+
ENV REPO=https://github.com/base/node-reth.git
42+
ENV VERSION=main
43+
ENV COMMIT=c23179dc3531a988e483b05d306539cca99f9a5c
44+
RUN git clone $REPO --branch $VERSION --single-branch . && \
45+
git switch -c branch-$VERSION && \
46+
bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]' || (echo "Commit hash verification failed" && exit 1)
47+
48+
RUN cargo build --bin base-reth-node --release
49+
3350
FROM ubuntu:22.04
3451

3552
RUN apt-get update && \
@@ -41,6 +58,7 @@ WORKDIR /app
4158

4259
COPY --from=op /app/op-node/bin/op-node ./
4360
COPY --from=reth /app/target/maxperf/op-reth ./
61+
COPY --from=reth-base /app/target/release/base-reth-node ./
4462
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
4563
COPY ./reth/reth-entrypoint ./execution-entrypoint
4664
COPY op-node-entrypoint .

reth/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Running a Reth Node
2+
3+
This is a unified implementation of the Reth node set up that supports running both standard Reth or Base Reth with Flashblocks support.
4+
5+
## Setup
6+
7+
- See hardware requirements mentioned in the master README
8+
- For Base Reth mode: Access to a Flashblocks websocket endpoint (for `RETH_FB_WEBSOCKET_URL`)
9+
- We provide public websocket endpoints for mainnet and devnet, included in `.env.mainnet` and `.env.sepolia`
10+
11+
## Node Type Selection
12+
13+
Use the `NODE_TYPE` environment variable to select the implementation:
14+
15+
- `NODE_TYPE=vanilla` - Standard Reth implementation (default)
16+
- `NODE_TYPE=base` - Base L2 Reth implementation with Flashblocks support
17+
18+
## Running the Node
19+
20+
The node follows the standard `docker-compose` workflow in the master README.
21+
22+
```bash
23+
# Run standard Reth node
24+
CLIENT=reth docker-compose up
25+
26+
# Run Base L2 Reth node with Flashblocks support
27+
NODE_TYPE=base CLIENT=reth docker-compose up
28+
```
29+
30+
## Testing Flashblocks RPC Methods
31+
32+
When running in Base mode (`NODE_TYPE=base`), you can query a pending block using the Flashblocks RPC:
33+
34+
```bash
35+
curl -X POST \
36+
--data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["pending", false],"id":1}' \
37+
http://localhost:8545
38+
```
39+
40+
## Additional RPC Methods
41+
42+
For a complete list of supported RPC methods, refer to:
43+
44+
- [Standard Ethereum JSON-RPC](https://ethereum.org/en/developers/docs/apis/json-rpc/)
45+
- [Flashblocks RPC Methods](https://docs.base.org/chain/flashblocks#rpc-api) (Base mode only)

reth/reth-entrypoint

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,32 @@ RPC_PORT="${RPC_PORT:-8545}"
66
WS_PORT="${WS_PORT:-8546}"
77
AUTHRPC_PORT="${AUTHRPC_PORT:-8551}"
88
METRICS_PORT="${METRICS_PORT:-6060}"
9+
ADDITIONAL_ARGS=""
910

1011
if [[ -z "$RETH_CHAIN" ]]; then
1112
echo "expected RETH_CHAIN to be set" 1>&2
1213
exit 1
1314
fi
1415

16+
# Add Flashblocks support for base mode
17+
if [[ "$NODE_TYPE" == "base" && -n "$RETH_FB_WEBSOCKET_URL" ]]; then
18+
ADDITIONAL_ARGS="--websocket-url=$RETH_FB_WEBSOCKET_URL"
19+
echo "Enabling Flashblocks support with endpoint: $RETH_FB_WEBSOCKET_URL"
20+
fi
21+
22+
# Select binary based on NODE_TYPE
23+
if [[ "$NODE_TYPE" == "base" ]]; then
24+
echo "Starting Base Reth node"
25+
BINARY="./base-reth-node"
26+
else
27+
echo "Starting vanilla Reth node"
28+
BINARY="./op-reth"
29+
fi
30+
1531
mkdir -p $RETH_DATA_DIR
1632
echo "$OP_NODE_L2_ENGINE_AUTH_RAW" > "$OP_NODE_L2_ENGINE_AUTH"
1733

18-
exec ./op-reth node \
34+
exec $BINARY node \
1935
-vvv \
2036
--datadir="$RETH_DATA_DIR" \
2137
--log.stdout.format log-fmt \
@@ -35,4 +51,5 @@ exec ./op-reth node \
3551
--metrics=0.0.0.0:"$METRICS_PORT" \
3652
--chain "$RETH_CHAIN" \
3753
--rollup.sequencer-http=$RETH_SEQUENCER_HTTP \
38-
--rollup.disable-tx-pool-gossip
54+
--rollup.disable-tx-pool-gossip \
55+
$ADDITIONAL_ARGS

0 commit comments

Comments
 (0)