-
Notifications
You must be signed in to change notification settings - Fork 24
/
geth.sh
56 lines (49 loc) · 1.46 KB
/
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
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
# FIXME: Cannot use set -e since bash is not installed in Dockerfile
# set -e
RETRIES=${RETRIES:-40}
VERBOSITY=${VERBOSITY:-6}
# get the genesis file from the deployer
curl \
--fail \
--show-error \
--silent \
--retry-connrefused \
--retry-all-errors \
--retry $RETRIES \
--retry-delay 5 \
$ROLLUP_STATE_DUMP_PATH \
-o genesis.json
# wait for the dtl to be up, else geth will crash if it cannot connect
curl \
--fail \
--show-error \
--silent \
--output /dev/null \
--retry-connrefused \
--retry $RETRIES \
--retry-delay 1 \
$ROLLUP_CLIENT_HTTP
# import the key that will be used to locally sign blocks
# this key does not have to be kept secret in order to be secure
# we use an insecure password ("pwd") to lock/unlock the password
echo "Importing private key"
echo $BLOCK_SIGNER_KEY > key.prv
echo "pwd" > password
geth account import --datadir $DATADIR --password ./password ./key.prv
echo $FP_OPERATOR_PRIVATE_KEY > key.prv
geth account import --datadir $DATADIR --password ./password ./key.prv
# initialize the geth node with the genesis file
echo "Initializing Geth node"
geth --verbosity="$VERBOSITY" "$@" init genesis.json --datadir $DATADIR
# start the geth node
echo "Starting Geth node"
exec geth \
--verbosity="$VERBOSITY" \
--datadir $DATADIR \
--password ./password \
--allow-insecure-unlock \
--unlock $BLOCK_SIGNER_ADDRESS \
--mine \
--miner.etherbase $BLOCK_SIGNER_ADDRESS \
"$@"