How hashes protect blockchain networks.
How hashes protect blockchain networks
Hashes are the way for blockchain networks to connect blocks on a blockchain and seal the information. Each subsequent block of a blockchain contains the hash for the block and the hash for the previous block. The previous block contains the hash for the block that came before it and so on. Blockchains such as Ethereum, Bitcoin and others are fully transparent, meaning that their software is open source and anyone can look at it, analyze what it does, and use the software. All the information about all the blocks and all the transactions that are occurring on the networks is available via blockchain explorers and you can track all the transactions, hashes and data from block one to current day and moment, and even see the transactions that are becoming active on a network but have not yet gain a valid status. On the Bitcoin network, you can see current transactions here: https://blockchain.info/unconfirmed-transactions
All of this means that anyone can re-calculate all the hashes for all the blocks and make sure that they are correct. At the same time, if someone were to change information even about just one transaction, the set of the data with this edited transaction would return a different hash and this new set of data would not fit into the existing blockchain because there is already a hash included in the next block and this hash was generated based on the unedited transaction.
Why blockchain networks need the parameter of difficulty
While cryptography hashes and algorithms are a critically important part of blockchain networks, they have existed long before the blockchain technology and simple use of hashes has nothing revolutionary to it. For example, SHA-256, the algorithm that the Bitcoin network uses, comes from the National Security Agency of the United States, where it was invented in 2001, eight years prior to Satoshi Nakamoto launching the Bitcoin blockchain.
The reason why hash use would not be enough to protect the blockchains is that hash generation is a trivial task for almost any modern computer, including regular laptops and desktops. You have a set of data, you run the data through a cryptography algorithm and you get the hash for the data in that algorithm. If this was all that the Bitcoin network and other blockchains had, then anyone could create a new version of a blockchain by changing data about transaction and creating an infinite version of blockchains, which could confuse anyone and nobody would know which blockchain is original.
Because of this, the Bitcoin network, the Ethereum network and most other blockchain networks have a difficulty parameter.
The goal of the Bitcoin network is to serve as a decentralized peer-to-peer currency that is available 24/7 everywhere in the world. In addition to serving as a network to send funds, the Ethereum network also has smart contract functionality, but the idea is the same in that it is a decentralized network that is available to anyone from anywhere in the world, 24/7. Because of this, the networks need to be adding blocks to the blockchains at a regular pace. If they didn’t, then people wouldn’t know how long it would take for a transaction to go through. Imagine trying to pay someone $3 for coffee and not knowing when the other party will get the funds: in ten minutes, in an hour, next week or next year. Obviously, such an uncertainty wouldn’t work.
For this reason, the Bitcoin blockchain aims to create a block of the blockchain every ten minutes. Vitalik Buterin has created the Ethereum network in 2015, six years after Satoshi Nakamoto launched Bitcoin. Buterin and other Ethereum creators decided that the Ethereum network should be creating the blocks much faster, every 15 seconds on average. You can see the average block time for the Ethereum network here: https://etherscan.io/chart/blocktime and Bitcoin historical block time chart here: https://data.bitcoinity.org/bitcoin/block_time/5y?f=m10&t=l