robinmonjo / coincoin

Blockchain based cryptocurrency proof-of-concept in Elixir. Feedback welcome
402 stars 54 forks source link

Reward miners #9

Open robinmonjo opened 6 years ago

robinmonjo commented 6 years ago

How does it works in Bitcoin

In the Bitcoin blockchain, a block is mined every ~10 minutes. This block can contains from 0 to N transactions. The only limit is that at the end, the block is no more than 1Mb. What's interesting here is that even if there is no transaction a block will still be mined and a "coinbase" transaction (a transaction that generates bitcoin) get generated every ~10 minutes.

Miners also collect transactions fees, and that's a way for people to ensure their transactions will be incorporated into the blockchain quickly if they set a high transaction fee

What's going on with coincoin ?

Currently coincoin has a really naive approach to mining:

  1. A transaction comes in
  2. Miner compete to mine the block
  3. First miner to come up with the proof-of-work add the block to the chain

Miners do not have any rewards and the only way to inject tokens into the blockchain is to use the Token.free_tokens/1 API.

How to reward miners in coincoin ?

For simplicity reasons, I will ignore transaction fees:

Implications