DEV Community

Discussion on: Blockchain: what is in a block?

Collapse
 
rlahiri profile image
Rahul Lahiri

This really helped -- so clearly written!

I have a rookie question: how are the transactions included in a block determined? I expect that at any given time, all the miners are working with a similar but non-identical set of transactions to create the next block. Do they have to check the transactions included in every new block while they are computing the hashes, and discard all the work if a newly added block includes any transaction they were working with?

Collapse
 
damcosset profile image
Damien Cosset

Yes, whenever a new block is mined, miners have to create a candidate block. This candidate block includes all the transactions that have not been mined yet. If a miner was trying to mine a block and failed, she will check which transactions have been included in the winning block. Whatever transactions is leftover becomes part of this new candidate block.

If you want a deeper explaination on this, I wrote an article called Blockchain: what is mining? That explains this concept :)

Collapse
 
rlahiri profile image
Rahul Lahiri

Thank you! I will read up that article!