|
| 1 | +#!/bin/bash |
| 2 | +set -eu |
| 3 | + |
| 4 | +IPC_PATH="/data/reth.ipc" |
| 5 | +RETH_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 | +DISCOVERY_PORT="${DISCOVERY_PORT:-30303}" |
| 11 | +P2P_PORT="${P2P_PORT:-30303}" |
| 12 | +ADDITIONAL_ARGS="" |
| 13 | +NODE_TYPE="${NODE_TYPE:-base}" |
| 14 | + |
| 15 | +if [[ -z "${RETH_CHAIN:-}" ]]; then |
| 16 | + echo "expected RETH_CHAIN to be set" 1>&2 |
| 17 | + exit 1 |
| 18 | +fi |
| 19 | + |
| 20 | +# Add Flashblocks support for base mode |
| 21 | +if [[ "$NODE_TYPE" == "base" && -n "${RETH_FB_WEBSOCKET_URL:-}" ]]; then |
| 22 | + ADDITIONAL_ARGS="--websocket-url=$RETH_FB_WEBSOCKET_URL" |
| 23 | + echo "Enabling Flashblocks support with endpoint: $RETH_FB_WEBSOCKET_URL" |
| 24 | +fi |
| 25 | + |
| 26 | +# Add pruning for base |
| 27 | +if [[ "$NODE_TYPE" == "base" && "${RETH_PRUNING_ARGS+x}" = x ]]; then |
| 28 | + echo "Adding pruning arguments: $RETH_PRUNING_ARGS" |
| 29 | + ADDITIONAL_ARGS="$ADDITIONAL_ARGS $RETH_PRUNING_ARGS" |
| 30 | +fi |
| 31 | + |
| 32 | +mkdir -p "$RETH_DATA_DIR" |
| 33 | +echo "$OP_NODE_L2_ENGINE_AUTH_RAW" > "$OP_NODE_L2_ENGINE_AUTH" |
| 34 | + |
| 35 | +exec ./base-reth-node node \ |
| 36 | + -vvv \ |
| 37 | + --datadir="$RETH_DATA_DIR" \ |
| 38 | + --log.stdout.format json \ |
| 39 | + --ws \ |
| 40 | + --ws.origins="*" \ |
| 41 | + --ws.addr=0.0.0.0 \ |
| 42 | + --ws.port="$WS_PORT" \ |
| 43 | + --ws.api=web3,debug,eth,net,txpool \ |
| 44 | + --http \ |
| 45 | + --http.corsdomain="*" \ |
| 46 | + --http.addr=0.0.0.0 \ |
| 47 | + --http.port="$RPC_PORT" \ |
| 48 | + --http.api=web3,debug,eth,net,txpool,miner \ |
| 49 | + --ipcpath="$IPC_PATH" \ |
| 50 | + --authrpc.addr=0.0.0.0 \ |
| 51 | + --authrpc.port="$AUTHRPC_PORT" \ |
| 52 | + --authrpc.jwtsecret="$OP_NODE_L2_ENGINE_AUTH" \ |
| 53 | + --metrics=0.0.0.0:"$METRICS_PORT" \ |
| 54 | + --max-outbound-peers=100 \ |
| 55 | + --chain "$RETH_CHAIN" \ |
| 56 | + --rollup.sequencer-http="$RETH_SEQUENCER_HTTP" \ |
| 57 | + --rollup.disable-tx-pool-gossip \ |
| 58 | + --discovery.port="$DISCOVERY_PORT" \ |
| 59 | + --port="$P2P_PORT" \ |
| 60 | + $ADDITIONAL_ARGS |
0 commit comments