65 lines
1.5 KiB
Bash
65 lines
1.5 KiB
Bash
|
#!/usr/bin/env bash
|
||
|
# Via Adrian Sutton
|
||
|
|
||
|
if [ -z "$1" ]; then
|
||
|
echo "Usage: run-geth-el.sh <network-metadata-dir>"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
if [ ! -d "$1" ]; then
|
||
|
echo "Please supply a valid network metadata directory"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
set -Eeu
|
||
|
|
||
|
NETWORK=$(cd "$1"; pwd)
|
||
|
|
||
|
cd $(dirname "$0")
|
||
|
|
||
|
source geth_binaries.sh
|
||
|
source repo_paths.sh
|
||
|
|
||
|
download_geth_capella
|
||
|
|
||
|
: ${GETH_AUTH_RPC_PORT:=18550}
|
||
|
: ${GETH_WS_PORT:=18551}
|
||
|
|
||
|
DATA_DIR="$(create_data_dir_for_network "$NETWORK")"
|
||
|
|
||
|
JWT_TOKEN="$DATA_DIR/jwt-token"
|
||
|
create_jwt_token "$JWT_TOKEN"
|
||
|
|
||
|
NETWORK_ID=$(cat "$NETWORK/genesis.json" | jq '.config.chainId')
|
||
|
|
||
|
EXECUTION_BOOTNODES=""
|
||
|
if [[ -f "$NETWORK/el_bootnode.txt" ]]; then
|
||
|
EXECUTION_BOOTNODES+=$(awk '{print $1}' "$NETWORK/el_bootnode.txt" "$NETWORK/el_bootnode.txt" | paste -s -d, -)
|
||
|
fi
|
||
|
|
||
|
if [[ -f "$NETWORK/el_bootnodes.txt" ]]; then
|
||
|
EXECUTION_BOOTNODES+=$(awk '{print $1}' "$NETWORK/el_bootnodes.txt" "$NETWORK/el_bootnode.txt" | paste -s -d, -)
|
||
|
fi
|
||
|
|
||
|
GETH_DATA_DIR="$DATA_DIR/geth"
|
||
|
EXECUTION_GENESIS_JSON="${NETWORK}/genesis.json"
|
||
|
|
||
|
set -x
|
||
|
|
||
|
if [[ ! -d "$GETH_DATA_DIR/geth" ]]; then
|
||
|
# Initialize the genesis
|
||
|
$GETH_CAPELLA_BINARY --http --ws -http.api "engine" --datadir "${GETH_DATA_DIR}" init "${EXECUTION_GENESIS_JSON}"
|
||
|
fi
|
||
|
|
||
|
$GETH_CAPELLA_BINARY \
|
||
|
--authrpc.port ${GETH_AUTH_RPC_PORT} \
|
||
|
--authrpc.jwtsecret "$JWT_TOKEN" \
|
||
|
--allow-insecure-unlock \
|
||
|
--datadir "${GETH_DATA_DIR}" \
|
||
|
--bootnodes "${EXECUTION_BOOTNODES}" \
|
||
|
--port 30308 \
|
||
|
--password "" \
|
||
|
--metrics \
|
||
|
--syncmode=full \
|
||
|
--networkid $NETWORK_ID
|