Bitcoin Forum
November 18, 2024, 11:09:32 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Question about how the pool servers operate..  (Read 790 times)
oatmo (OP)
Member
**
Offline Offline

Activity: 104
Merit: 10


View Profile
June 17, 2013, 09:10:52 PM
 #1

Pardon the noob question, but I searched a lot and couldn't find a technical description of how these things work. If there is a description somewhere that I didn't find, please point me to it and pardon the annoyance.

I'm curious the pseudo loop for pool mining (or I guess solo mining in general).

Is this sort of correct:

Pool server

  1. Collect transactions
  2. Make a block (which includes your address for the 25 bitcoin bonus)
  3. Start hashing
      SHA256(SHA256 (your constructed block + incrementing nonce))
  4. If you didn't find a valid hash, then go back to 1.

Couple questions:

Is the nonce a 32-bit value? If so, then it seems like any mining pool with >4GH/s is going go to go through these pretty quick..

Since you SHA the entire block, I assume that the mining clients store the SHA results for the block upto the last one where the nonce is added, then just do the final SHA repeatedly.

Thanks for the info. I'm looking at how mining hardware is designed, and what makes sense to accelerate and what doesn't.

Oatmo
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4851



View Profile
June 20, 2013, 07:15:31 PM
 #2

Couple questions:

Is the nonce a 32-bit value?

Yes.

If so, then it seems like any mining pool with >4GH/s is going go to go through these pretty quick..

Yes.

Since you SHA the entire block,

No. Just the 80 bytes of the block header.

I assume that the mining clients store the SHA results for the block upto the last one where the nonce is added, then just do the final SHA repeatedly.

I'm not sure what you are assuming here.  I believe there are some SHA shortcuts that mining software takes advantage of, but I'm not certain that what you are trying to describe would be such a shortcut.

Thanks for the info. I'm looking at how mining hardware is designed, and what makes sense to accelerate and what doesn't.

Oatmo
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4851



View Profile
June 20, 2013, 07:27:44 PM
 #3

On further consideration, I'm wondering if when you say "you SHA the entire block", you're perhaps referring to building the Merkle Root?

In that case, yes, you would not rebuild the merkle root every time.  You'd build it once, then use it to build the header, then begin the loop of:

  • SHA(SHA(blockheader))
  • Compare result to difficulty
  • Increment nonce value in header
  • REPEAT

If you've gotten through all the possible nonces and you haven't yet received a new transaction to add to the block, you need some other way to modify the header.

Most mining software handles this by adjusting the timestamp in the blockheader.

If your mining hardware is fast enough (and/or your pool is big enough), you can run into the situation where you haven't received any new transactions that you want to include AND you are unable to adjust the timestamp any further (the protocol has limitations on how much the next timestamp is allowed to vary).

In this case, you now have to modify your merkle root.  You can keep track of the merkle root building hash that occured prior to the one that is in the blockheader, and then all you have to do is change the arbitrary data in the input of the coinbase transaction (generally called extranonce), finish off the merkle root and return to the loop above with timestamp adjustments again as well.
oatmo (OP)
Member
**
Offline Offline

Activity: 104
Merit: 10


View Profile
June 21, 2013, 07:16:11 PM
 #4

Ahhh, I understand..

So I assume that the block header has a hash of the rest of the stuff in the block (just like IPsec an every other secure protocol).

I was just trying to figure out how all the stuff in the block is covered. The POW covers the header, and the header covers the data in the block.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4851



View Profile
June 21, 2013, 07:44:07 PM
 #5

Ahhh, I understand..

So I assume that the block header has a hash of the rest of the stuff in the block (just like IPsec an every other secure protocol).

I was just trying to figure out how all the stuff in the block is covered. The POW covers the header, and the header covers the data in the block.

Other than the header, the only other thing in the block is the transaction list.

A Merkle Tree is built for the transaction list, and the value of the Merkle Root is placed in the header.  If any value in the transaction list changes, it changes the Merkle Root, so the contents of the transaction list can be verified by building the Merkle Tree, and comparing the resulting Merkle Root to the Merkle Root in the header.
leijurv
Member
**
Offline Offline

Activity: 63
Merit: 10


Vires in Numeris


View Profile WWW
June 22, 2013, 01:35:41 AM
 #6

That's a good point. 2^32 is 4,294,967,296, so what happens if a pool with 4GH/s go through all possible nonces and none of the corresponding hashes are below the target?

Firstbits 1Leijurv. Or, if you like cats, Firstbits 1Kittens and 1catcat as well. If you're a chemist, also 1Helium, 1Erbium, 1Copper, 1Cerium, and 1Nickel. If you like numbers, 123four, 12234,  12three.
Keybase and onename user: leijurv.
nimda
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1000


0xFB0D8D1534241423


View Profile
June 22, 2013, 01:38:37 AM
 #7

That's a good point. 2^32 is 4,294,967,296, so what happens if a pool with 4GH/s go through all possible nonces and none of the corresponding hashes are below the target?
You update the timestamp
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4851



View Profile
June 22, 2013, 03:31:58 AM
 #8

That's a good point. 2^32 is 4,294,967,296, so what happens if a pool with 4GH/s go through all possible nonces and none of the corresponding hashes are below the target?

It happens constantly all day long.

- snip -
Most mining software handles this by adjusting the timestamp in the blockheader.

If your mining hardware is fast enough (and/or your pool is big enough), you can run into the situation where you haven't received any new transactions that you want to include AND you are unable to adjust the timestamp any further (the protocol has limitations on how much the next timestamp is allowed to vary).

In this case, you now have to modify your merkle root.  You can keep track of the merkle root building hash that occured prior to the one that is in the blockheader, and then all you have to do is change the arbitrary data in the input of the coinbase transaction (generally called extranonce), finish off the merkle root and return to the loop above with timestamp adjustments again as well.
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!