Bitcoin Forum
November 17, 2024, 12:46:27 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: nonce values count & hashrate  (Read 648 times)
r0nin (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
August 26, 2012, 06:51:29 PM
 #1

Hi!
maximum value for unsigned 32 bit integer is 4 294 967 295. So in order to try all the values i need to calculate ~4.3 G of hashes. Then if I have 4.3 GH/s rig I would found it in a second. What I missed?
Jutarul
Donator
Legendary
*
Offline Offline

Activity: 994
Merit: 1000



View Profile
August 26, 2012, 07:02:40 PM
 #2

There are other fields which can be altered too. Timestamp, Coinbase....

The ASICMINER Project https://bitcointalk.org/index.php?topic=99497.0
"The way you solve things is by making it politically profitable for the wrong people to do the right thing.", Milton Friedman
r0nin (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
August 26, 2012, 07:21:13 PM
 #3

I don't see anything except nonce is incremented in this code. (CPU miner)

bool scanhash_c(int thr_id, const unsigned char *midstate, unsigned char *data,
           unsigned char *hash, const unsigned char *target,
           uint32_t max_nonce, unsigned long *hashes_done)
{
   uint32_t *hash32 = (uint32_t *) hash;
   uint32_t *nonce = (uint32_t *)(data + 12);
   uint32_t n = 0;
   unsigned long stat_ctr = 0;

   work_restart[thr_id].restart = 0;

   while (1) {
      unsigned char hash1[32];

      n++;
      *nonce = n;

      runhash(hash1, data, midstate);
      runhash(hash, hash1, sha256_init_state);

      stat_ctr++;

      if (unlikely((hash32[7] == 0) && fulltest(hash, target))) {
         *hashes_done = stat_ctr;
         return true;
      }

      if ((n >= max_nonce) || work_restart[thr_id].restart) {
         *hashes_done = stat_ctr;
         return false;
      }
   }
}
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
August 26, 2012, 07:24:18 PM
 #4

It isn't in that code.  The rest of the blockheader (midstate) is only incremented outside of that code.

Simple version.
1) Calculate all elements of blockheader (merkle root hash, timestamp, difficulty, version, prior block hash) except the nonce.
2) Pass those values to the miner
3) Increment through all 4 billion possible nonces.  Add the current nonce to the rest of blockhash and hash it.
4a) if share is found return it.
5) wait for new blockheader.
r0nin (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
August 26, 2012, 07:32:40 PM
 #5

Got it, thanks!
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!