Bitcoin Forum
December 08, 2016, 04:32:01 AM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: miner logic questions  (Read 556 times)
botnet
Jr. Member
*
Offline Offline

Activity: 35


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.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481171521
Hero Member
*
Offline Offline

Posts: 1481171521

View Profile Personal Message (Offline)

Ignore
1481171521
Reply with quote  #2

1481171521
Report to moderator
1481171521
Hero Member
*
Offline Offline

Posts: 1481171521

View Profile Personal Message (Offline)

Ignore
1481171521
Reply with quote  #2

1481171521
Report to moderator
1481171521
Hero Member
*
Offline Offline

Posts: 1481171521

View Profile Personal Message (Offline)

Ignore
1481171521
Reply with quote  #2

1481171521
Report to moderator
botnet
Jr. Member
*
Offline Offline

Activity: 35


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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!