Block Documentation

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!

Requests

GET

A HTTP GET request to /block endpoint will return the latest mined block.

POST

A HTTP POST request with Authorization using JWT will allow you to propose your own blocks.

Fields

transaction_list: [array of Transaction IDs]
nonce: unsigned 32-bit integer
timestamp: ISO 8601 Timestamp (<date>T<time>)
hash: String

Coinbase

The proposer of the block is identified by the first transaction in the transaction_list. 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 transaction_list

Mining

The mining process for the hash involves;

If the resulting hash is valid, then you can create a Block JSON object with the found nonce and hash.

Hash

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.

Block Rules

References