Bitcoin Forum

Other => Beginners & Help => Topic started by: Yabes on May 08, 2019, 02:56:23 AM



Title: About Hash of Block...
Post by: Yabes on May 08, 2019, 02:56:23 AM
Hello Im newbie, I've read bitcoinbook ch03. may I not read as well because i could not read for english language as good.
But I want to know, Why those block set up for "hash : bestblock" must be computing for 0000000000000hash.

Thankyou for sharing.  :D

Thankyou @pooya87 . I'll keep open this thread for a while, may a few ppl want asking or want to sharing about Hash of Block..


Title: Re: About Hash of Block...
Post by: pooya87 on May 08, 2019, 03:56:17 AM
that is to add a difficulty to find the right hash of a block and create the algorithm known as Proof of Work.

result of a hash function is unpredictable and when you change a byte the result chances completely. so lets say you have a message (the 80 byte block header) like A|B|C|D|E|F and want to hash it so that you get a certain result. in this case a result that has n zeros in it, you first hash the message and get some result. if it satisfied your condition, you accept it. if it didn't you change what you are allowed to change (nonce in header) and hash it again. so your message is now A|B|C|D|E|G and you will get an entirely different result. check again, change again,....
you repeat this until you satisfy that condition.

now to find a hash result that has 1 zero is easy, 2 zeros is harder,... and the more zeros it requires the harder finding the hash is going to be. and hard in this context means it requires more "work" by your hardware because now it has to change and check things a lot more.
by this design bitcoin introduces something known as "difficulty" which readjusts based on hashrate and keeps the time between blocks around 10 minute. (more precisely: 2016 blocks every 2 weeks)


Title: Re: About Hash of Block...
Post by: Yabes on May 08, 2019, 04:04:11 AM
that is to add a difficulty to find the right hash of a block and create the algorithm known as Proof of Work.

result of a hash function is unpredictable and when you change a byte the result chances completely. so lets say you have a message (the 80 byte block header) like A|B|C|D|E|F and want to hash it so that you get a certain result. in this case a result that has n zeros in it, you first hash the message and get some result. if it satisfied your condition, you accept it. if it didn't you change what you are allowed to change (nonce in header) and hash it again. so your message is now A|B|C|D|E|G and you will get an entirely different result. check again, change again,....
you repeat this until you satisfy that condition.

now to find a hash result that has 1 zero is easy, 2 zeros is harder,... and the more zeros it requires the harder finding the hash is going to be. and hard in this context means it requires more "work" by your hardware because now it has to change and check things a lot more.
by this design bitcoin introduces something known as "difficulty" which readjusts based on hashrate and keeps the time between blocks around 10 minute. (more precisely: 2016 blocks every 2 weeks)
Thankyou for sharing, But There is guarantee for 1 block each 10minute able to reach "Besthashblock" ? I mean there is happend the biggest number "nonce number so far" ?


Title: Re: About Hash of Block...
Post by: mikeywith on May 08, 2019, 04:18:06 AM
Thankyou for sharing, But There is guarantee for 1 block each 10minute able to reach "Besthashblock" ? I mean there is happend the biggest number "nonce number so far" ?

There is no guarantee for a block to be "solved" every 10 mins, in fact you will have a hard time trying to find a block that took exactly 10 mins to be solved, the algorithm "tries" to make it so, and in the long run when you take a good amount of data , the average will be close to 10 mins.

imagine you have 5 students, you ask them questions and want to ensure they need 10 mins to solve the question, when they answer in 5 mins, you will multiply the difficulty of the question by 2 to make them consume 10 mins, then maybe 1 student leaves, and the 4 of the need 15 mins to answer, you know it's too difficult for them, so you reduce the difficulty of the question by 1/3 to make them consume 10 mins, but then another 2 students join and they solve it in 3 mins , so on and so forth.

that's not exactly how the difficulty of bitcoin adjusts , but the concept is the same.


Title: Re: About Hash of Block...
Post by: pooya87 on May 08, 2019, 04:23:57 AM
i mentioned 10 minute because it is what it boils down to and is the time between each block on "average". but that is not what sets the difficulty, as i said in the parenthesis, the actual thing that is measured and then is used to adjust the difficulty is the 2 week rule. basically every 2016 blocks we check to see if it took more than 2 weeks or less. if it was more then the difficulty is reduced so that next period we can find 2016 blocks in 2 weeks and if it was less then the difficulty will increase to achieve that.


Title: Re: About Hash of Block...
Post by: bitmover on May 08, 2019, 01:08:16 PM
There is no guarantee for a block to be "solved" every 10 mins, in fact you will have a hard time trying to find a block that took exactly 10 mins to be solved, the algorithm "tries" to make it so, and in the long run when you take a good amount of data , the average will be close to 10 mins.

imagine you have 5 students, you ask them questions and want to ensure they need 10 mins to solve the question, when they answer in 5 mins, you will multiply the difficulty of the question by 2 to make them consume 10 mins, then maybe 1 student leaves, and the 4 of the need 15 mins to answer, you know it's too difficult for them, so you reduce the difficulty of the question by 1/3 to make them consume 10 mins, but then another 2 students join and they solve it in 3 mins , so on and so forth.

that's not exactly how the difficulty of bitcoin adjusts , but the concept is the same.

Statistically, blocks are solved every 10 minutes because the difficult is adjusted every 2016 blocks according to the network hash rate.
Itīs not very precise, but every 2016 blocks, the average time of each block will be 10 minutes.

As there are not only 5 miners, but thousands, there is less variation than in your example.

More detail here: https://en.bitcoin.it/wiki/Difficulty
And here https://bitcointalk.org/index.php?topic=3317586.0


Title: Re: About Hash of Block...
Post by: DdmrDdmr on May 08, 2019, 02:24:16 PM
This site is pretty interesting: https://data.bitcoinity.org/bitcoin/block_time/30d?f=m10&t=l

There you can play around with the timeframe and get the evolution of different blockchain aspects such as time between blocks, hashrate, mining difficulty, blocksize, number of transactions, aside from some relevant BTC market stats.


Title: Re: About Hash of Block...
Post by: mu_enrico on May 09, 2019, 03:48:27 AM
I think we could illustrate this topic using HI-LO / roll / dice game. For this example, let's assume:
- The number space is only 0-10000 decimals;
- The system gives you a specific target number of 100 to win this game;
- You win if you can produce number 00000 - 00100 (lower or equal than target).

Mining is similar (for this illustration purpose) to hit the roll button. Therefore you have the winning chance of 100/10000 (1%).

The higher the difficulty means the lower the target value. Let's say the target changed to 10. You need to produce 00000-00010 to win (0.1%). So a lot of leading zeros is a logical consequence of a very small number from a huge number space.