So I've been reading about how the nonce is calculated. There is one part that I don't get. So there is a mempool, and each node (or mining node) takes a part (or the whole part) of that mempool, computes a merkle root and combines it with a nonce to get a hash that has a certain difficulty level.

Is the mempool (or part of it) is first converted to a hash by the mining software, then enters the nonce calculation?

Are there requirements on how the transactions are ordered when mining a block?

Can nodes choose the order of transactions in a block? Is a node free to choose any order of the transactions that it wants or must it be chosen chronologically?

(feel free to edit the question, I tried to explain it the best I could)

1 Answer 1


Every node in the network has a mempool. The mempool contains unconfirmed transactions. Each mempool may be slightly different as they constitute a subset of all unconfirmed transactions in the network: Some might not have been relayed to a node, so he doesn't know about them, the node owner has set a higher minTxRelayFee and filtered out some transactions with low fee, or the node owner has set a smaller data limit for his mempool.

Anyway, all of the above is also true for any miner's node. When miners are trying to find a block, they select a set of transactions to confirm from their mempool. From these transactions, they build a Merkle tree. The Merkle tree allows the whole transaction data to be represented by only the Merkle root. This Merkle root is part of the block header.
Miners get to choose which transactions to include freely, and they can also put them in any order they want, as long as the transactions are valid. Since there are now often more transactions available for confirmation than block space, miners usually select transactions that maximize the fees that the miner can earn.

So, miners have selected some transactions and created a Merkle tree to contain them. They combine this with the other parts of the block header: Time-stamp, Reference to previous block, difficulty statement, and the nonce. The nonce is an arbitrary number, so miners can build a block candidate with all the other data and then try this candidate a lot of times by cycling through all possible values for the nonce.
Every try they put the block header into the hashing algorithm and receive a digest or hash of the data. If this hash satisfies the difficulty statement, the miner has found a new block and will relay it to the network.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.