-
Notifications
You must be signed in to change notification settings - Fork 2
/
clef-start.sh
executable file
·43 lines (34 loc) · 1.04 KB
/
clef-start.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
#!/usr/bin/env bash
# Goerli chainid = 5
# Kotti chainid = 6
source ./clef-config.sh
source ./clef-setup.sh
echo Using Clef environment:
env | grep CLEF_
if [[ ! -d "$CLEF_CONFIG_DIR" ]]; then
init_clef
fi
chainid="$1"
[[ -z "$chainid" ]] && { echo "Please provide a chain id as ARG1."; exit 1; }
echo "Using chain id: $chainid"
# https://unix.stackexchange.com/a/132524/273201
any_available_port(){
python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'
}
port=$(any_available_port)
echo "Starting clef for chain id: $chainid ..."
echo "-> Will run HTTP JSON-RPC on port: $port"
# The --advanced flag disables case-sensitive checksum validation on To addresses.
# Clef will just issue a warning instead.
# https://github.com/ethereum/go-ethereum/issues/20214#issuecomment-547388965
clef \
--chainid $chainid \
--configdir "$CLEF_CONFIG_DIR" \
--keystore "$CLEF_KEYSTORE_DIR" \
--rules "$CLEF_RULES_FILE" \
--nousb \
--advanced \
--ipcdisable \
--rpc \
--rpcport $port \
--loglevel 5