Bitcoin Forum
April 26, 2024, 06:30:50 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Why not reuse?  (Read 1433 times)
bravetheheat (OP)
Sr. Member
****
Offline Offline

Activity: 457
Merit: 251


View Profile
January 30, 2012, 06:02:18 AM
 #1

Hi all!

It seems to me that this might be a rather stupid question, so if it is, please forgive my 'insolence' or incapability of answering this question myself.
Is it possible to 'reuse' a previously generated hash? An example would be a miner that would do as it would until it finds a solution for the particular work. It would then save that hash in its memory and attempt to reuse it as a solution for the next work. If it doesn't meet the requirements, the miner would then continue on hashing until it found another suitable hash, which would then be stored and used again, continuing the cycle.

The wiki articles don't really seem to touch upon this issue, since all they say is that as long as it is underneath the target, it would be fine.

EDIT: Okay, it seems like the wiki 'indirectly' answers this question. If it actually does not, then feel free to answer it. Otherwise, close this? I find the description of the nonce value somewhat confusing, however...
"Governments are good at cutting off the heads of a centrally controlled networks like Napster, but pure P2P networks like Gnutella and Tor seem to be holding their own." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714113050
Hero Member
*
Offline Offline

Posts: 1714113050

View Profile Personal Message (Offline)

Ignore
1714113050
Reply with quote  #2

1714113050
Report to moderator
1714113050
Hero Member
*
Offline Offline

Posts: 1714113050

View Profile Personal Message (Offline)

Ignore
1714113050
Reply with quote  #2

1714113050
Report to moderator
1714113050
Hero Member
*
Offline Offline

Posts: 1714113050

View Profile Personal Message (Offline)

Ignore
1714113050
Reply with quote  #2

1714113050
Report to moderator
BurtW
Legendary
*
Offline Offline

Activity: 2646
Merit: 1130

All paid signature campaigns should be banned.


View Profile WWW
January 30, 2012, 06:05:00 AM
 #2

I think the block hash has to be under the target and the block itself must be valid.  Isn't your saved block full of a bunch of old transactions?  Hasn't everyone else moved on to the next block?  Your saved block is rejected by the rest of the network.

Edit: after reading your post again I think your disconnect is even more fundamental.  What do you think a hash is?  Do you realized what exactly is being hashed when you generate the hash?

Our family was terrorized by Homeland Security.  Read all about it here:  http://www.jmwagner.com/ and http://www.burtw.com/  Any donations to help us recover from the $300,000 in legal fees and forced donations to the Federal Asset Forfeiture slush fund are greatly appreciated!
bravetheheat (OP)
Sr. Member
****
Offline Offline

Activity: 457
Merit: 251


View Profile
January 30, 2012, 06:08:20 AM
 #3

I didn't mean that you would save the block, just the hash. *Forgive and correct me if I'm not making any sense >.<*

And what about for mining shares, instead?
bravetheheat (OP)
Sr. Member
****
Offline Offline

Activity: 457
Merit: 251


View Profile
January 30, 2012, 06:09:42 AM
 #4

Quote
Edit: after reading your post again I think your disconnect is even more fundamental.  What do you think a hash is?  Do you realized what exactly is being hashed when you generate the hash?

Unfortunately, I do not know what exactly is being hashed. Is it in the wiki? (because I can't seem to find it.)

EDIT: Is it the block's header?
DiThi
Full Member
***
Offline Offline

Activity: 156
Merit: 100

Firstbits: 1dithi


View Profile
January 30, 2012, 06:14:13 AM
 #5

You hash exactly the 80 bytes of the header, but it includes:
  • The hash of the previous block.
  • The hash of all transactions in the block (or more specifically, the the root hash of a merkle tree of the transactions).

It makes no sense to save it: the previous block is always different and the more you wait, the longer the chain will be.

1DiThiTXZpNmmoGF2dTfSku3EWGsWHCjwt
BurtW
Legendary
*
Offline Offline

Activity: 2646
Merit: 1130

All paid signature campaigns should be banned.


View Profile WWW
January 30, 2012, 06:14:52 AM
 #6

OK here you go the value of the hash is a function of the data in the block.  It is a very fancy checksum of a block of data, in this case the current block of transactions.  A hash is designed so that given all the data in the block anyone and everyone can calculate the same number (the hash).  So if you calculate the hash of the block you get a number, it you calculate it again you get the same number - but we want the hash to change every time we calculate it so we can hopefully, by random chance, find one that matches the current difficulty requirement.

That is where the nonce come in.  If I hash alll the transactions plus the nonce I get a number, then I increment the nonce and hash again I get a totally different answer for the hash value so the algorithm is:

Hash the data + nonce
Check the answer, if it meets the difficulty critera then done
Otherwise increment the nonce and go to step 1

Our family was terrorized by Homeland Security.  Read all about it here:  http://www.jmwagner.com/ and http://www.burtw.com/  Any donations to help us recover from the $300,000 in legal fees and forced donations to the Federal Asset Forfeiture slush fund are greatly appreciated!
DiThi
Full Member
***
Offline Offline

Activity: 156
Merit: 100

Firstbits: 1dithi


View Profile
January 30, 2012, 06:18:08 AM
 #7

Hash the data + nonce
Check the answer, if it meets the difficulty critera then done
Otherwise increment the nonce and go to step 1

It's probable you won't find a block after trying all posible nonce values. When this happens, you modify something in the transactions (so the hash differs) and start again. That "something" it's usually called "ExtraNonce", a random number placed in the coinbase.

1DiThiTXZpNmmoGF2dTfSku3EWGsWHCjwt
bravetheheat (OP)
Sr. Member
****
Offline Offline

Activity: 457
Merit: 251


View Profile
January 30, 2012, 06:19:12 AM
 #8

Ahh... thanks! I finally understand now  Grin
BurtW
Legendary
*
Offline Offline

Activity: 2646
Merit: 1130

All paid signature campaigns should be banned.


View Profile WWW
January 30, 2012, 06:21:30 AM
 #9

Hash the data + nonce
Check the answer, if it meets the difficulty critera then done
Otherwise increment the nonce and go to step 1

It's probable you won't find a block after trying all posible nonce values. When this happens, you modify something in the transactions (so the hash differs) and start again. That "something" it's usually called "ExtraNonce", a random number placed in the coinbase.

Details, details.  Anyway I think he is back on track now.

Our family was terrorized by Homeland Security.  Read all about it here:  http://www.jmwagner.com/ and http://www.burtw.com/  Any donations to help us recover from the $300,000 in legal fees and forced donations to the Federal Asset Forfeiture slush fund are greatly appreciated!
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!