gridcoin-community / Gridcoin-Tasks

Gridcoin community tasks repository
https://gridcoin.us
MIT License
24 stars 5 forks source link

proposal: Merge coinbase and coinstake #173

Closed tomasbrod closed 5 years ago

tomasbrod commented 6 years ago

Coinbase transactions

Every block contains so called coinbase as a first transaction. This transaction was used to pay proof-of-work block reward, since migration to PoS the output must be empty. The second transaction in every PoS (as in non-PoW) block is reserved for CoinStake. Multiple inputs to coinstake are allowed, but only the first is used to calculate proof of stake and usually only one input is filled. The first output must be empty (why?). Second and third outputs are to same address as coins staked from and value is sum of inputs, block fees, interest and research reward. So called BoincHash field is used to authorize the reward and contains Gridcoin specific keys, values, cpid and is signed by beacon keys. This field is included not in the coinstake transaction where all the reward is, but in the coinbase transaction which is illogical and reason for #303.

Coinbase proposal

I propose to merge both coinbase and coinstake transactions into one. This can save some bytes for each block and make it easy to determine the type of reward transaction (dpor or pos) and more details to show in wallet gui.

BoincHash structure

I also would like to see better format of the BoincHash field. Currently it is just a string with custom separator format. Ideal would be binary serialization, or header-less XML. Ideally coinbase input should be used for storing information related mint and DPoR.