Most blockchains have what is called a coinbase. This is a part of a block that comes after the header information and before any transaction. It contains information about who get the award for mining, any conditions that may exist on that reward such as time release locks, and similar types of data.
The rewards at Contractless are handled somewhat differently. We treat it in the same way we treat all things in Contractless, as a unique transaction type.
In fact, all transactions are defined by a field called txtype. It is the first field of any transaction and the rewards transaction is no exception to this.
A rewards transaction is a txtype 1. This means when adding a rewards transaction to a block, it MUST have a txtype set to 1. If the txtype is missing the transaction will be ignored, so no reward will be granted.
So the first transaction of any block is a txtype 1. A txtype 1 can only exist in a block 1 time. If it exists more than one time it will be rejected by other nodes.
After the txtype comes the timestamp which should be the same as the block timestamp.
Then comes the value. The value must be exactly the same as what the halving rewards calculator says it should be.
Then the miner must add their wallet, hash the data, and sign the hash.
That final part is fairly unique to Contractless. Most blockchains do not treat the Coinbase as a transaction and therefore it does not require a signature. Because we treat it as a transaction like any other, we require a signature to present.
This also allows us more restrictions with our fairness distribution algorithm which I will discuss in a later post.
You can check our halving algorithm and our structure for the rewards transaction on the code review post for block rewards.