diff options
author | necrashter | 2022-04-24 21:37:51 +0300 |
---|---|---|
committer | Yigit Sever | 2022-04-24 22:26:05 +0300 |
commit | fe72491dea7cc6c00e86e3f8dc9a6dde10658554 (patch) | |
tree | 28c818f7c7a7beb1239dd7cf9730dec112206a6d /content/block_docs.md | |
parent | 79b0d66ec091501b063d35976db2347fc10a39d1 (diff) | |
download | gradecoin-site-fe72491dea7cc6c00e86e3f8dc9a6dde10658554.tar.gz gradecoin-site-fe72491dea7cc6c00e86e3f8dc9a6dde10658554.tar.bz2 gradecoin-site-fe72491dea7cc6c00e86e3f8dc9a6dde10658554.zip |
Clarifications on transactions and blocks
Diffstat (limited to 'content/block_docs.md')
-rw-r--r-- | content/block_docs.md | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/content/block_docs.md b/content/block_docs.md index 2eec2ac..3c47231 100644 --- a/content/block_docs.md +++ b/content/block_docs.md | |||
@@ -9,7 +9,8 @@ weight = 10 | |||
9 | 9 | ||
10 | We use Blocks to commit proposed [Transactions](@/transaction_docs.md) to the ledger in order to realize them. | 10 | We use Blocks to commit proposed [Transactions](@/transaction_docs.md) to the ledger in order to realize them. |
11 | `transaction_list` of the Block is filled with valid transactions. | 11 | `transaction_list` of the Block is filled with valid transactions. |
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. | 12 | In order to create a valid block, the proposer must find a suitable `nonce` value that makes the `hash` of the block valid. |
13 | The properties a valid hash should have will be explained in subsequent sections. | ||
13 | 14 | ||
14 | We are _mining_ using [blake2s](https://www.blake2.net/) algorithm, which produces 256 bit hashes. | 15 | 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 | Hash/second is roughly {{ exp(num="20x10", exponent="3") }} on my machine, a new block can be mined in around 4-6 minutes. |
@@ -35,16 +36,24 @@ hash: String | |||
35 | ``` | 36 | ``` |
36 | 37 | ||
37 | ## Coinbase | 38 | ## Coinbase |
38 | The proposer of the block is identified by the first transaction in the `transaction_list`. | 39 | The proposer of the block is identified by the source of the first transaction in `transaction_list`. |
39 | This transaction is called the *coinbase* and will get awarded the block mining reward for their work. | 40 | This transaction is called the *coinbase*, and its source will get awarded by the block mining reward for their work. |
41 | The amount of the reward is determined by `block_reward` field of [`/config`](/config). | ||
40 | 42 | ||
41 | > Place one of your own transactions as the first item in `transaction_list` | 43 | > Place one of your own transactions as the first item in `transaction_list`. |
44 | > Otherwise, someone else will receive the reward! | ||
42 | 45 | ||
43 | # Mining | 46 | # Mining |
44 | The _mining_ process for the hash involves; | 47 | The _mining_ process for the hash involves; |
45 | - Creating a temporary JSON object with `transaction_list`, `timestamp` and `nonce` values | 48 | - Creating a temporary JSON object with `transaction_list`, `nonce`, and `timestamp` values |
46 | - Serializing it | 49 | - Serializing it |
50 | - **NOTE:** Serialized JSON must comply with the rules explained in hash section of [transaction](@/transaction_docs.md) page. | ||
51 | - The order of keys should be as follows: `transaction_list`, `nonce`, `timestamp`. | ||
47 | - Calculating blake2s hash of the serialized string | 52 | - Calculating blake2s hash of the serialized string |
53 | - Checking if the hash is valid | ||
54 | - The hash is considered valid if its hexadecimal representation starts with an arbitrary number of zeros. | ||
55 | - This number is given by `hash_zeros` field of [`/config`](/config). | ||
56 | - For instance, if `hash_zeros` is 6, a valid hash must start with 6 hexadecimal zeros. | ||
48 | 57 | ||
49 | If the resulting hash is valid, then you can create a `Block` JSON object with the found `nonce` and `hash`. | 58 | If the resulting hash is valid, then you can create a `Block` JSON object with the found `nonce` and `hash`. |
50 | 59 | ||
@@ -54,6 +63,8 @@ Fill this with the `hash` value you found during the mining process. | |||
54 | 63 | ||
55 | # Block Rules | 64 | # Block Rules |
56 | - Blocks have to include a minimum number of transactions. | 65 | - Blocks have to include a minimum number of transactions. |
66 | - `block_transaction_count` field of [`/config`](/config) yields this value. | ||
67 | - See [misc Page](@/misc_docs.md) for more information about configuration. | ||
57 | - Blocks cannot have duplicate transactions. | 68 | - Blocks cannot have duplicate transactions. |
58 | 69 | ||
59 | # References | 70 | # References |