Skip to content

Commit 23d31cf

Browse files
Add Sepolia Node Network Docker
1 parent c92483a commit 23d31cf

10 files changed

+15554
-1
lines changed

.env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GETH_HOST_DATA_DIR=./geth-data

.env.sepolia

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
OP_GETH_GENESIS_FILE_PATH=sepolia/genesis.json
2+
# OP_GETH_SEQUENCER_HTTP=https://sepolia-sequencer.zentachain.io
3+
4+
# Replace with your preferred L1 Ethereum, node RPC URL like from Alchemy, Infura:
5+
#OP_NODE_L1_ETH_RPC=https://rpc.sepolia.org
6+
7+
# [required] replace with your preferred L1 CL beacon endpoint:
8+
# OP_NODE_L1_BEACON=https://your.sepolia.beacon.node/endpoint-here
9+
10+
# auth secret used by op-geth engine API:
11+
OP_NODE_L2_ENGINE_AUTH_RAW=f2b9b439e9be7d2bf79e3dedd10f562354966e2a48fbdb6cab33b62db56827eb
12+
13+
OP_NODE_BETA_EXTRA_NETWORKS=true
14+
OP_NODE_L2_ENGINE_AUTH=/tmp/engine-auth-jwt
15+
OP_NODE_L2_ENGINE_RPC=ws://geth:8551
16+
OP_NODE_LOG_LEVEL=info
17+
OP_NODE_METRICS_ADDR=0.0.0.0
18+
OP_NODE_METRICS_ENABLED=true
19+
OP_NODE_METRICS_PORT=7300
20+
OP_NODE_P2P_LISTEN_IP=0.0.0.0
21+
OP_NODE_P2P_LISTEN_TCP_PORT=9222
22+
OP_NODE_P2P_LISTEN_UDP_PORT=9222
23+
OP_NODE_ROLLUP_CONFIG=sepolia/rollup.json
24+
OP_NODE_RPC_ADDR=0.0.0.0
25+
OP_NODE_RPC_PORT=8545
26+
OP_NODE_SNAPSHOT_LOG=/tmp/op-node-snapshot-log
27+
OP_NODE_VERIFIER_L1_CONFS=4
28+
OP_NODE_ROLLUP_LOAD_PROTOCOL_VERSIONS=true
29+
GETH_HOST_DATA_DIR=./geth-data

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
.trunk
2-
.env
2+
/.idea/
3+
/geth-data/
4+
jwt

Dockerfile

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM golang:1.21 as op
2+
3+
WORKDIR /app
4+
5+
ENV REPO=https://github.com/ethereum-optimism/optimism.git
6+
ENV VERSION=v1.5.0
7+
# for verification:
8+
ENV COMMIT=6de6b5fc81d8ee03bb776219ba25189a04712f99
9+
10+
RUN git clone $REPO --branch op-node/$VERSION --single-branch . && \
11+
git switch -c branch-$VERSION && \
12+
bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]'
13+
14+
RUN cd op-node && \
15+
make op-node
16+
17+
FROM golang:1.21 as geth
18+
19+
WORKDIR /app
20+
21+
ENV REPO=https://github.com/ethereum-optimism/op-geth.git
22+
ENV VERSION=v1.101305.3
23+
# for verification:
24+
ENV COMMIT=ea3c3044010f97fb3d9affa0dd3c0c2beea85882
25+
26+
# avoid depth=1, so the geth build can read tags
27+
RUN git clone $REPO --branch $VERSION --single-branch . && \
28+
git switch -c branch-$VERSION && \
29+
bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]'
30+
31+
RUN go run build/ci.go install -static ./cmd/geth
32+
33+
FROM golang:1.21
34+
35+
RUN apt-get update && \
36+
apt-get install -y jq curl supervisor && \
37+
rm -rf /var/lib/apt/lists
38+
RUN mkdir -p /var/log/supervisor
39+
40+
WORKDIR /app
41+
42+
COPY --from=op /app/op-node/bin/op-node ./
43+
COPY --from=geth /app/build/bin/geth ./
44+
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
45+
COPY geth-entrypoint .
46+
COPY op-node-entrypoint .
47+
COPY sepolia ./sepolia
48+
49+
CMD ["/usr/bin/supervisord"]

docker-compose.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: "3.8"
2+
3+
services:
4+
#Geth
5+
geth:
6+
build: .
7+
ports:
8+
- 8545:8545
9+
- 8546:8546
10+
- 30303:30303
11+
- 30303:30303/udp
12+
- 7301:6060
13+
command: ["bash", "./geth-entrypoint"]
14+
volumes:
15+
- ${GETH_HOST_DATA_DIR}:/data
16+
env_file:
17+
# select env network:
18+
- .env.sepolia
19+
# Node
20+
node:
21+
build: .
22+
depends_on:
23+
- geth
24+
ports:
25+
- 7545:8545
26+
- 9222:9222
27+
- 9222:9222/udp
28+
- 7300:7300
29+
- 6060:6060
30+
command: ["bash", "./op-node-entrypoint"]
31+
env_file:
32+
# select network:
33+
- .env.sepolia

geth-entrypoint

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
VERBOSITY=${GETH_VERBOSITY:-3}
5+
GETH_DATA_DIR=/data
6+
RPC_PORT="${RPC_PORT:-8545}"
7+
WS_PORT="${WS_PORT:-8546}"
8+
AUTHRPC_PORT="${AUTHRPC_PORT:-8551}"
9+
METRICS_PORT="${METRICS_PORT:-6060}"
10+
HOST_IP="0.0.0.0"
11+
P2P_PORT="${P2P_PORT:-30303}"
12+
ADDITIONAL_ARGS=""
13+
OP_GETH_GCMODE="${OP_GETH_GCMODE:-archive}"
14+
15+
# if [[ -z "$OP_NODE_NETWORK" ]]; then
16+
# echo "expected OP_NODE_NETWORK to be set" 1>&2
17+
# exit 1
18+
# fi
19+
20+
mkdir -p $GETH_DATA_DIR
21+
22+
# echo "$OP_NODE_L2_ENGINE_AUTH_RAW" > "$OP_NODE_L2_ENGINE_AUTH"
23+
24+
if [ "${OP_GETH_ETH_STATS+x}" = x ]; then
25+
ADDITIONAL_ARGS="$ADDITIONAL_ARGS --ethstats=$OP_GETH_ETH_STATS"
26+
fi
27+
28+
if [ "${OP_GETH_ALLOW_UNPROTECTED_TXS+x}" = x ]; then
29+
ADDITIONAL_ARGS="$ADDITIONAL_ARGS --rpc.allow-unprotected-txs=$OP_GETH_ALLOW_UNPROTECTED_TXS"
30+
fi
31+
32+
if [ "${OP_GETH_STATE_SCHEME+x}" = x ]; then
33+
ADDITIONAL_ARGS="$ADDITIONAL_ARGS --state.scheme=$OP_GETH_STATE_SCHEME"
34+
fi
35+
36+
exec ./geth \
37+
--datadir="$GETH_DATA_DIR" \
38+
--verbosity="$VERBOSITY" \
39+
--http \
40+
--http.corsdomain="*" \
41+
--http.vhosts="*" \
42+
--http.addr=0.0.0.0 \
43+
--http.port="$RPC_PORT" \
44+
--http.api=web3,debug,eth,net,engine \
45+
--authrpc.addr=0.0.0.0 \
46+
--authrpc.port="$AUTHRPC_PORT" \
47+
--authrpc.vhosts="*" \
48+
--authrpc.jwtsecret="$OP_NODE_L2_ENGINE_AUTH" \
49+
--ws \
50+
--ws.addr=0.0.0.0 \
51+
--ws.port="$WS_PORT" \
52+
--ws.origins="*" \
53+
--ws.api=debug,eth,net,engine \
54+
--metrics \
55+
--metrics.addr=0.0.0.0 \
56+
--metrics.port="$METRICS_PORT" \
57+
--syncmode=full \
58+
--gcmode="$OP_GETH_GCMODE" \
59+
--nodiscover \
60+
--maxpeers=100 \
61+
--nat=extip:$HOST_IP \
62+
# --rollup.sequencerhttp="$OP_GETH_SEQUENCER_HTTP" \
63+
--rollup.halt=major \
64+
# --op-network="$OP_NODE_NETWORK" \
65+
--port="$P2P_PORT" \
66+
$ADDITIONAL_ARGS # intentionally unquoted

op-node-entrypoint

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
# if [[ -z "$OP_NODE_NETWORK" ]]; then
5+
# echo "expected OP_NODE_NETWORK to be set" 1>&2
6+
# exit 1
7+
# fi
8+
9+
# wait until local geth comes up (authed so will return 401 without token)
10+
until [ "$(curl -s -w '%{http_code}' -o /dev/null "${OP_NODE_L2_ENGINE_RPC/ws/http}")" -eq 401 ]; do
11+
echo "waiting for geth to be ready"
12+
sleep 5
13+
done
14+
15+
# public-facing P2P node, advertise public IP address
16+
PUBLIC_IP=$(curl -s v4.ident.me)
17+
export OP_NODE_P2P_ADVERTISE_IP=$PUBLIC_IP
18+
19+
echo "$OP_NODE_L2_ENGINE_AUTH_RAW" > "$OP_NODE_L2_ENGINE_AUTH"
20+
21+
exec ./op-node

0 commit comments

Comments
 (0)