Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: joecascio on September 27, 2012, 07:25:58 PM



Title: Question about transactions and blocks
Post by: joecascio on September 27, 2012, 07:25:58 PM
Transactions are incorporated into blocks, right? That means every transaction that is incorporated into a block will change the block's hash. So let's say a server has just an average speed processor which might take a week or more to generate a block. Does it stop incorporating transactions when it's begun a search for a conforming hash, or does it just keep throwing them in there and changing the nonce as well? Seems like it has to be the latter.

Can someone clear this up for me? Thanks!!


Title: Re: Question about transactions and blocks
Post by: jgarzik on September 27, 2012, 08:00:10 PM
Transactions are incorporated into blocks, right?

Yes.

Each transaction's hash is incorporated into a hash tree, whose root is stored in the block header.  Every new transaction changes that merkle root.

Quote
That means every transaction that is incorporated into a block will change the block's hash. So let's say a server has just an average speed processor which might take a week or more to generate a block. Does it stop incorporating transactions when it's begun a search for a conforming hash, or does it just keep throwing them in there and changing the nonce as well? Seems like it has to be the latter.

Remember that you don't "lose" any progress, or work, by hashing a different block header, with an updated merkle root.

The probability of finding a hash is the same either way.



Title: Re: Question about transactions and blocks
Post by: joecascio on September 27, 2012, 08:12:58 PM
Transactions are incorporated into blocks, right?

Yes.

Each transaction's hash is incorporate into a hash tree, whose root is stored in the block header.  Every new transaction changes that merkle root.

Quote
That means every transaction that is incorporated into a block will change the block's hash. So let's say a server has just an average speed processor which might take a week or more to generate a block. Does it stop incorporating transactions when it's begun a search for a conforming hash, or does it just keep throwing them in there and changing the nonce as well? Seems like it has to be the latter.

Remember that you don't "lose" any progress, or work, by hashing a different block header, with an updated merkle root.

The probability of finding a hash is the same either way.



Yes, same probability is what I figured, but thanks for verifying that.