2022-06-27 08:34:12 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
BASEDIR="$(dirname "${BASH_SOURCE[0]}")"
|
|
|
|
|
|
|
|
. "${BASEDIR}/nimbus_el_vars.sh"
|
|
|
|
|
|
|
|
#These are used in the caller script
|
|
|
|
NIMBUSEL_ENODES=()
|
|
|
|
NIMBUSEL_HTTP_PORTS=()
|
|
|
|
NIMBUSEL_NET_PORTS=()
|
|
|
|
NIMBUSEL_WS_PORTS=()
|
|
|
|
NIMBUSEL_RPC_PORTS=()
|
|
|
|
NIMBUSEL_DATA_DIRS=()
|
|
|
|
|
|
|
|
log "Using ${NIMBUSEL_BINARY}"
|
|
|
|
|
|
|
|
for NUM_NODE in $(seq 0 $(( NIMBUSEL_NUM_NODES - 1 ))); do
|
2022-07-23 14:28:10 +00:00
|
|
|
NIMBUSEL_NET_PORT=$(( NUM_NODE * NIMBUSEL_PORT_OFFSET + NIMBUSEL_BASE_NET_PORT ))
|
|
|
|
NIMBUSEL_HTTP_PORT=$(( NUM_NODE * NIMBUSEL_PORT_OFFSET + NIMBUSEL_BASE_HTTP_PORT ))
|
|
|
|
NIMBUSEL_WS_PORT=$(( NUM_NODE * NIMBUSEL_PORT_OFFSET + NIMBUSEL_BASE_WS_PORT ))
|
|
|
|
NIMBUSEL_AUTH_RPC_PORT=$(( NUM_NODE * NIMBUSEL_PORT_OFFSET + NIMBUSEL_BASE_AUTH_RPC_PORT ))
|
2022-06-27 08:34:12 +00:00
|
|
|
log "Starting nimbus EL node ${NUM_NODE} on net port ${NIMBUSEL_NET_PORT} HTTP port ${NIMBUSEL_HTTP_PORT} WS port ${NIMBUSEL_WS_PORT}"
|
|
|
|
NIMBUSEL_DATADIR=$(mktemp -d nimbusel-data-XXX)
|
|
|
|
NIMBUSEL_DATA_DIRS+=("${NIMBUSEL_DATADIR}")
|
2022-06-28 11:33:49 +00:00
|
|
|
${NIMBUSEL_BINARY} --data-dir="${NIMBUSEL_DATADIR}" --custom-network="${NIMBUSEL_GENESIS}" "${NIMBUSEL_DISCOVERY}" \
|
|
|
|
--tcp-port="${NIMBUSEL_NET_PORT}" --engine-api --engine-api-port="${NIMBUSEL_AUTH_RPC_PORT}" \
|
|
|
|
--rpc --rpc-port="${NIMBUSEL_HTTP_PORT}" &> "${DATA_DIR}/nimbusel_log${NUM_NODE}.txt" &
|
2022-06-27 08:34:12 +00:00
|
|
|
sleep 5
|
|
|
|
NODE_ID=$(
|
|
|
|
"${CURL_BINARY}" -sS -X POST \
|
|
|
|
-H 'Content-Type: application/json' \
|
|
|
|
-d '{"jsonrpc":"2.0","id":"id","method":"net_nodeInfo"}' \
|
|
|
|
"http://localhost:${NIMBUSEL_HTTP_PORT}" | "${JQ_BINARY}" .result.enode)
|
|
|
|
log "EL Node ID" "${NODE_ID}"
|
|
|
|
NIMBUSEL_ENODES+=("${NODE_ID}")
|
|
|
|
NIMBUSEL_HTTP_PORTS+=("${NIMBUSEL_HTTP_PORT}")
|
|
|
|
NIMBUSEL_NET_PORTS+=("${NIMBUSEL_NET_PORT}")
|
|
|
|
NIMBUSEL_WS_PORTS+=("${NIMBUSEL_WS_PORT}")
|
|
|
|
NIMBUSEL_RPC_PORTS+=("${NIMBUSEL_AUTH_RPC_PORT}")
|
|
|
|
done
|
|
|
|
|
|
|
|
for enode in "${NIMBUSEL_ENODES[@]}"
|
|
|
|
do
|
|
|
|
for port in "${NIMBUSEL_HTTP_PORTS[@]}"
|
|
|
|
do
|
|
|
|
"${CURL_BINARY}" -sS -X POST \
|
|
|
|
-H 'Content-Type: application/json' \
|
|
|
|
-d '{"jsonrpc":"2.0","id":"1","method":"nimbus_addPeer","params": ['"${enode}"']}' \
|
|
|
|
"http://localhost:${port}"
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "NimbusEL HTTP Ports: ${NIMBUSEL_HTTP_PORTS[*]}"
|