Bitcoin Forum
May 11, 2024, 11:40:13 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: Mining protocol extension: noncerange  (Read 4524 times)
Luke-Jr (OP)
Legendary
*
expert
Offline Offline

Activity: 2576
Merit: 1186



View Profile
August 16, 2011, 04:23:26 AM
Last edit: August 17, 2011, 01:50:35 AM by Luke-Jr
 #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 :|

1715470813
Hero Member
*
Offline Offline

Posts: 1715470813

View Profile Personal Message (Offline)

Ignore
1715470813
Reply with quote  #2

1715470813
Report to moderator
1715470813
Hero Member
*
Offline Offline

Posts: 1715470813

View Profile Personal Message (Offline)

Ignore
1715470813
Reply with quote  #2

1715470813
Report to moderator
1715470813
Hero Member
*
Offline Offline

Posts: 1715470813

View Profile Personal Message (Offline)

Ignore
1715470813
Reply with quote  #2

1715470813
Report to moderator
"You Asked For Change, We Gave You Coins" -- casascius
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715470813
Hero Member
*
Offline Offline

Posts: 1715470813

View Profile Personal Message (Offline)

Ignore
1715470813
Reply with quote  #2

1715470813
Report to moderator
1715470813
Hero Member
*
Offline Offline

Posts: 1715470813

View Profile Personal Message (Offline)

Ignore
1715470813
Reply with quote  #2

1715470813
Report to moderator
1715470813
Hero Member
*
Offline Offline

Posts: 1715470813

View Profile Personal Message (Offline)

Ignore
1715470813
Reply with quote  #2

1715470813
Report to moderator
Luke-Jr (OP)
Legendary
*
expert
Offline Offline

Activity: 2576
Merit: 1186



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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!