Bitcoin Forum
December 09, 2016, 06:01:38 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 [2]  All
  Print  
Author Topic: Mining protocol extension: noncerange  (Read 3807 times)
Luke-Jr
Legendary
*
expert
Offline Offline

Activity: 2100



View Profile
August 16, 2011, 04:23:26 AM
 #21

After pondering this problem further, I have come to the conclusion that despite its ugliness, this extension should follow the same behaviour of the other response data. That is, the nonces should be treated as little endian (as specified for mining hashes), but sent over the wire as big endian. That means unfortunately, a range from 0x10203040 to 0x50607080 is represented as "4030201080706050", and a winning nonce of 0x20304050 is sent in the solution as "50403020".

Edit: No idea what I was thinking last night. This is nonsense. Big endian means 0x10203040 is encoded "10203040" of course. I need to chat with a GPU miner author :|

Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481263298
Hero Member
*
Offline Offline

Posts: 1481263298

View Profile Personal Message (Offline)

Ignore
1481263298
Reply with quote  #2

1481263298
Report to moderator
1481263298
Hero Member
*
Offline Offline

Posts: 1481263298

View Profile Personal Message (Offline)

Ignore
1481263298
Reply with quote  #2

1481263298
Report to moderator
1481263298
Hero Member
*
Offline Offline

Posts: 1481263298

View Profile Personal Message (Offline)

Ignore
1481263298
Reply with quote  #2

1481263298
Report to moderator
Luke-Jr
Legendary
*
expert
Offline Offline

Activity: 2100



View Profile
August 24, 2011, 11:50:21 PM
 #22

Ok, this is really ugly, so hopefully JSON-RPC dies soon...

noncerange is provided to the miner in the usual big endian format: 100000001fffffff for all nonces from 0x10000000 to 0x1fffffff; this part is sane at least Smiley
However, since SHA256 processes in big-endian integers, while the rest of our block data is given in little-endian, this part gets hairy: the nonce will always come out in the opposite endian as the rest of the data. Since solutions are given as 32-bit big endian chunks, this means that in the solution, your nonce will be written as little endian. So for our example, dddddd1d is acceptable, and 1ddddddd is not.

On the bright side, this means you can do a simple iterative for loop from <nonce-start> to <nonce-end> and just plug the value into the nonce index in the SHA256 integer data regardless of what endian your platform is.

Pages: « 1 [2]  All
  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!