-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0.start_blockchain_network.sh
60 lines (43 loc) · 1.38 KB
/
0.start_blockchain_network.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
57
58
59
60
#!/bin/bash
WORK_DIR=$(pwd)
function getCurTs(){
cur=$(date +%s.%N)
cur_s=$(echo $cur | cut -d '.' -f 1)
cur_ns=$(echo $cur | cut -d '.' -f 2)
cur_ms=$(( 10#$cur_s * 1000 + 10#$cur_ns / 1000000 ))
echo $cur_ms
}
function printLog(){
log_info=$1
echo -e "\033[34m [SMART][$(getCurTs)] $log_info \033[0m"
}
## stop all nodes
printLog "stop existing blockchain nodes"
bash nodes/127.0.0.1/stop_all.sh
## rm old nodes dir
printLog "remove existing blockchain data"
rm -rf nodes/
## rm console log
printLog "remove existing console log"
rm -rf console/log/
rm console/deploylog.txt
## rm pck cache (need root privilege)
printLog "remove existing local pck database"
sudo rm /opt/intel/sgx-dcap-pccs/pckcache.db
sudo rm /opt/intel/sgx-pck-id-retrieval-tool/pckid_retrieval.csv
## restart pccs service (need root privilege)
printLog "restart pck cache server"
sudo systemctl restart pccs
## generate nodes
printLog "generate 4 new blockchain nodes"
bash build_chain.sh -l 127.0.0.1:4 -p 30300,20200
## start all nodes
printLog "start 4 new blockchain nodes"
bash nodes/127.0.0.1/start_all.sh
## update conf to console
printLog "sync blockchain nodes config to console"
cp -r nodes/127.0.0.1/sdk/* console/conf
## deploy TPM contract
printLog "deploy TEE provider management contract"
cd console && bash console.sh deploy TPM
printLog "system initialization is completed"