0

It is commonly said that a new block that is hoped to be added to the existing blockchain is filled with transactions, and together with a nonce, go through SHA256 twice, and tries to be a small enough number (with many leading 0's)

Isn't it true that each miner or mining pool, can get different transaction to fill in? Are these transactions coming in that "are hoped to be added to this new block in about 10 minutes"? Some transaction are chosen because they offer a good fee. And it is just up to the miner or mining pool to decide which transaction go in? So then, can the miner or mining pool put in one transaction, two transactions, 0 transactions, or any number of transactions?

So each miner or mining pool work off a block that are filled with different transactions plus a nonce?

1

Yes, each miner decides which transactions to select into their block templates. Blocks must have a coinbase transaction, all other transactions are optional, but blocks are limited to 4,000,000 weight units.

Let me elaborate: unconfirmed transactions are relayed on the network by the participating nodes via the p2p gossip protocol. Each node maintains their own list of unconfirmed transactions in its memory pool (mempool). Miners generally pick transactions from their mempool to assemble block templates.

Blocks must have a coinbase transaction as the first transaction in the block, and the remaining transactions must be valid and sorted topologically. A block may not exceed 4,000,000 weight units. Other than that, miners are completely free to pick and choose the composition of their block. Blocks that only contain a coinbase transaction are allowed and referred to as .

It is expected that miners wish to optimize their revenue by collecting the most transaction fees possible. By default, the getBlockTemplate call uses a greedy algorithm that iteratively picks the set of transactions with the highest effective feerate until the block is full. Miners may use the prioritisetransaction rpc call to reprioritize transactions for the block template consideration. Some miners may use custom software to build their blocks.

In effect, block templates usually overlap almost completely across miners as nodes should see the same transactions on the network (with some slight delays due to relay). However, since each miner's block template attempts to pay the block reward to themselves via the coinbase transaction and each miner has a different payout address, every block template produced by miners will be unique and no miners will ever repeat work done by another miner.

Given a block template, miners search that template's combination space by injecting random data via varying nonces, extranonces, timestamps, malleating the version field, etc. Each new combination yields a unique block header which is hashed using SHA-256d. If a resulting digest meets the target, the miner has found a new block. Otherwise, they create a new block template and start over.

Once a new block is discovered, the block author broadcasts it to their peers. Other nodes that learn about the block append it to their blockchain, update their UTXO sets, and remove the confirmed transactions from their mempools. Since the best chain can only have one block at every height, it does not make sense for an honest miner to continue mining at the old height, therefore, they switch to mining at the new height as quickly as possible.

0

The answer to all your questions is yes, except for the last one. There is more that can be varied. Nonce, extranonce, transaction order, transaction selection, maybe timestamp (within +/- an hour or so) and some other contents of the block can be varied to change the hash. The higher the difficulty, the more creative miners become.

2
  • you mean it is not as simple as such some chosen transaction plus a nonce? My main focus is, different miners can choose different transactions to be in the block, and different mining pools, also, have thousands of miners in it, and each miner can have their own chosen transactions in the block? – nonopolarity Feb 2 at 13:15
  • yes, yes, no - pool allocates work to prevent duplication of effort – RedGrittyBrick Feb 2 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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