-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgenconfig.sh
More file actions
executable file
·64 lines (46 loc) · 1.28 KB
/
genconfig.sh
File metadata and controls
executable file
·64 lines (46 loc) · 1.28 KB
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
57
58
59
60
61
62
63
#!/bin/bash
set -x
config="chain.para.toml"
function genConfig() {
echo -e "start auto modify config"
peerArray=$1
num=$2
validatorNodes=""
seeds=""
for((i=0;i<$num;i++));
do
validatorNodes=${validatorNodes},\""${peerArray[$i]}:33001"\"
seeds=${seeds},"\"${peerArray[$i]}:13801\""
done
validatorNodes=$(echo $validatorNodes|sed '/^,/s///g')
seeds=$(echo $seeds|sed '/^,/s///g')
sed -i "s/^validatorNodes=.*/validatorNodes=[${validatorNodes}]/g" ${config}
sed -i "s/^seeds=.*/seeds=[${seeds}]/g" ${config}
for((i=0;i<$num;i++));
do
rm -rf ${peerArray[$i]}
mkdir -p ${peerArray[$i]}
cp ${config} ${peerArray[$i]}/${config}
done
}
function prepareChainPkg() {
echo -e "start prepare chain33 files"
peerArray=$1
num=$2
./chain-cli qbft gen_file -n $num -t bls
for((i=0;i<$num;i++));
do
cp priv_validator_$i.json ${peerArray[$i]}/priv_validator.json
cp genesis_file.json ${peerArray[$i]}/genesis.json
cp chain ${peerArray[$i]}/chain
cp chain-cli ${peerArray[$i]}/chain-cli
done
}
function main() {
peers=$1
peerArray=(${peers//,/ })
peerNum=${#peerArray[*]}
genConfig $peerArray $peerNum
prepareChainPkg $peerArray $peerNum
}
main $1