-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·40 lines (35 loc) · 1.29 KB
/
install.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
#!/bin/bash
function getOperatorKeystorePath {
network=${1}
path="./config/${network}/keystores"
mkdir -p ${path}
echo "${path}/operator.icx"
}
function getOperatorKeystorePassword {
network=${1}
echo $(cat ./config/${network}/keystores/operator.password.txt)
}
function generateOperatorKeystore {
network=${1}
echo -e "\n===[${network}]===================================="
keystore=$(getOperatorKeystorePath ${network})
password=$(< /dev/urandom tr -dc A-Z-a-z-0-9_.+*/= | head -c32)
echo -ne "${password}" > ./config/${network}/keystores/operator.password.txt
# Check if file exists
if [ -f "$keystore" ]; then
echo "Operator wallet is already generated for ${network}."
else
echo "Generating operator keystore for ${network} ..."
tbears keystore -p $(getOperatorKeystorePassword ${network}) ${keystore}
echo "New address generated :"
tbears keyinfo -p $(getOperatorKeystorePassword ${network}) ${keystore}
fi
echo -e "===[/${network}]====================================\n"
}
# Generate keystores
# localhost should be pre-generated
# generateOperatorKeystore "localhost"
generateOperatorKeystore "yeouido"
# Euljiro shouldn't be needed
#generateOperatorKeystore "euljiro"
generateOperatorKeystore "mainnet"