Blocks commit proposed transactions into the ledger. A transaction that do not appear on a valid block is not accepted by the network.
Blocks in Gradecoin are proposed to commit Transactions that were proposed previously to the system.
transaction_list of the Block should be filled with valid transactions to be committed.
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.
We are mining using blake2s algorithm, which produces 256 bit hashes. Hash/second is roughly 20x103 on my machine, a new block can be mined in around 4-6 minutes.
We have seen blocks that came in within a minute during the testnet phase!
GET request to /block endpoint will return the latest mined block.
POST request with Authorization using JWT will allow you to propose your own blocks.
transaction_list: [array of Transaction IDs] nonce: unsigned 32-bit integer timestamp: ISO 8601 Timestamp (<date>T<time>) hash: String
The proposer of the block is identified by the first transaction in the
This transaction is called the coinbase and will get awarded the block mining reward for their work.
Place one of your own transactions as the first item in
The mining process for the hash involves;
- Creating a temporary JSON object with
- Serializing it
- Calculating blake2s hash of the serialized string
If the resulting hash is valid, then you can create a
Block JSON object with the found
tha field in jwt documentation stands for "The Hash" in the context of blocks.
Fill this with the
hash value you found during the mining process.
- Blocks should include some minimum number of transactions.
- Blocks cannot have duplicate transactions.