0
I'm reading the example of the simple proof of work algorithm from here: https://www.oreilly.com/library/view/mastering-bitcoin/9781491902639/ch08.html#pow_example_outputs
In that example, the nonce always starts from ZERO and incrementally going to the max_nonce:
for nonce in xrange(max_nonce):
hash_result = hashlib.sha256(str(header)+str(nonce)).hexdigest()
# check if this is a valid result, below the target
if long(hash_result, 16) < target:
print "Success with nonce %d" % nonce
print "Hash is %s" % hash_result
return (hash_result,nonce)
In the real world of bitcoin mining, do you always start from the LAST NONCE and incrementally go up to find the correct HASH?
Because I don't see it makes sense if you start from ZERO again to solve the next math puzzle
> In this case coinbase input script data can be iterated to "expand" the nonce-range.
So
coinbase input script datais also similar vaclue to nonce? – Grady – 2019-01-22T02:13:32.2732@Grady everything is similar to the nonce. Every combination of transactions, mining payouts, nonce, timestamp, ... is an individual and independent attempt at solving the block. The nonce is simply the easiest thing to change to get a new try, but it is by no means the only one. – Pieter Wuille – 2019-01-22T07:45:29.730