All users who begin to work with cryptographic currencies encounter a lot of new terms and concepts. Many of them are important for understanding how blockchain systems work. An example of such a significant concept is the Proof of Work algorithm, or PoW for short – proof of work done.
This and many alternative consensus algorithms are used in blockchains to perform specific functions. For example, control the creation of blocks or confirm transactions.
Let’s take a closer look at what the Proof of Work algorithm is. Let’s study its features and specifics of work. Note that this is the first part of our material; we will gradually reveal its work.
Proof of Work algorithm – what is it?
Blockchain technology, on which almost all cryptocurrencies are built, is complex because it combines the work of many rules. These specialized protocol components are also called algorithms.
They are cryptographic mechanisms that regulate specific functions and perform certain tasks. The most common option is the Proof of Work algorithm, which is responsible for achieving consensus in the blockchain.
Translated from English, PoW is proof of work done. The main function is to create competition between miners to receive rewards. This money is paid to the person who last completed the search for a solution in generating a new block for the blockchain. In addition, Proof of Work is responsible for confirming the validity of cryptocurrency transactions.
Of all the abundance of tasks included in blockchains, PoW is the most “age-related”. For permanent use, it was used in 2009 specifically in the Bitcoin system. The first descriptions of this algorithm appeared in 1993 when considering methods for countering SPAM.
How the Proof of Work algorithm works
The importance of the confirmation process is shaped by the features of blockchain technology. For example, the transaction of BTC coins in the Bitcoin system is carried out according to the following scheme:
– one user sends bitcoin coins to another as part of a sale, purchase or exchange of cryptocurrencies;
– during sending, a special hashing algorithm encrypts and places encrypted transactions in the last block;
– thanks to miners, calculation processes are carried out that confirm the correctness of transaction operations, as well as the block itself;
– the one who was the first to solve the problem with the computing power of his device (rig, PC, farm) will receive a reward;
– confirmed transactions with a block occupy a place at the end of the chain of the general distributed registry. Next, a new transaction is included in the blockchain according to the same scheme.
To avoid or block errors that occur in the cryptocurrency network (double spending, non-receipt of a transaction, accrual of rewards without work, etc.), a special mechanism is used. According to its principle, each node participating in the creation of the blockchain must understand and follow the same rules in the system.
Different operation of nodes in the distributed registry of one blockchain project is in no way acceptable. The Proof of Work algorithm or its analogues help out here.
The synchronization task is performed through complex calculations, which can prove that the decisive step of the calculation is performed by a specific device (node). It is this node that confirmed the location of the block and the reward is awarded to it.
An absolute copy of the new block is sent to the remaining nodes so that the timing process eliminates the appearance of different copies of the blockchain. As a result, a distributed registry is formed with completely identical copies in the system nodes.
The way the Proof of Work algorithm works here is to use a hash function calculation. This is a checksum from the information characterizing the transaction and contained in the block.
As a result, PoW helps achieve:
– eliminating errors and collisions in the cryptosystem;
– achieve effectiveness in combating the abundance of SPAM requests;
– counteract DDoS attacks. In this forcing, the system freezes with the loss of the ability to process new requests from users.
To summarize the points noted above, the functioning of the Proof of Work algorithm can be described briefly. The set of rules that make up PoW allows a node to control that other nodes intending to include a new block in the chain (miners) comply with the conditions of the algorithm.
That is, the calculations must be performed correctly. When verification confirms validity, the block is integrated into the blockchain, and the miner receives a reward. In the case of Bitcoin, after the last halving, today it is 6.25 BTC.
Mining difficulty and block reward
The concept of mining difficulty means a certain amount of calculations required to add a new block to the registry. This parameter is determined primarily by blockchain algorithms.
However, 2 more factors are important for the difficulty of mining:
– hashrate – the total computing power of the network;
– load – the number of users performing transactions and mining this type of coins.
The introduction of the mining difficulty parameter was carried out to control the speed of solving computational problems. The speed of finding blocks creates abuse, incomplete use of the blockchain and its accelerated growth with almost empty blocks. This will create a lot of difficulties and problems.
For example, the Proof of Work algorithm in the Bitcoin network was designed by programmers so that new blocks could not be found before 10 minutes. The increase occurs automatically thanks to special rules in the algorithm.
Currently the Bitcoin block time is ~13m 52s. The increase was provoked by the enormous demand for BTC coins due to the rapid growth of quotes on the crypto market. A lot of power is directed towards Bitcoin mining.
Initially, the complexity of the Bitcoin network was at the level of 5.591 Megahash/sec, which made it possible to mine BTC coins on average home PCs. Today, this indicator of the network hashrate of the most popular cryptocurrency is on average 125.937 Exahash/sec.
Of course, such a colossal figure makes it impossible to use simple PCs or ordinary rig farms for mining Bitcoin. Requires modules assembled from ASIC miners.
The work of calculating blocks in cryptocurrency systems is paid for with a special reward. It is credited to the first person to provide the server with the correct hash calculation. In fact, several nodes can find a solution to a block at once, however, the one who solves the solution faster earns bitcoins.
Nuance! Several times in the history of the Bitcoin network, simultaneous solutions to a new block by several nodes have occurred. This is an extremely rare scenario. Here the system analyzed various data for about an hour to find differences in milliseconds between the moments of delivery of the found block. Of course, the first solution is sure to be found!
Features of the PoW algorithm
The Proof of Work cryptographic mechanism has two key features:
– checks of results are carried out at a faster rate than control of decisions;
– in order for consensus to be reached, it is necessary to solve a large, complex mathematical problem.
The size of the task is extremely important, since nodes need to be able to quickly check the validity of added blocks. If a lot of time is spent at this stage, the speed of the crypto network begins to decline.
Then a critical point is reached, as a result of which transactions without confirmations will begin to accumulate. The result will be the inoperability of the blockchain. By the way, this is a scenario that you need to wait for in the future after the last Bitcoin coin is mined – on the 21,000,001st coin the Bitcoin network will stop.
You can see that a block’s confirmation is calculated using its own hash. In addition, the block contains part of the encrypted information (hash) from the previous block. It turns out in this way to implement a sequential chain, making the blockchain a single structure.
What are the calculations in the Proof of Work algorithm?
For PoW consensus to occur, the node that includes the block in the blockchain must perform a series of calculations, adhering to the algorithm. There may be several types of calculations here.
1. The partial inversion is hashed when it finds use within the Hashcash system. In fact, the potential of this system was used to counter SPAM and protect against DDoS attacks. A little later it was integrated into the Bitcoin system of some other cryptocurrencies.
2. Implementation of functions based on Merkle trees. Considering this type of calculation in cryptocurrencies, one can name Bitcoin as an example of a Merkle tree implementation.
Its blockchain uses Merkle trees, which are necessary for multi-level encryption. Thus, it turns out that the hash of the previous block is included in the next block and is there with its own hash.
A Merkle tree is a block that contains the total volume of hashed data from the 4 previous blocks. At the same time, there are references to the hashes of blocks generated earlier.
Now each block, which is a structural unit of the Bitcoin blockchain, can accommodate several thousand encrypted transactions. They are hashed using the SHA-256 algorithm, although there are other rule models – Scrypt-jane, Crypto Night, etc.
In addition to these two calculation options, they are often used in cryptographic systems:
– Fiat-Shamir protocol;
– Diffie-Hellman functions;
– and etc.
Expect the continuation of the article, namely the advantages or disadvantages, areas of use of PoW, in the next material, which we will post next week.