Friday, 20 July 2018

Bitcoin Block Hashing Algorithm (Part I)


By now, most people may have already heard about Bitcoin and Blockchain, knowing that it could be described as “distributed ledger”, with the characteristic of irreversible, pseudonymous, global and secure.  Another interesting characteristic of Bitcoin or Blockchain is the “mining” process.  The reason behind the irreversible and secure characteristics of Bitcoin and Blockchain is that for each transaction block to become valid, it requires huge computing power to solve the hash algorithm.
 
The “miner”, could be anyone whom has the computing power to solve the algorithm.  They are competing among each other to solve the hash.  The winner (the first one who solves the hash) will be rewarded with some amount of new Bitcoin, generated automatically by the Bitcoin Blockchain algorithm, and also transaction fees.

The core hash algorithm is based on SHA256.  Secure Hash Algorithm, is a set of cryptographic hash functions designed by the United States National Security Agency (NSA) (Read more here).  It is designed in a way that the input messages of almost any size (over 18 quintillion different values) are converted into a unique 64-character long code in hexadecimal format.  And the one-way process means it is impossible to obtain the input message by knowing the unique 64-character long code.  A simple analogy of this process is colour mixing.  One can produce a new unique colour by mixing various colours, but one cannot “unmix” the new unique colour back to their individual component.

Let’s look at some simple examples of SHA256 hashing using either the following Python script (a programming language) or an online hashing tool (Read more here)




 
The input message “abc” is hashed using SHA256 and the output of the hash is ‘ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad’.

A miniscule change to the input message will significantly alter the output hash.  For example, changing the ‘c’ of the input message to capital ‘C’ will produce an entirely new hash output '0a2432a1e349d8fdb9bfca91bba9e9f2836990fe937193d84deef26c6f3b8f76'.

Using the same approach, the entire Universal Declaration of Human Rights (Read more here) can be hashed into ‘c08345541d77c256c914d0ada1ea02497c7525efe0e5699d6ef6126a66b4ee59’.

.
.
.


As such, any contracts, agreements or transactions could be cryptographed and distributed on the Blockchain network with its unique tampered proof hashing algorithm.  In the next article, we will illustrate more real-world examples of Bitcoin transaction algorithm.  Stay online! 

No comments:

Post a Comment