├── .gitignore ├── regen_config.sh ├── ethereum ├── .env ├── .env.mainnet └── docker-compose.yml ├── create_dirs.sh ├── optimism ├── .env └── docker-compose.yml ├── readme.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .config 2 | datadirs -------------------------------------------------------------------------------- /regen_config.sh: -------------------------------------------------------------------------------- 1 | mkdir -p .config 2 | openssl rand -hex 32 > ethereum/.config/l1-jwt-secret.txt 3 | openssl rand -hex 32 > optimism/.config/l2-jwt-secret.txt -------------------------------------------------------------------------------- /ethereum/.env: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME=node-ops-goerli 2 | NETWORK=goerli 3 | CHECKPOINT_SYNC_URL=https://goerli.checkpoint-sync.ethdevops.io 4 | GETH_TAG=latest 5 | LIGHTHOUSE_TAG=latest-modern -------------------------------------------------------------------------------- /ethereum/.env.mainnet: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME=node-ops-mainnet 2 | NETWORK=mainnet 3 | CHECKPOINT_SYNC_URL=https://beaconstate-mainnet.chainsafe.io 4 | GETH_TAG=latest 5 | LIGHTHOUSE_TAG=latest-modern -------------------------------------------------------------------------------- /create_dirs.sh: -------------------------------------------------------------------------------- 1 | mkdir -p ethereum/datadirs/goerli/geth 2 | mkdir -p ethereum/datadirs/goerli/lighthouse 3 | mkdir -p ethereum/datadirs/mainnet/geth 4 | mkdir -p ethereum/datadirs/mainnet/lighthouse 5 | mkdir -p optimism/datadirs/goerli/geth -------------------------------------------------------------------------------- /optimism/.env: -------------------------------------------------------------------------------- 1 | COMPOSE_PROJECT_NAME=node-ops-op-goerli 2 | NETWORK=goerli 3 | # Set to archive to support arbitrarily large reorgs 4 | GCMODE=archive 5 | GETH_TAG=v1.11.2-13ee9ab 6 | OP_NODE_TAG=v1.0.0 7 | L1_RPC_URL=http://host.docker.internal:8545 -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Node Ops 2 | 3 | ## Initial Setup 4 | 5 | Run `base regen_config.sh` and `bash create_dirs.sh` to initialize the JWT token & to create the datadirs. 6 | 7 | 8 | ## Running 9 | 10 | This uses docker compose with env files (one per network) to run a local node for Ethereum or for Optimism. 11 | `docker compose up -d` spins the network up in the background. `docker compose up` spins it up in the foreground. 12 | `docker compose down` spins in down. Don't force kill the network or you may corrupt geth. 13 | 14 | It maintains a different folder for Ethereum & Optimism. Both an Ethereum node & an Optimism node may run at the 15 | same time, but for each, you can only run on a single network (mainnet/goerli/future testnet). 16 | 17 | 18 | | Network | Folder | Command | 19 | | ----------------- | -------- | ------- | 20 | | Ethereum Mainnet | ethereum | `docker compose --env-file=.env.mainnet` | 21 | | Ethereum Goerli | ethereum | `docker compose` | 22 | | Optimism Goerli | optimism | `docker compose` | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Joshua Gutow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ethereum/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.9" 2 | 3 | services: 4 | geth: 5 | image: ethereum/client-go:${GETH_TAG} 6 | stop_grace_period: 8m 7 | container_name: geth-${NETWORK} 8 | volumes: 9 | - type: bind 10 | source: ${PWD}/datadirs/${NETWORK}/geth 11 | target: /data 12 | - ${PWD}/.config/l1-jwt-secret.txt:/config/jwt-secret.txt 13 | ports: 14 | - 30303:30303/tcp 15 | - 30303:30303/udp 16 | - 8545:8545 17 | - 8546:8546 18 | command: > 19 | --${NETWORK} 20 | --datadir=/data 21 | --ipcdisable 22 | --http 23 | --http.addr=0.0.0.0 24 | --ws 25 | --ws.addr=0.0.0.0 26 | --authrpc.jwtsecret=/config/jwt-secret.txt 27 | --authrpc.addr=0.0.0.0 28 | --authrpc.vhosts=* 29 | lighthouse: 30 | depends_on: 31 | - geth 32 | image: sigp/lighthouse:${LIGHTHOUSE_TAG} 33 | container_name: lighthouse-${NETWORK} 34 | volumes: 35 | - type: bind 36 | source: ${PWD}/datadirs/${NETWORK}/lighthouse 37 | target: /data 38 | - ${PWD}/.config/l1-jwt-secret.txt:/config/jwt-secret.txt 39 | ports: 40 | - 9000:9000 41 | - 443:443 42 | command: > 43 | lighthouse bn 44 | --network=${NETWORK} 45 | --datadir=/data 46 | --execution-endpoint=http://geth:8551 47 | --execution-jwt=/config/jwt-secret.txt 48 | --disable-deposit-contract-sync 49 | --checkpoint-sync-url=${CHECKPOINT_SYNC_URL} -------------------------------------------------------------------------------- /optimism/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.9" 2 | 3 | services: 4 | geth: 5 | image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:${GETH_TAG} 6 | stop_grace_period: 8m 7 | container_name: op-geth-${NETWORK} 8 | volumes: 9 | - type: bind 10 | source: ${PWD}/datadirs/${NETWORK}/geth 11 | target: /data 12 | - ${PWD}/.config/l2-jwt-secret.txt:/config/jwt-secret.txt 13 | ports: 14 | # - 30303:30303/tcp 15 | # - 30303:30303/udp 16 | - 9545:8545 17 | command: > 18 | --gcmode=${GCMODE} 19 | --datadir=/data 20 | --ipcdisable 21 | --http 22 | --http.addr=0.0.0.0 23 | --authrpc.jwtsecret=/config/jwt-secret.txt 24 | --authrpc.addr=0.0.0.0 25 | --authrpc.vhosts=* 26 | --authrpc.port=8551 27 | --nodiscover 28 | op-node: 29 | depends_on: 30 | - geth 31 | image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:${OP_NODE_TAG} 32 | container_name: op-node-${NETWORK} 33 | volumes: 34 | - ${PWD}/.config/l2-jwt-secret.txt:/config/jwt-secret.txt 35 | command: > 36 | op-node 37 | --network=${NETWORK} 38 | --l1=${L1_RPC_URL} 39 | --l1.rpckind=alchemy 40 | --l1.trustrpc=true 41 | --l2=http://geth:8551 42 | --l2.jwt-secret=/config/jwt-secret.txt 43 | --verifier.l1-confs=0 44 | --rpc.addr=0.0.0.0 45 | --rpc.port=7545 46 | --p2p.listen.ip=0.0.0.0 47 | --p2p.listen.tcp=9003 48 | --p2p.listen.udp=9003 49 | ports: 50 | - "7545:7545" 51 | - "9003:9003" --------------------------------------------------------------------------------