Bitcoin Forum
June 19, 2024, 03:58:21 PM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Where does the guessing of nonce begin?  (Read 1032 times)
sunszl (OP)
Newbie
*
Offline Offline

Activity: 8
Merit: 0


View Profile
February 19, 2014, 01:23:58 AM
 #1

In btc mining, miners should guess a nonce that produce the right hash.
I just want to know the way of guessing.( in btc-wallet or in cgminer).
Does it begin with 0 and continue the increment(+1).
Does it just initial a random number and randomly change it.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3430
Merit: 4669



View Profile
February 19, 2014, 02:35:20 AM
 #2

In btc mining, miners should guess a nonce that produce the right hash.
I just want to know the way of guessing.( in btc-wallet or in cgminer).
Does it begin with 0 and continue the increment(+1).

If I was writing a mining program, that's how I'd do it.  There really isn't any benefit that I can think of for starting at any other number.

Does it just initial a random number and randomly change it.

That would work, but I don't see why you'd do it that way.  Then you'd have to keep track of all the random numbers that you already tried so that you wouldn't waste time trying them again.
corebob
Full Member
***
Offline Offline

Activity: 238
Merit: 100


View Profile
February 19, 2014, 02:39:54 AM
 #3

Also, you typically want to do hashing in parallel using multiple threads, and that would be hard to do efficiently by selecting random nonces.
As far as I know, any number is as good as any other number so you might as well use a simple counter and do it sequentially.
franky1
Legendary
*
Online Online

Activity: 4256
Merit: 4532



View Profile
February 19, 2014, 03:26:41 AM
Last edit: February 19, 2014, 05:46:42 AM by franky1
 #4

i think, yes i said think (not sure) that pools spread out the randomness.

eg lets pretend the nonse is a hash of a random number between 1-1billion
instead of all miners starting at 1. they would (or atleast should) tell:
miner A to start at 0 and work to 1million
miner B to start at 1million and 1 and work to 2million
and so on for 1000 miners
that way a block gets solved 1000 times faster then all miners singularly mining from 1-1billion

and if im wrong. then this is how i would program a mining pool

(i know its a bunch of letters and numbers, not just numbers, so replace miner A 0-1mill as a0 to a9blah and miner B as b0 to b9blah(you get the idea))
Edit: i guess it was just numbers then

I DO NOT TRADE OR ACT AS ESCROW ON THIS FORUM EVER.
Please do your own research & respect what is written here as both opinion & information gleaned from experience. many people replying with insults but no on-topic content substance, automatically are 'facepalmed' and yawned at
DannyHamilton
Legendary
*
Offline Offline

Activity: 3430
Merit: 4669



View Profile
February 19, 2014, 03:38:23 AM
 #5

i think, yes i said think (not sure) that pools spread out the randomness.

eg lets pretend the nonse is a hash of a random number between 1-1billion

In Bitcoin, the nonce is always a number between 1 and 4,294,967,295 (maximum 32 bit unsigned integer)

instead of all miners starting at 1. they would (or atleast should) tell:
miner A to start at 0 and work to 1million
miner B to start at 1million and 1 and work to 2million
and so on for 1000 miners
that way a block gets solved 1000 times faster then all miners singularly mining from 1-1billion

and if im wrong. then this is how i would program a mining pool

(i know its a bunch of letters and numbers, not just numbers, so replace miner A 0-1mill as a0 to a9blah and miner B as b0 to b9blah(you get the idea))

No, the nonce is just a number.  Any ASIC capable of more than 4GH/s can try all 4,294,967,295 possibilities in a fraction of a second.  Most block headers have no possible solution.  Instead of each miner being assigned a different nonce to start from, each miner receives a different set of block headers to attempt to solve.

Each miner attempts all possible nonces for the blockheaders that they are assigned, and if they don't find any solutions, then they request another set of headers to work on.
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!