Bitcoin Forum
June 19, 2018, 02:43:30 PM *
News: Latest stable version of Bitcoin Core: 0.16.1  [Torrent]. (New!)
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: miner logic questions  (Read 636 times)
botnet
Jr. Member
*
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.
Automated Bitcoin Fork Extraction Tool WE DO TOUGH WALLETS: BCH | BTG | BCD | SBTC | UBTC | B2X | BCX | BTF Electrum 2FA, Trezor, Ledger, SegWit, Bech32
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
botnet
Jr. Member
*
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:  

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!