-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.sh
41 lines (30 loc) · 1.03 KB
/
test.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
#!/bin/bash
=============() {
echo "$@" | tr 'a-z' 'A-Z'
}
============= APP 1: MAKE SOME TRANSACTIONS
curl -s localhost:5000/transactions/new -H 'Content-Type: application/json' --data-raw $'{
"sender": "josh",
"recipient": "marissa",
"amount": 5
}' | jq
curl -s localhost:5000/transactions/new -H 'Content-Type: application/json' --data-raw $'{
"sender": "josh",
"recipient": "marissa",
"amount": 3
}' | jq
curl -s localhost:5000/transactions/new -H 'Content-Type: application/json' --data-raw $'{
"sender": "marissa",
"recipient": "dave",
"amount": 4
}' | jq
============= APP 1: MINE THE BLOCK
curl -s 'localhost:5000/mine' | jq
============= APP 1: VIEW THE BLOCKCHAIN
curl -s 'localhost:5000/chain' | jq
============= APP 2: REGISTER APP 1
curl -s localhost:5001/nodes -H 'Content-Type: application/json' --data-raw $'{
"nodes": ["http://localhost:5000/chain"]
}' | jq
============= APP 2: RESOLVE THE NEW CHAIN '(should get chain from app 1)'
curl -s localhost:5001/nodes/resolve -H 'Content-Type: application/json' | jq .