Proof-of-Work and alternative consensus algorithms, advantages and disadvantages of Proof-of-Work as well as its working process, the role of hash and the way to find it, the difference between dual and hybrid mining
In our blockchain dedicated section we have already explained the meaning of blockchain oracles and the difference between permissionless and permissioned blockchains. Here we provide an article about consensus algorithms that are used in blockchain and take a look at some of their most popular models.
Blockchains are decentralized continuously growing databases. A blockchain needs its network of nodes to run it. To add new data, the majority of the network must agree on it. Agreement mechanisms are called consensus algorithms. Proof-of-Work is the most common consensus algorithm and is used in Bitcoin.
How does it work?
To create a block, a miner collects unconfirmed valid transactions, puts them together in a block, and then seals it by finding the hash of the block. A hash is a set of random symbols produced by running the block data through a hashing algorithm. If you change as much as one bit in the block, the hash will be completely different. A hash is difficult to generate but easy to check if it corresponds to the block. It proves to other miners that the creator of the block really did the work, hence Proof-of-Work.
How exactly do you find a hash?
Go to this hash generator and type a set of words in the ‘input’ field. The website will instantly give you the hash of your input data (your set of words). Finding a hash of the block, however, is not that easy because the hash has to meet difficulty requirements. Now go back to that site. Try putting in some numbers to the end of your set of words until your hash starts with 0. This, in principle, is exactly what miners do. They input transaction details instead of words and try different random values (nonce values) until their hash has, for example, 16 zeros in the beginning. They, fortunately, do not have to do it manually, the software uses their computer power to quickly put it nonce values to get the necessary hash.
How secure is Proof-of-Work?
Proof-of-Work is one of the most secure algorithms as it requires a lot of computing done in a short amount of time. To change a block, an attacker will have to find the block’s hash and the hashes of consequent blocks in just 10 minutes. The older the block is, the harder it is to change it. This is why the original bitcoin client marks a transaction as confirmed after it is at least 6 blocks deep.
What are its flaws?
Proof-of-Work is very demanding in terms of computing resources and, thus, consumes a lot of electricity in the process. This means that a lot of coal needs to be burnt, which does not at all alleviate the current environmental issues but only aggravates them. In light of this, many alternatives, more ecological, consensus mechanisms have been proposed and implemented in other blockchain networks.
- Proof-of-Stake, for example, chooses a random validator for the next block from a group of nodes based on their deposited coins: if the validator adds an invalid block, they lose their deposit.
- In Delegated Proof-of-Stake, the deposit owners vote to elect delegates to do the validation.
- Proof-of-Capacity lets miners use empty space on their hard drives to store solutions for blocks ahead of time, which relieves them from the necessity of finding blocks in real time.
- Proof-of-Weight is another consensus protocol that lets nodes show their interest in the stable work of the network. For example, in a file storage system, validators are chosen based on the amount of space they provide for the blockchain.
Dual and hybrid mining
It is possible to mine two different cryptocurrencies using a single GPU. This is called dual mining. You can simultaneously mine, for example, ethers and siacoins because they use different mining algorithms, Ethash and Blake 2b respectively, but do not affect each other’s performance too much.
Hybrid mining is mining two different coins with the same hashing algorithm at the same time. It is different from dual mining in that it requires two or more GPUs on a single system.