diff options
Diffstat (limited to 'content/block_docs.md')
-rw-r--r-- | content/block_docs.md | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/content/block_docs.md b/content/block_docs.md index 92880b6..05bf8ee 100644 --- a/content/block_docs.md +++ b/content/block_docs.md | |||
@@ -4,11 +4,19 @@ description = "Block Documentation" | |||
4 | weight = 10 | 4 | weight = 10 |
5 | +++ | 5 | +++ |
6 | 6 | ||
7 | A block that was proposed to commit Transactions in `transaction_list` to the | 7 | > Blocks commit proposed transactions into the ledger. |
8 | ledger with a nonce that made `hash` valid; 6 zeroes at the left hand side of the | 8 | > A transaction that do not appear on a valid block is not accepted by the network. |
9 | hash (24 bytes). | ||
10 | 9 | ||
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. | 10 | Blocks in Gradecoin are proposed to commit [Transactions](@/transaction_docs.md) that were proposed previously to the system. |
11 | `transaction_list` of the Block should be filled with valid transactions to be committed. | ||
12 | Blocks are valid when they are proposed with a `nonce` that produces a `hash` value with 6 zeroes (24 bits) at the left hand side. | ||
13 | |||
14 | We are _mining_ using [blake2s](https://www.blake2.net/) algorithm, which produces 256 bit hashes. | ||
15 | Hash/second is roughly {{ exp(num="20x10", exponent="3") }} on my machine, a new block can be mined in around 4-6 minutes. | ||
16 | |||
17 | {% tidbit() %} | ||
18 | We have seen blocks that came in within a minute during the testnet phase! | ||
19 | {% end %} | ||
12 | 20 | ||
13 | # Requests | 21 | # Requests |
14 | 22 | ||
@@ -16,14 +24,13 @@ We are _mining_ using [blake2s](https://www.blake2.net/) algorithm, which produc | |||
16 | A HTTP `GET` request to [/block](/block) endpoint will return the latest mined block. | 24 | A HTTP `GET` request to [/block](/block) endpoint will return the latest mined block. |
17 | 25 | ||
18 | ## POST | 26 | ## POST |
19 | 27 | A HTTP `POST` request with Authorization using [JWT](@/JWT.md) will allow you to propose your own blocks. | |
20 | A HTTP `POST` request with Authorization using JWT will allow you to propose your own blocks. | ||
21 | 28 | ||
22 | # Fields | 29 | # Fields |
23 | ``` | 30 | ``` |
24 | transaction_list: [array of Fingerprints] | 31 | transaction_list: [array of Transaction IDs] |
25 | nonce: unsigned 32-bit integer | 32 | nonce: unsigned 32-bit integer |
26 | timestamp: ISO 8601 <date>T<time> | 33 | timestamp: ISO 8601 Timestamp (<date>T<time>) |
27 | hash: String | 34 | hash: String |
28 | ``` | 35 | ``` |
29 | 36 | ||
@@ -36,8 +43,12 @@ The _mining_ process for the hash involves; | |||
36 | If the resulting hash is valid, then you can create a `Block` JSON object with the found `nonce` and `hash`. | 43 | If the resulting hash is valid, then you can create a `Block` JSON object with the found `nonce` and `hash`. |
37 | 44 | ||
38 | # Hash | 45 | # Hash |
46 | `tha` field in [jwt documentation](@/JWT.md) stands for "The Hash" in the context of blocks. | ||
47 | Fill this with the `hash` value you found during the mining process. | ||
39 | 48 | ||
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. | 49 | # Block Rules |
41 | 50 | - Blocks should include some minimum number of transactions. | |
51 | - Blocks cannot have duplicate transactions. | ||
42 | 52 | ||
43 | [ISO 8601 Reference](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) | 53 | # References |
54 | - [ISO 8601 Reference](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) | ||