Bitcoin Forum
May 10, 2024, 07:44:00 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: miner logic questions  (Read 737 times)
botnet (OP)
Newbie
*
Offline Offline

Activity: 35
Merit: 0


View Profile
June 14, 2011, 07:45:08 PM
 #1

As I've read, a basic miner does this:

      var blockheader = DoGetWorkRPCCall();
      var target = ExtractTarget(blockheader);

      for(nonce = 0; nonce < 4294967295; nonce++)
      {
         var attempt = ModifyNonce(blockheader, nonce);
         var hash = SHA256(SHA256(attempt));
         if (hash < target)
            ReportSolution(attempt);
      }


1) Are there really multiple solutions?  Should that instead read:

         if (hash < target)
         {
            ReportSolution(attempt);
            break;
         }

2) if(hash < target) - I can't figure out where GPU miners do this.   They all seem to add some magic constant to the uper 32 bits, and then check if that == 0.  Isn't that just an approximation of "< target" ? Won't that result in some incorrect solutions being reported?

3) From http://blog.ezyang.com/2011/06/the-cryptography-of-bitcoin/the computationally hard problem is essentially a watered-down version of the first-preimage attack on a hash function. Miners are given a set of solution hashes (the hash of all zeros to a target hash), and are required to find a message with particular structure (a chain of blocks plus a nonce) that hashes to one of these hashes.   
Is this accurate?  In the above code,  does DoGetWorkRPCCall get a single solution hash?  What exactly does "hash of all zeros to a target hash" mean? 

Thanks for any help clarifying, this is a great community.
1715370240
Hero Member
*
Offline Offline

Posts: 1715370240

View Profile Personal Message (Offline)

Ignore
1715370240
Reply with quote  #2

1715370240
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
botnet (OP)
Newbie
*
Offline Offline

Activity: 35
Merit: 0


View Profile
June 14, 2011, 11:47:25 PM
 #2

(is there any chance this could move to the development/technical section?)
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!