diff options
Diffstat (limited to 'content/transaction_docs.md')
-rw-r--r-- | content/transaction_docs.md | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/content/transaction_docs.md b/content/transaction_docs.md new file mode 100644 index 0000000..05c1534 --- /dev/null +++ b/content/transaction_docs.md | |||
@@ -0,0 +1,52 @@ | |||
1 | +++ | ||
2 | title = "Transactions" | ||
3 | description = "Transaction documentation" | ||
4 | weight = 6 | ||
5 | +++ | ||
6 | |||
7 | A transaction request between `source` and `target` to move `amount` Gradecoin. | ||
8 | |||
9 | # Requests | ||
10 | |||
11 | ## GET | ||
12 | A HTTP `GET` request to [/transaction](/transaction) endpoint will return the current list of pending transactions. | ||
13 | |||
14 | ## POST | ||
15 | |||
16 | A HTTP `POST` request with Authorization using JWT to [/transaction](/transactions) will allow you to propose your own transactions. | ||
17 | |||
18 | # Fields | ||
19 | ``` | ||
20 | by: Fingerprint | ||
21 | source: Fingerprint | ||
22 | target: Fingerprint | ||
23 | amount: unsigned 16 bit integer | ||
24 | timestamp: ISO 8601 <date>T<time> | ||
25 | ``` | ||
26 | |||
27 | # Hash | ||
28 | |||
29 | `tha` field in [jwt documentation](@/JWT.md) in fact stands for "The Hash", in the case of a post request for a transaction, you need the Md5 hash of the serialized JSON representation of transaction. The resulting JSON string should look something like; | ||
30 | |||
31 | ``` | ||
32 | {"by":"foo","source":"bar","target":"baz","amount":2,"timestamp":"2021-04-18T21:49:00"} | ||
33 | ``` | ||
34 | |||
35 | Or; without any whitespace, separated with `:` and `,`. | ||
36 | |||
37 | # Bank | ||
38 | |||
39 | There is a `bank` account with Fingerprint `31415926535897932384626433832795028841971693993751058209749445923` | ||
40 | |||
41 | {% tidbit() %} | ||
42 | First 64 digits of Pi | ||
43 | {% end %} | ||
44 | |||
45 | This is the only account that will let you _withdraw_ from them. | ||
46 | |||
47 | ``` | ||
48 | by: this has to be your Fingerprint | ||
49 | source: this can be either you or the bank | ||
50 | target: this can be a valid fingerprint or yourself if source is the bank | ||
51 | ... | ||
52 | ``` | ||