bitcoin core – How does miner order transactions?


I understand that miners can do whatever they are pleased to do. Either include 0 transaction or 1000 transactions in the block before mining. But I assume majority of the nodes run the same set of code, Bitcoin client. So, I assume there has to be some logic implemented in the code.

  1. How does miner order transactions if two are unrelated? e.g., A pays C, X pays Y. I assume changing the order in the block will change the hash, so I am curious how Bitcoin code combines them in which order.

  2. How does Bitcoin client code decide when to start the nonce + mining process? I understand it has some kind of batch process, so it doesn’t start the mining until it can assemble some transactions into a block. But, where’s the code to assemble those? Some say miner does whatever they want, but at the end of the day, nobody writes their own client code. There has to be some common code that implements this logic.

Source link

Leave a reply