The major innovation of blockchain technology is that information is stored on a distributed ledger and validated by the entire network. This article will shed light on how this data validation process works.
“Mining” – the process of creating a new block
Every time a transaction is conducted on a blockchain, the transaction data will be stored in a new block. This new block will then be added to the blockchain.
But before the block can be added to the chain, the information contained in it must be verified by the network. This happens by creating a so-called “hash.”
A hash is a 256-bit number that uniquely identifies the data in the block. In order to create this hash, nodes on the network need to solve a complex “mathematical puzzle.” Once the puzzle is solved, all other nodes on the network check if the calculations are correct.
The process of solving this puzzle and as a result creating a new hash is called “mining.”
Mining requires great computational power, as it relies on complex mathematical operations. It also requires specialized computer hardware. Thus, not every node on the network will be able to be a “miner.”
Hashes are the central security element in a blockchain
Hold on! How does creating a hash validate data? – Let’s look at an example.
Take two blocks, block A and block B. Block A is the first block in the blockchain. In order to verify block A, miners collect the transaction data and give it a hash – call it “hash A”.
To verify the next block in the chain, block B, miners will have to collect another set of transactions and find a new hash – “hash B”. Hash B consists of hash A plus a new hash based on the new transaction data.
Now, if a malicious hacker would want to change any data in block A, hash A would change, as it is based on the data contained in block A. As a result, hash B would change as well, and also all other hashes that follow hash B.
That said, a malicious actor would have to alter the entire blockchain to change any of the stored data. That, however, is practically impossible, because it requires too much computing power.
Miners earn a mining reward
The next question you might ask is why do miners provide their computational power to mine new blocks?
Mining consumes energy, and energy costs money. Hence, there needs to be an incentive for miners to mine new blocks.
This incentive is called “mining reward” and is usually paid in the cryptocurrency native to the blockchain network. At the moment, the mining reward for verifying a new block on the Bitcoin network is 12.5 bitcoins. These bitcoins are newly created – that’s why the process is called mining.
Without miners, there wouldn’t be any new blocks. As a result, the blockchain would become dysfunctional.
PoW and PoS are ways to determine which node gets the mining reward
So, mining can be quite profitable.
That’s why there is more than just one miner on a blockchain network. Instead, multiple miners are competing for the mining reward.
Thus, blockchain networks need to apply a consensus principle that defines which miner will get the reward. There are different ways to accomplish this:
PoW is the reward system commonly used in cryptocurrency networks. Both, the Bitcoin and the Ethereum network rely on PoW.
Once a new block needs to be created, all miners on the network will start working on the hash puzzle. The miner who solves it first, receives the mining reward. First come, first served, simple.
PoS has the same goal as PoW – validating transactions by creating a new hash.
However, in a PoS system, the nodes are not competing for the mining reward. Instead, a single node is selected to validate the next hash. The criterium for the selection is the node’s wealth – or in other words, it’s stake in the network.
Thus, in a PoS-based network, the energy consumption will be much lower, because only one node is working on solving the mathematical problem.
Moreover, in a PoS system, the reward is not paid in newly issued coins. Instead, the selected node will receive a transaction fee. All coins are already issued when the network is being created. That’s why nodes who find a new hash in a PoS system are not called miners, but “forgers”.
In principle, all these systems have the same goal: validating new data on the network. Only the way how the miners are selected will be different.
Become a blockchain-pro with our category Education