You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
A transaction comes in
Miner compete to mine the block
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:
miners always spend their time mining the next block even if no transactions are in their pool
when they start mining a new block:
they generate a new coinbase transaction for themselves
compute the merkle root of all the transactions in their pool (+ the coinbase transaction)
start to compute the nonce
Implications
a block no longer contains only one transaction, and will contains 1 coinbase transaction + 0 or N transactions
a block contains a merkle_root field which is used to compute the block hash
The Token.Ledger module must change to loop over transactions (no more one transaction per block)
coinbase transactions must be validated (amount ...)
difficulty must be a full part of the protocol and not just a config. Ideally, coincoin will be configured with an average time to mine a block and a block mining reward amount, and miners will re-adapt the difficulty based on this and the time it took to mine X blocks
The text was updated successfully, but these errors were encountered:
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:
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
merkle_root
field which is used to compute the block hashToken.Ledger
module must change to loop over transactions (no more one transaction per block)The text was updated successfully, but these errors were encountered: