Bitcoin Forum
June 17, 2024, 01:59:14 AM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Block header hashing  (Read 438 times)
Mallet (OP)
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
June 05, 2013, 02:55:10 PM
 #1

Hi guys,
           I realize that in the mining process the block header is constantly hashed using  sha256  and if it generates a value less than the target then the block is created. However the wiki doesnt mention anything about adding transactions to the block. Lets say a solo miner finds such a block before anyone else does. Now how does bitcoin know what transactions to enter into the block when he submits his Json-rpc block found status?  Or does it do that automatically ?
Frizi
Newbie
*
Offline Offline

Activity: 14
Merit: 0


View Profile
June 05, 2013, 03:02:45 PM
 #2

The mined block header have a merkle root, which is a hash of all transactions in it. You can't simply change it, because the hash will change too. Until block is mined, it is easy to add transactions, because we can just change merkle root and continue hashing.
Mallet (OP)
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
June 05, 2013, 03:21:07 PM
 #3

Oh, so does that mean every time a transaction is added the merkle root changes? If so , then even if you find a valid block and a transaction comes in , is it ignored and put in the next mined block ?
caveden
Legendary
*
Offline Offline

Activity: 1106
Merit: 1004



View Profile
June 05, 2013, 03:25:22 PM
 #4

Yes. Once it's found, you broadcast it immediately. New transactions go to a new block.
J35st3r
Full Member
***
Offline Offline

Activity: 196
Merit: 100



View Profile
June 05, 2013, 03:55:35 PM
 #5

The mined block header have a merkle root, which is a hash of all transactions in it. You can't simply change it, because the hash will change too. Until block is mined, it is easy to add transactions, because we can just change merkle root and continue hashing.

Hmm, I'm not convinced about this. The block hash is a search with a chance of 1 / (difficulty * 4294967296) success per operation. So if you throw away the block and start again you're just wasting effort. Or is this the fallacy of sunk cost?. Genuinely interested. My logic has been challenged once already since I escaped noobie land, so I'm open to education

1Jest66T6Jw1gSVpvYpYLXR6qgnch6QYU1 NumberOfTheBeast ... go on, give it a try Grin
DannyHamilton
Legendary
*
Offline Offline

Activity: 3430
Merit: 4660



View Profile
June 05, 2013, 04:17:24 PM
 #6

The mined block header have a merkle root, which is a hash of all transactions in it. You can't simply change it, because the hash will change too. Until block is mined, it is easy to add transactions, because we can just change merkle root and continue hashing.

Hmm, I'm not convinced about this. The block hash is a search with a chance of 1 / (difficulty * 4294967296) success per operation. So if you throw away the block and start again you're just wasting effort. Or is this the fallacy of sunk cost?. Genuinely interested. My logic has been challenged once already since I escaped noobie land, so I'm open to education

Rolling a 1 on a die is search with a chance of 1 / 6 success per roll.  If you roll the die and get something other than a 6, then pick the die up and roll again, are your chances any better or worse?  Are you just wasting effort?

Every attempt to "solve" a block involves changing the data in the block header (by incrementing a nonce).  Why is it any different to change the merkle root instead of the nonce?
caveden
Legendary
*
Offline Offline

Activity: 1106
Merit: 1004



View Profile
June 05, 2013, 04:29:28 PM
 #7

As DannyHamilton said. It's not a "continuous work" that gets closer from being finished with time. It's more like playing on the lottery, billions of times per second. By a simple matter of probability, eventually you'll hit the jackpot. Smiley
lbr
Sr. Member
****
Offline Offline

Activity: 423
Merit: 254


View Profile
June 05, 2013, 04:34:10 PM
 #8

By a simple matter of probability, eventually you'll hit the jackpot. Smiley
http://en.wikipedia.org/wiki/Gambler's_fallacy

BTC: 18ozhbkfHneX8tnPgHJuTizyBmspM5Vgpa  LTC: LgVc7KdedPGZyDXHXEH9G7z6AoTmTvDdWb
cgminer 2.11.13 x64 portable for Mac OS X 10.6.8
6+ GPUs driver mod for Windows
J35st3r
Full Member
***
Offline Offline

Activity: 196
Merit: 100



View Profile
June 05, 2013, 04:39:01 PM
 #9

Yes, of course. Thanks for that explanation, I should have known better.

Statistics can be a little counter intuitive and the sunk cost fallacy seems engrained in the human psyche. Perhaps it has some evolutionary advantage, or maybe its just tagging on for the ride through life's slings and arrows ...

1Jest66T6Jw1gSVpvYpYLXR6qgnch6QYU1 NumberOfTheBeast ... go on, give it a try Grin
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!