-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
46 lines (38 loc) · 1.14 KB
/
run.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
#! /bin/bash
mkdir fabric 2> /dev/null
cd fabric
rm -fr * 2> /dev/null
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash
printf "\n export PATH=\"$PWD/fabric-samples/bin:\$PATH\" \n" >> ~/.profile
source ~/.profile
cd fabric-samples/
git checkout v1.4.6
git branch
cd balance-transfer/
nohup ./runApp.sh &
nohub ./testAPIs.sh &
###############################
#This part needs to be updated#
###############################
./runApp.sh | \
while read line; do
if echo $line | grep "4000"; then
./testAPIs.sh
ORG1_TOKEN=$(curl -s -X POST \
http://localhost:4000/users \
-H "content-type: application/x-www-form-urlencoded" \
-d 'username=fady&orgName=Org1')
ORG1_TOKEN=$(echo $ORG1_TOKEN | jq ".token" | sed "s/\"//g")
curl -s -X POST \
http://localhost:4000/channels/mychannel/chaincodes \
-H "authorization: Bearer $ORG1_TOKEN" \
-H "content-type: application/json" \
-d '{
"chaincodeName":"mycc",
"chaincodeVersion":"v0",
"chaincodeType": "golang",
"args":["alice","100000","bob","200000"]
}'
fi
done
###############################