When exactly does Bitcoin transaction batch happen?


A miner chooses whatever transactions makes business sense to them. They don’t have to include any transactions if they don’t want to. They can make a block containing no transactions (other than the coinbase transaction that pays the miner the block reward).

Typically, as soon as a block has been published by someone else (or themselves), I’d expect a miner to obtain or build a block template that may or may not include a bunch of transactions waiting in its “memory pool” (mempool). Then the miner will run through trillions of different values for the nonce etc and for each value, compute the hash of the block to see if the resulting hash is less than the current target.

But miners can start mining any time they like. The only constraint is that they just waste their time if they try to publish block number N after someone else already published a different block with block number N.

The miner assembles N transactions into a block

That’s basically true. Mostly.

(rather than creating a consensus for every single transaction).

Miners don’t create consensus.

Miners could create a block for one transaction at a time if they wanted to.

when exactly the miner code decides to “combine”?

Whenever they want.

Does it wait until the list of transactions hit the block size limit (1 MB)?


does it just wait X-minute?


does it combine immediately as soon as it receives the transaction fees?


Miners don’t receive transaction fees. Certainly not in advance.

Miners claim transaction fees. They do this by creating a coinbase transaction that they include as the first transaction in a block. This transaction typically moves the transaction fee amounts into an address of the miner’s wallet.

They can’t spend that money unless everyone involved thinks their new block meets all the rules.

One rule is they can’t spend that money until after another 100 blocks has been mined.

Source link

Leave a reply