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
|
#!/usr/bin/env bash
## When in doubt just write a shell script
## new registration request
## should fail because foobar is not a student
curl --request POST \
--header 'Content-Type: application/json' \
--data '{
"student_id": "foobar",
"public_key": "not_implemented_yet"
}' \
http://localhost:8080/register
## new registration request
## this student can hold a gradecoin account
curl --request POST \
--header 'Content-Type: application/json' \
--data '{
"student_id": "e254275",
"public_key": "not_implemented_yet"
}' \
http://localhost:8080/register
## new transaction
curl --request POST \
--header 'Content-Type: application/json' \
--data '{
"by": "old_transaction_hash_1",
"source": "old_transaction_hash_1",
"target": "target_account",
"amount": 20,
"timestamp": "2021-04-09T01:30:30"
}' \
http://localhost:8080/transaction
## new transaction
curl --request POST \
--header 'Content-Length: 36864' \
--data '{
"source": "old_transaction_hash_2",
"target": "target_account",
"amount": 20,
"timestamp": "2021-04-09T01:31:30"
}' \
http://localhost:8080/transaction
## new transaction
curl --request POST \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer arstarst.arstarst.arstarst' \
--data '{
"by": "e254275",
"source": "old_transaction_hash_3",
"target": "target_account",
"amount": 20,
"timestamp": "2021-04-09T01:32:30"
}' \
http://localhost:8080/transaction
printf "\n\nList of current transactions\n\n"
## list transactions
curl localhost:8080/transaction
curl --header "Content-Type: application/json" \
--header "Authorization: aaa.bbb.ccc" \
--request POST \
--data '{
"transaction_list": [
"old_transaction_hash_1",
"old_transaction_hash_2",
"old_transaction_hash_3"
],
"nonce": 0,
"timestamp": "2021-04-08T12:30:30",
"hash": "not_a_thing_yet"
}' \
http://localhost:8080/block
printf "\n\nShould be scooped up by the block\n\n"
## list transactions
curl localhost:8080/transaction
curl --request POST \
--header 'Content-Type: application/json' \
--data '{
"source": "source_account",
"target": "target_account",
"amount": 20,
"timestamp": "2021-04-09T01:30:30"
}' \
http://localhost:8080/transaction
printf "\n\nShould have only one transaction\n\n"
curl localhost:8080/transaction
printf "\n\nShould have only one block\n\n"
curl localhost:8080/block
|