The process of encrypting information to through a certain cryptographic algorithm and obtaining a scrambled output is called hashing.
This is an integral process that continually benefits the Bitcoin network and takes care of security issues that would otherwise render the network completely unviable for financial usage.
The blockchain consists of blocks that are connected to each other through a requirement of providing the hash of the previous block in order to be validated. This means that new blocks include the hash of the previous block and link back to it. If you want you can follow this “chain” of links all the way back to the first transaction.
Hashing in Transactions
Hashing plays a big role in transactions, as every part of the transaction either produces or relies on previous hashes to keep track of the Bitcoin and prevent double-spending. Unlike mining hashing, which we will talk about later, transaction hashes are not energy intensive, since they are used to check the validity of individual transaction data by the network and to make sure that no data was lost during propagation across the network.
Transaction ID’s are the most common hash that you need to know about. It collects hashes for public keys and holds information about individual transactions. It holds the information about sending and receiving addresses, which block the information is mined into and when. It also includes value information detailing the Bitcoin value that was transacted, as well as the fees paid for the transaction.
In this case, the hash can be used to reference the individual transaction on the blockchain and gain access to it on the blockchain ledger.
Hashing in Mining
Unlike transactions, hashing for a valid block header hash is an energy-intensive effort, called proof-of-work. The reason that this hashing procedure is so difficult to accomplish is the network requirements for valid hashes. Bitcoin is designed to create approximately 2016 blocks every two weeks. Since there are many new miners joining the process constantly, there is something called network difficulty which decides what kind of hash is going to be accepted as a block header.
Once a miner finds a suitable hash for the block header it propagates this information to the rest of the network, which then proceeds to recheck the hash and reach the same result. After the entire network has completed this process, the block is created, the transactions are written down in the ledger and work on the new block begins.
Hashing plays a very important role in maintaining the security of the network. As time passes, transactions that are contained in older blocks become almost completely unchangeable. The reason for this is that blocks rely on the hash of previous blocks. The only way to change previous blocks is to recreate every block and hash from now to the block in question. Fortunately, by the time this attack attempt would finish, the network would have created many other new blocks on top of it and disable any hope of changing transactional history.