We know that bitcoins enter into the digital market only through mining. It is a cryptocurrency created as a peer-to-peer currency which can be traded without using any Bank or Payment gateway. When these transactions are made, they are accounted for using a publicly distributed ledger which keeps a record of all the transactions made to every Bitcoin.
Every time a transaction is made, a new block is created. Every new block will be verified and added into the block chain by the miners. Here comes the purpose of hash functions to make the block chain secure.
Hash is a process of converting input of any length of string into a fixed length of text using a mathematical algorithm. Whatever may be the size of input, it will only produce a fixed length of output.
Input + Mathematical algorithm (Hash function) = Hash value
In cryptocurrency, SHA 256 (Secure Hashing Algorithm with 256 bits) or SHA512 are used to create the hash values.
There are few specific features of Hash value −
Always the same input will create same hash value. Even a small change will create a new hash.
Hello World :
Hello World :
Here we can see that even a small change in the case of alphabet “w” has produced entirely different hash value. This makes the hash value unique and unmitigated and secure.
Any length of input will always create the same length of text in hash value.
The speed at which the hash value is created also matters in block chains.
Hash values are highly secure. It is extremely impossible to get the input value from the output. It is also an irreversible and one-way process. You will lose the entire input data once the data passes through hash function and a hash value is created
In a block chain hashes are used to connect the blocks to each other and create the chain. Every new block added to block chain will have the details of the transaction - Amount, address of sender and receiver, time stamp and most importantly the previous block’s (transaction) information stored as a hash value. This entire information again converts into a Transaction ID, which is the hash value of that particular block.
The previous block information + current block’s transactions = Hash value of current block.
In this manner it creates an unbreakable dependency. Based on the Hash value of the current block you can trace previous and next block. Thus hash functions make the block chain a secure, immutable and transparent network, which is the core of cryptocurrency. The concept of hashing has made the block chains revolutionary and unique.