forked from celo-org/celo-monorepo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_geth.sh
46 lines (40 loc) · 1.33 KB
/
start_geth.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -euo pipefail
# TODO(ashishb): testing only
ls /usr/local/bin
# Usage: start_geth.sh [geth binary location] [network name] [sync mode] [data_dir_path] [genesis_filepath] [static_nodes_filepath]
# Delete this
GETH_BINARY=${1:-"/usr/local/bin/geth"}
# Default to testing the alfajores network
NETWORK_NAME=${2:-"alfajores"}
# Default to testing the ultralight sync mode
SYNCMODE=${3:-"ultralight"}
# Default to 44787
NETWORK_ID=${4:-"44787"}
DATA_DIR=${5:-"/tmp/tmp1"}
GENESIS_FILE_PATH=${6:-"/celo/genesis.json"}
STATIC_NODES_FILE_PATH=${7:-"/celo/static-nodes.json"}
echo "This will start geth local node from ${GETH_BINARY} in '${SYNCMODE}' sync mode which will connect to network '${NETWORK_NAME}'..."
echo "Setting constants..."
mkdir -p ${DATA_DIR}
echo "Initializing data dir..."
${GETH_BINARY} --datadir ${DATA_DIR} init ${GENESIS_FILE_PATH}
echo "Initializing static nodes..."
cp ${STATIC_NODES_FILE_PATH} ${DATA_DIR}/static-nodes.json
echo "Running geth..."
${GETH_BINARY} \
--datadir ${DATA_DIR} \
--syncmode ${SYNCMODE} \
--rpc \
--ws \
--wsport=8546 \
--wsorigins=* \
--rpcapi=eth,net,web3,debug,admin,personal \
--debug \
--port=30303 \
--rpcport=8545 \
--rpcvhosts=* \
--networkid=${NETWORK_ID} \
--verbosity=5 \
--consoleoutput=stdout \
--consoleformat=term