/
bddstart.sh
executable file
·141 lines (112 loc) · 4.64 KB
/
bddstart.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
./preset.sh
sleep 30
listcommand=`./gptn --exec 'personal.listAccounts' attach node1/palletone/gptn.ipc`
list=`echo ${listcommand//^M/}`
moneyaccount=`echo "${list}" | jq -c '.[1]'`
newaccount5command=`./gptn --exec 'personal.newAccount("1")' attach node_test5/palletone/gptn5.ipc`
a5=`echo ${newaccount5command//^M/}`
account5=`echo $a5`
newaccount6command=`./gptn --exec 'personal.newAccount("1")' attach node_test6/palletone/gptn6.ipc`
a6=`echo ${newaccount6command//^M/}`
account6=`echo $a6`
newaccount7command=`./gptn --exec 'personal.newAccount("1")' attach node_test7/palletone/gptn7.ipc`
a7=`echo ${newaccount7command//^M/}`
account7=`echo $a7`
echo $moneyaccount
echo $account5
echo $account6
echo $account7
startProduce=`./gptn --exec 'mediator.startProduce()' attach node1/palletone/gptn.ipc`
echo $startProduce
#full account transferPTN to light account5
curl -H "Content-Type:application/json" -X POST -d "{\"jsonrpc\":\"2.0\",\"method\":\"wallet_transferToken\",\"params\":[\"PTN\",$moneyaccount,$account5,\"100\",\"1\",\"1\",\"1\"],\"id\":1}" http://127.0.0.1:8545
sleep 5
#ptn.syncUTXOByAddr("P19wzjSAfVKRY84pPQMsqJSxeVK7oTYEiXt") in light node5
syncutxocommand=`./gptn --exec "ptn.syncUTXOByAddr($account5)" attach node_test5/palletone/gptn5.ipc`
syncutxoinfo=`echo $syncutxocommand`
value="\"ok\""
echo $syncutxoinfo
if [ $syncutxoinfo = $value ];then
echo "============syncUTXOByAddr account5 ok============"
else
echo "============syncUTXOByAddr account5 err:"$syncutxoinfo
fi
#ptn.getBalance in light node5
balancecommand=`./gptn --exec "ptn.getBalance($account5)" attach node_test5/palletone/gptn5.ipc`
balanceinfo=`echo $balancecommand`
temp=`echo ${balanceinfo:7}`
length=`echo ${#temp}`
num=$[$lenght-2]
t1=`echo ${temp:0:$num} | sed 's/ //g' | sed 's/"//g'`
if [ $t1 = 100 ];then
echo "============getBalance account5 ok============"
else
echo "============getBalance account5 err:"$t1
fi
# transferPTN in light node5 node6
curl -H "Content-Type:application/json" -X POST -d "{\"jsonrpc\":\"2.0\",\"method\":\"wallet_transferToken\",\"params\":[\"PTN\",$account5,$account6,\"80\",\"1\",\"1\",\"1\"],\"id\":1}" http://127.0.0.1:8595
sleep 5
syncutxocommand=`./gptn --exec "ptn.syncUTXOByAddr($account6)" attach node_test6/palletone/gptn6.ipc`
syncutxoinfo=`echo $syncutxocommand`
value="\"OK\""
if [ $syncutxoinfo = $value ];then
echo "============syncUTXOByAddr account6 ok============"
else
echo "============syncUTXOByAddr account6 err:"$syncutxoinfo
fi
balancecommand=`./gptn --exec "ptn.getBalance($account6)" attach node_test6/palletone/gptn6.ipc`
balanceinfo=`echo $balancecommand`
temp=`echo ${balanceinfo:7}`
length=`echo ${#temp}`
num=$[$lenght-2]
t1=`echo ${temp:0:$num} | sed 's/ //g' | sed 's/"//g'`
if [ $t1 = 80 ];then
echo "============getBalance account6 ok============"
else
echo "============getBalance account6 err:"$t1
fi
# transferPTN in light node6 node7
curl -H "Content-Type:application/json" -X POST -d "{\"jsonrpc\":\"2.0\",\"method\":\"wallet_transferToken\",\"params\":[\"PTN\",$account6,$account7,\"50\",\"1\",\"1\",\"1\"],\"id\":1}" http://127.0.0.1:8605
sleep 5
syncutxocommand=`./gptn --exec "ptn.syncUTXOByAddr($account7)" attach node_test7/palletone/gptn7.ipc`
syncutxoinfo=`echo $syncutxocommand`
value="\"OK\""
if [ $syncutxoinfo = $value ];then
echo "============syncUTXOByAddr account7 ok============"
else
echo "============syncUTXOByAddr account7 err:"$syncutxoinfo
fi
balancecommand=`./gptn --exec "ptn.getBalance($account7)" attach node_test7/palletone/gptn7.ipc`
balanceinfo=`echo $balancecommand`
temp=`echo ${balanceinfo:7}`
length=`echo ${#temp}`
num=$[$lenght-2]
t1=`echo ${temp:0:$num} | sed 's/ //g' | sed 's/"//g'`
if [ $t1 = 50 ];then
echo "============getBalance account7 ok============"
else
echo "============getBalance account7 err:"$t1
fi
:<<!
balancecommand=`./gptn --exec "ptn.getBalance($account5)" attach node_test4/palletone/gptn4.ipc`
balanceinfo=`echo $balancecommand`
temp=`echo ${balanceinfo:7}`
length=`echo ${#temp}`
num=$[$lenght-2]
t1=`echo ${temp:0:$num}`
echo "=========consle getBalance==========="
echo $t1
#check light account5 balance in full node
balancecommand=`curl -H "Content-Type:application/json" -X POST -d "{\"jsonrpc\":\"2.0\",\"method\":\"wallet_getBalance\",\"params\":[$account5],\"id\":1}" http://127.0.0.1:8585`
balanceinfo=`echo $balancecommand`
balance=`echo $balanceinfo | sed -n '$p'`
b1=`echo $balance | jq '.result.PTN'`
b2=`echo $b1`
num="\"100\""
if [ "$b2" = "$num" ];then
echo "============transferToken account5 ok num"$b2"============"
else
echo "============transferToken1 account5 num:"$b2"============"
fi
!