Puzzle generation


Nonce deLeon asked 2 weeks ago

I have had this question for years and have asked people involved, none of which know; nor do occasional Google searches help.
~
I see phrases here like “the Bitcoin network wants to keep the time between blocks created in the blockchain constant”
How can it “want”? Where does this adjustment/control come from?
And who/what generates the hash?
Where did the algorithm, that is used for solving, initially come from?
How do the instructions enter the network that make the changes in rewards, etc.?

There seem to be several components that need to be generated somehow in the BtC process, for mining to occur. We describe them as “puzzles for solving”, but they have to be generated somehow; and the number of coins rewarded is changed; and the time factor is being adjusted…
The answer I often get is “it comes with the header”, which raises the question who/what generates the header?

1 Answers
Steven Hay answered 2 weeks ago

Hi Nonce deLeon,
 
The Bitcoin network can’t “want” anything, rather it’s been designed such that the average time between blocks remains steady at 10 minutes. The key element missing from your understanding is Difficulty. Every 2 weeks (or more precisely, every 2016 blocks which at 10 minutes per block should equal 2 weeks) this Difficulty value is adjusted up or down by Bitcoin’s code. If the 2016 blocks have taken less than 2 weeks to produce, it means hashrate has increased so Difficulty is adjusted upwards, proportional to the time mismatch. If the 2016 blocks have taken longer to produce, the reverse occurs.
 
So what is Difficulty? Basically, it’s the number of leading 0s which miners have to produce as part of a valid hash solution. It’s a lot easier to find a solution with 4 leading zeros than it is with 5 – just like it’s easier to flip a coin so it lands heads 4 times in a row than 5 times. The higher the Difficulty, the more flips or hashes miners have to perform (on average) to find a valid solution, so it takes them longer or shorter depending on the Difficulty Adjustment. In this way, that 10 minute goal time can be maintained, however much mining power is directed at Bitcoin.
 
Hope it’s clear from that answer that it’s miners who generate the hash attempts and solutions. The hash algorithm, which determines the format of miners work, was implemented by Satoshi. This hashing algo is known as SHA-256.
 
As for how the instructions enter the network, I’m not quite sure what you mean… Information from the last mined block must be included as part of the miner’s solution to the current block they’re trying to solve. This is what “chains” all the blocks together. There’s no puzzle generation going on beyond the requirement that any miner’s hash solution of all the transaction and other info they put into their block must meet the current Difficulty standard.

Bitcoin Video Crash Course 

Join over 94,000 students and know all you need to know about Bitcoin. One email a day for 7 days, short and educational, guaranteed.

We hate spam as much as you do. You can unsubscribe with one click.