Bitcoin Forum
December 10, 2016, 05:03:15 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: What is the block matched the request?  (Read 596 times)
lamuguo
Newbie
*
Offline Offline

Activity: 1


View Profile
May 31, 2011, 05:06:21 PM
 #1

The response of getwork request is:
data:00000001dfa9247a8ded0663ebb3b2ef9787044074ff42508190ef3a00001cc5000000000574128 7c1c19b9ecac6e56c6d20078da9e1ce40575900ad463ccc73ee71598c4de32f1e1a269421000000 0000000080000000000000000000000000000000000000000000000000000000000000000000000 0000000000080020000
hash1:0000000000000000000000000000000000000000000000000000000000000000000000800000000 0000000000000000000000000000000000000000000010000
target:0000000000000000000000000000000000000000000000219426000000000000
midstate:39f960097671413910bd7637b2f28c5c2231316e2b12d16f2f9be77a0f6c1df1

I can't find an answer by algorithm as below: (the algorithm is copied from gaeminer)

  public boolean scan(Work work, int start, int count) {
    SHA256 sha256 = new SHA256();

    int[] _data = decode(new int[16], work.getData().substring(128));
    int[] _midstate = decode(decode(new int[16], work.getHash1()), work.getMidstate());

    int[] __state, __data, __hash1, __hash;
    for (int nonce = start; nonce < start + count; nonce++) {
      _data[3] = nonce; // NONCE is _data[3]
      hashed++;
     
      if ((nonce & 0xFFFFF) == 13) {
        LOG.info("nonce = " + nonce);
      }

      __state = new int[_midstate.length];
      System.arraycopy(_midstate, 0, __state, 0, _midstate.length);
      __data = _data;

      sha256.processBlock(__state, __data);
      __hash1 = __state;

      __state = SHA256.initState();
      sha256.processBlock(__state, __hash1);
      __hash = __state;

      if (__hash[7] == 0) {
        work.setData(work.getData().substring(0, 128) + encode(__data));
        work.setNonce(nonce);
        return true;
      }
    }

    return false;
  }

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!