aboutsummaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/block_docs.md21
-rw-r--r--content/transaction_docs.md18
2 files changed, 27 insertions, 12 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
10We use Blocks to commit proposed [Transactions](@/transaction_docs.md) to the ledger in order to realize them. 10We 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.
12Blocks are valid when they are proposed with a `nonce` that produces a `hash` value with 6 zeroes (24 bits) at the left hand side. 12In order to create a valid block, the proposer must find a suitable `nonce` value that makes the `hash` of the block valid.
13The properties a valid hash should have will be explained in subsequent sections.
13 14
14We are _mining_ using [blake2s](https://www.blake2.net/) algorithm, which produces 256 bit hashes. 15We are _mining_ using [blake2s](https://www.blake2.net/) algorithm, which produces 256 bit hashes.
15Hash/second is roughly {{ exp(num="20x10", exponent="3") }} on my machine, a new block can be mined in around 4-6 minutes. 16Hash/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
38The proposer of the block is identified by the first transaction in the `transaction_list`. 39The proposer of the block is identified by the source of the first transaction in `transaction_list`.
39This transaction is called the *coinbase* and will get awarded the block mining reward for their work. 40This transaction is called the *coinbase*, and its source will get awarded by the block mining reward for their work.
41The 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
44The _mining_ process for the hash involves; 47The _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
49If the resulting hash is valid, then you can create a `Block` JSON object with the found `nonce` and `hash`. 58If 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
diff --git a/content/transaction_docs.md b/content/transaction_docs.md
index 72c1ef7..a4617a6 100644
--- a/content/transaction_docs.md
+++ b/content/transaction_docs.md
@@ -24,19 +24,23 @@ timestamp: ISO 8601 <date>T<time>
24# Hash 24# Hash
25`tha` field in [jwt documentation](@/JWT.md) in fact stands for "The Hash". 25`tha` field in [jwt documentation](@/JWT.md) in fact stands for "The Hash".
26In the context of a transaction proposal, you need the [Md5](https://en.wikipedia.org/wiki/MD5) hash of the serialized JSON representation of transaction. 26In the context of a transaction proposal, you need the [Md5](https://en.wikipedia.org/wiki/MD5) hash of the serialized JSON representation of transaction.
27Serializing in this context is a simple JSON to string conversion with key, value pairs enclosed with quotation marks ("). 27Since there are many ways to convert an object to JSON, we enforce the following rules (alongside the regular rules of JSON syntax) for consistency:
28The resulting JSON string should look something like; 28- There shouldn't be any whitespace or newlines in the serialized string.
29- The order of fields should be exactly as shown above.
30- All keys and string values must be enclosed with quotation marks (`"`).
29 31
32Here's an example demostrating how your JSON string should look like:
30``` 33```
31{"source":"bar","target":"baz","amount":2,"timestamp":"2021-04-18T21:49:00"} 34{"source":"bar","target":"baz","amount":2,"timestamp":"2021-04-18T21:49:00"}
32``` 35```
33 36
34Or; without any whitespace, separated with `:` and `,`.
35
36# Transaction Rules 37# Transaction Rules
37- Transactions should be sent from your account (`source`) to any other account (`target`). 38- Transactions should be sent from your account (`source`) to any other account (`target`).
38- No two transaction with the same `source`/`target` pair can appear on the pending transaction list [/transactions](/transaction). 39- You cannot create multiple transactions with the same `source`/`target` pair.
39- Transactions generate traffic which is something we desperately need in Gradecoin, so for every transaction you send, some Gradecoin will be generated out of thin air and will appear on the target. 40- Transactions generate traffic which is something we desperately need in Gradecoin, so for every transaction you send, some Gradecoin will be generated out of thin air and will appear on your account.
41 - The amount of Gradecoin that will be generated is given by `tx_traffic_reward` field of [`/config`](/config).
42 - For example, if `tx_traffic_reward` is 1 and you send 2 coins, only 1 coin will be deduced from your account since you will be given 1 coin for generating traffic. The target will receive 2 coins.
40- Don't worry if your transaction goes unaccepted! Transactions do not disappear until they are committed into the ledger with a block. 43- Don't worry if your transaction goes unaccepted! Transactions do not disappear until they are committed into the ledger with a block.
41- Every transaction has a unique ID generated using the `source`, `target` and `timestamp` fields. 44- Every transaction has a unique ID generated using the `source`, `target` and `timestamp` fields.
42- Transactions have an upper amount limit. 45- Transactions have a lower and upper amount limit.
46 - These are given by `tx_lower_limit` and `tx_upper_limit` fields of [`/config`](/config). See [misc page](@/misc_docs.md) for more information about configuration.