Ep. 16 [Block-creation] Bitcoin Hash Function.

in #bitcoin7 years ago (edited)

Note
Gain a fundamental understanding of Cryptocurrency in an easy way. Before continue reading the story, I recommend to take a couple of minutes and read through the prior article again in order to refresh your present knowledge. The more often you read through the stories, the more confident you will get with the technology behind cryptocurrencies like Bitcoin. Take your time, to understand cryptocurrencies, as a Steemian it's worth it. The pictures are drawn by @RatzFratz, thanks for that!
If something in the story is not clear to you, don’t hesitate to ask. There are several people who might have the same question. So shoot me a comment, if something is unclear. Me and other readers will appreciate it!


So in the last episode we were talking about the components of a block.



14.1 .png

Now I want to talk more detailed about some of the components of a block-header. Lets start with the individual "block-number" of a block:










In a prior episode we said:



“A block is identified by its individual block-number…”



How is this block-number determined?

Well the block-number is actually the hash of all the content of the block-header.

So what is a hash?

A hash ‘h' is the outcome of a hash function ‘H’ in which some input was thrown in. A hash function is a special mathematical function with input and output.

In our case, the input is our block-header and the output of this input through the hash function “H” is its hash(=block-number).





There are no “rules” for the input. The input can be any number, data-file etc. (for example our block-header).
Depending on the Cryptographic Hash Algorithm you are using, the output has a determined format. The Bitcoin-Network uses the “SHA-256” algorithm. What is important to know here, is that the output of a SHA-256 Algorithm is always a string consisting of 256bits. In other words a number which consists only of 1’s and 0’s (base 2) and has a length of 256. Another format of a 256 binary number is for example a hexadecimal number(0-9, a-f) which consists of 64 digits (each hexadecimal digit can be displayed with 4 bits --> 64 x 4 = 256).


There are some more specifications regarding the hash:

  • The same input will always give you the same hash.
  • If you change the input only a little bit, the output will be completely different and random.
  • That means, you can not cause a specific hash(=output) by choosing a specific input. It is random.
  • Thus you can not find out the input by studying the output, as it is random.



  • Sum-up:


  • The individual block-number is the hash(=output) of the block-header(=input) put into the SHA-256 algorithm(=Cryptographic Hash Function).
  • Sort:  

    Well done, this is absolutely splendid. Was this all done by you? Your content is definitely underated.

    I'm giving you a tio in SmartCash, one of fav cryptocurrencies. ;-). Keep up the good work!

    Σ$$$ Tipped @manonlescaut Σ10 SMART! Comment @smartbot help to claim. Currently the price of SmartCash in the market is $1.016 USD per SMART. Current value of the tip is $10.16 USD. To find out more about SmartCash, please visit https://smartcash.cc.