## How is the mempool incorporated in the calculation of the block hash?

2

1

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)

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.
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.