Author

Topic: What a miner does? (Read 1249 times)

legendary
Activity: 1072
Merit: 1181
June 03, 2011, 07:39:03 PM
#8
Miners typically do not modify the timestamp - they just use the timestamp in the block, as received by the getwork call.
hero member
Activity: 590
Merit: 500
June 03, 2011, 05:54:58 PM
#7
What is "ModifyNonce(blockheader, nonce)"?

sticks the incremented nonce into the block header, replacing the previously tried one.

I'm a total noob at this but, if I didn't misunderstand this, the current timestamp is also took into account. Else, a given block could be unsolvable if it happens that none of the 2**32 nonces result in a hash less than the target.

Yes, there would need to be a ModifyTimestamp(blockheaders, timestamp) step, but whenever the nonce overflows, the ExtraNonce part of the generation transaction gets incremented.
legendary
Activity: 1974
Merit: 1029
June 03, 2011, 03:25:13 PM
#6
What is "ModifyNonce(blockheader, nonce)"?

sticks the incremented nonce into the block header, replacing the previously tried one.

I'm a total noob at this but, if I didn't misunderstand this, the current timestamp is also took into account. Else, a given block could be unsolvable if it happens that none of the 2**32 nonces result in a hash less than the target.
hero member
Activity: 590
Merit: 500
June 03, 2011, 01:36:32 PM
#5
What is "ModifyNonce(blockheader, nonce)"?

sticks the incremented nonce into the block header, replacing the previously tried one.
newbie
Activity: 51
Merit: 0
June 03, 2011, 01:24:11 PM
#4
What is "ModifyNonce(blockheader, nonce)"?
hero member
Activity: 590
Merit: 500
June 03, 2011, 12:17:15 PM
#3

loop:
  var blockheader = DoGetWorkRPCCall()
  var target = ExtractTarget(blockheader)
  for nonce in 0..4294967295:
    var attempt = ModifyNonce(blockheader, nonce)
    var hash = SHA256(SHA256(attempt))
    if (hash < target)
      ReportSolution(attempt)



i believe should be (hash <= target)

otherwise, looks right to me.
legendary
Activity: 1072
Merit: 1181
June 03, 2011, 11:43:05 AM
#2

loop:
  var blockheader = DoGetWorkRPCCall()
  var target = ExtractTarget(blockheader)
  for nonce in 0..4294967295:
    var attempt = ModifyNonce(blockheader, nonce)
    var hash = SHA256(SHA256(attempt))
    if (hash < target)
      ReportSolution(attempt)

newbie
Activity: 51
Merit: 0
June 03, 2011, 11:07:57 AM
#1
Just to understand the process, what a miner does? Hash the block header (https://en.bitcoin.it/wiki/Block_hashing_algorithm)? Someone has a pseudo-code for that? I have looked inside m0mchil-poclbm and jsMiner.js... It was confusing for me...
 Cry
Jump to: