diff options
| author | Yigit Sever | 2021-04-19 18:21:06 +0300 |
|---|---|---|
| committer | Yigit Sever | 2021-04-19 18:21:06 +0300 |
| commit | 81ebd267c89011ca65cd5cfe382e10fabd9017ac (patch) | |
| tree | 4e1f17b897bc9e3850e9c50861fd4893371f05e4 /site/content/block_docs.md | |
| parent | 202625e0e1a4a6a85c895d9cd71a9f419a3b2173 (diff) | |
| download | gradecoin-81ebd267c89011ca65cd5cfe382e10fabd9017ac.tar.gz gradecoin-81ebd267c89011ca65cd5cfe382e10fabd9017ac.tar.bz2 gradecoin-81ebd267c89011ca65cd5cfe382e10fabd9017ac.zip | |
Moving site to separate repo
Diffstat (limited to 'site/content/block_docs.md')
| -rw-r--r-- | site/content/block_docs.md | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/site/content/block_docs.md b/site/content/block_docs.md deleted file mode 100644 index 92880b6..0000000 --- a/site/content/block_docs.md +++ /dev/null | |||
| @@ -1,43 +0,0 @@ | |||
| 1 | +++ | ||
| 2 | title = "Blocks" | ||
| 3 | description = "Block Documentation" | ||
| 4 | weight = 10 | ||
| 5 | +++ | ||
| 6 | |||
| 7 | A block that was proposed to commit Transactions in `transaction_list` to the | ||
| 8 | ledger with a nonce that made `hash` valid; 6 zeroes at the left hand side of the | ||
| 9 | hash (24 bytes). | ||
| 10 | |||
| 11 | We are _mining_ using [blake2s](https://www.blake2.net/) algorithm, which produces 256 bit hashes. Hash/second is roughly {{ exp(num="20x10", exponent="3") }} on my machine, a new block can be mined in around 4-6 minutes. | ||
| 12 | |||
| 13 | # Requests | ||
| 14 | |||
| 15 | ## GET | ||
| 16 | A HTTP `GET` request to [/block](/block) endpoint will return the latest mined block. | ||
| 17 | |||
| 18 | ## POST | ||
| 19 | |||
| 20 | A HTTP `POST` request with Authorization using JWT will allow you to propose your own blocks. | ||
| 21 | |||
| 22 | # Fields | ||
| 23 | ``` | ||
| 24 | transaction_list: [array of Fingerprints] | ||
| 25 | nonce: unsigned 32-bit integer | ||
| 26 | timestamp: ISO 8601 <date>T<time> | ||
| 27 | hash: String | ||
| 28 | ``` | ||
| 29 | |||
| 30 | # Mining | ||
| 31 | The _mining_ process for the hash involves; | ||
| 32 | - Creating a temporary JSON object with `transaction_list`, `timestamp` and `nonce` values | ||
| 33 | - Serializing it | ||
| 34 | - Calculating blake2s hash of the serialized string | ||
| 35 | |||
| 36 | If the resulting hash is valid, then you can create a `Block` JSON object with the found `nonce` and `hash`. | ||
| 37 | |||
| 38 | # Hash | ||
| 39 | |||
| 40 | ```tha``` field in [jwt documentation](/jwt) in fact stands for "The Hash", in the case of a post request for a block, you need to use hash field of the block. | ||
| 41 | |||
| 42 | |||
| 43 | [ISO 8601 Reference](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) | ||
