The Proof-of-Work algorithm was first proposed in 1981 by David Chaum. The idea was to add a small amount of computational effort into the mining process in exchange for a reward that is proportional to the effort. While this concept is fairly simple, the devil is in the details, and it took over 30 years for Bitcoin to adopt this method of proof-of-work and to find its ideal formula.
Let’s take a deeper dive into this algorithm and see how it works in practice.
Definition of proof-of-work (PoW)
Proof-of-work (PoW) is a consensus mechanism used in blockchain networks. It is a way of securing and validating transactions on a decentralized network by requiring that users perform a certain amount of computational work to create new blocks and add them to the blockchain. This computational work is often in the form of solving complex mathematical problems, which are known as “mining” or “hashing”. The first miner to solve a problem is rewarded with a certain amount of cryptocurrency, and the newly created block is added to the blockchain, thereby establishing consensus on the state of the network. PoW is designed to prevent double-spending and ensure that the blockchain is tamper-proof.
The Mining Process
When a miner mines a Bitcoin block, they are searching for a solution that meets the following criteria:
- The block must be at least 64 bytes
- The block must have a Hash of zero
- The block must have an excellent ratio of nonce to work
- The block must be unique
When they find a block that meets these criteria, they broadcast this information to the rest of the network, which verifies the block and awards the miner the corresponding Bitcoin.
Now, if you’re new to mining, this algorithm may seem complicated and, to be frank, it is rather intricate. That is why most Bitcoin mining software is written in a specialized and somewhat tricky programming language. Luckily, the majority of the mining process is straightforward. To add more succinctness, let’s dive into the algorithm and see it in action.
The essence of Proof-of-Work
The concept of Proof-of-Work is an algorithm for protecting distributed systems from abuse (DoS-attacks, spam-messages and the like), the essence of which boils down to two main points:
- the need to perform a certain fairly complex and time-consuming task;
- the ability to quickly and easily check the result.
PoW-problems are not originally intended for humans, their solution by a computer is always achievable in a finite time, but requires a lot of computing power. At the same time the verification of the obtained solution requires much less resources and time.
The Mining Process
Here is the step-by-step process of how a miner’s find a valid Bitcoin block.
The miner starts by selecting a random number (known as the nonce). For the purpose of this example, let’s say the nonce is 8. Next, the miner creates a 256-bit Hash of the number.
The miner takes the Hash and stores it as a 32-byte hexadecimal number (i.e. 0x02060808). Finally, the miner calculates a product of two factors: the nonce and the block size (here, we will use the standard block size of 1MB). This product is the final proof of work needed to solve the puzzle.
Each of these steps requires a certain amount of computing power, and the sooner you can solve the puzzle, the sooner you can claim the reward that has been prescribed for the solution. So, the puzzle is, essentially, the same as a password. The only difference is that instead of guessing the password, you are trying to calculate the product of the nonce and the block size. In practice, this means that as the block size gets larger, the puzzle becomes increasingly more difficult to solve. Of course, there are always exceptions to the rule. For example, if the nonce is very large, it may not be possible to generate a Hash that is below the required size. This is why mining is often considered a resource-intensive process. However, in most cases, a large nonce will lead to a larger block size, which in turn makes the puzzle more difficult to solve. In other words, in most cases, a large nonce will lead to a more rewarding experience for the miner.
Role of Hashing in Proof-of-Work
Hashing plays an important role in proof-of-work (PoW) consensus mechanism. It is the process of taking input data and creating a fixed-length output, known as a hash.
- Creating new blocks: In PoW, miners use a hashing function to take the data in a block (such as transactions) and create a unique hash. The miner who solves the PoW puzzle by creating a valid hash that meets the specified requirements, adds a new block to the blockchain and gets the reward.
- Securing the blockchain: By using a hash function, the data in a block is transformed into a unique, fixed-length output, called a hash. This hash is used to identify the block and all its content. By using hashing, it is computationally infeasible to tamper with the data in a block, without changing its hash. Any change to the block data would result in a different hash, making it easy for other participants to detect the tampering.
- Nonce value: In PoW, miners are not only required to take the block data and create a hash, but they also need to find a specific value called nonce, that when included in the data and hashed, will result in a hash that meets the specified requirements. This added complexity makes it even harder to tamper with the blockchain.
- Difficulty adjustment: In PoW consensus mechanism, the difficulty of creating a new block is adjusted based on the amount of computational power on the network, to ensure a steady flow of new blocks. This is typically done by adjusting the requirements for the resulting hash, such as requiring a certain number of leading zeroes. This makes it harder to create new blocks as more miners join the network and therefore more computational power is added.
Hashing is a fundamental component of PoW and ensures the integrity and security of the blockchain by making it computationally expensive to add new blocks, and computationally infeasible to tamper with existing ones.
Purpose of Proof-of-Work
The main purpose of proof-of-work (PoW) is to secure and validate transactions on a blockchain network. It is a way of ensuring that the blockchain is tamper-proof and that transactions are valid and legitimate.
- Preventing Double-Spending: PoW helps to prevent double-spending by requiring users to perform a certain amount of computational work before new transactions can be added to the blockchain. This makes it costly and resource-intensive for an attacker to tamper with the blockchain and ensures that the network remains secure.
- Establishing Consensus: PoW helps to establish consensus on the state of the blockchain by ensuring that a block cannot be added to the chain unless the miner who created it has solved the correct mathematical puzzle. This ensures that all participants on the network have the same version of the blockchain and helps to prevent forks or splits in the chain.
- Decentralization: PoW allows for decentralized control and does not rely on a central authority to validate transactions, it is possible for any participant to validate transactions, by solving complex mathematical problems, this makes it resistant to central points of failure and control.
- Incentivizing participation: PoW incentivizes participants (miners) to join the network and validate transactions by offering them rewards in the form of cryptocurrency. As more miners join the network, the puzzles become more difficult to ensure a steady flow of new blocks and steady issuance of new tokens.
- Providing security: PoW provides a level of security by making it computationally expensive to add new blocks to the chain, this makes it infeasible for a malicious miner to take over the network by adding new blocks to the chain.
Rewarding Compulsion
Incentives matter. Without them, we would still be using floppy disks and Word processors, as the majority of people were not yet convinced that the cloud was a legitimate storage solution or that using specialized software to send electronic money was a good idea.
So, in the case of a find-a-word puzzle, the reward is simply defined as the value of the word when solved. In the case of a cryptographic puzzle, the reward is usually calculated as a function of the amount of computing power expended in solving the puzzle. In both cases, the motivation to solve the puzzle is purely economic. If you can solve the puzzle faster than everyone else, you will be the first to enjoy the benefits.
The Birth of the Proof-of-Work Algorithm
The concept of Proof-of-Work was first described in 1993 in “Pricing via Processing, Or, Combatting Junk Mail, Advances in Cryptology. Although the term itself was not yet used in the paper, the authors suggested the following idea:
In 1997, cryptographer and future Blockstream founder Adam Beck launched the Hashcash project, dedicated to protecting against spam. The task was formulated as follows: “Find a value of x such that the hash of SHA(x) contains N high zero bits”.
The system offered to hash a partial inversion when sent by e-mail. Calculating the corresponding header required about 252 hash calculations, which had to be recalculated for each send. And if for a few ordinary emails the additional calculations don’t pose an obstacle, the need for constant recalculation makes mass spamming very resource-intensive. Meanwhile, the verification of the correctness of the calculated code is very fast: it uses a single SHA-1 calculation with a pre-prepared label.
The term Proof-of-Work itself appeared in 1999 in the article “Proofs of Work and Bread Pudding Protocols” (by Markus Jacobsson and Ari Jewels) in the journal Communications and Multimedia Security.
What affects the complexity of calculating a new block
In the bitcoin network, the computation complexity for adding a new block is a dynamic parameter. It is set at a level so that the block generation speed stays about the same, no matter how powerful the hardware used for mining is.
At the same time, verifying the results of calculations remains simple. Nodes can always verify that the miner has found the correct value, but because the process of finding a block is costly and random, it is impossible to predict exactly which miner will solve the problem and get the next block.
For the system to recognize a block as correct, its hash value must be lower than the current target. Thus, each block shows that some work was done to find it.
The new block contains the hash of the previous block, forming a chain. It is impossible to change the block, you can only create a block on the same height, which will contain the hash of the previous block. To do this you must do the work of finding all the previous blocks. The high complexity of this process protects the blockchain from unauthorized access and double-spending.
Drawbacks of Proof-of-Work
While proof-of-work (PoW) is a widely-used and effective consensus mechanism for securing and validating transactions on a blockchain network, it also has some drawbacks.
- Energy consumption: PoW is energy-intensive, as it requires miners to perform a large amount of computational work to solve complex mathematical problems. This can lead to high energy consumption and a significant carbon footprint, which is a concern for those interested in promoting sustainable energy practices.
- Centralization: PoW can lead to centralization of mining power, as it requires miners to have access to significant computational resources. This can lead to a concentration of wealth among a small group of miners, who can then control the network to their advantage.
- Scalability issues: PoW based networks can have scalability issues, as the more miners are joining the network, the more the mathematical problems that need to be solved and the more computational resources are needed, this can lead to slow transaction times and high fees.
- DDoS attacks and 51% attack: A malicious miner could perform a Distributed Denial-of-Service (DDoS) attack by repeatedly broadcasting invalid block candidate, this could cause the network to slow down. Moreover, If a miner or a group of miners control more than 51% of the network’s computational power they can carry out a 51% attack, this means that they can potentially confirm invalid transactions and block legitimate ones.
- Hardware Advancements: With the advancement of technology, specialized mining hardware is developed that allow certain miners to have an unfair advantage over others, this could lead to centralization and reduced incentives for smaller miners to participate.
- Waste of resources: The computational work done during PoW is not used for any useful computation but just for the consensus mechanism, that could be considered as a waste of resources.
Proof-of-Work and mining
Proof-of-Work, in fact, gave birth to bitcoin mining industry and became an impulse for the development of specialized equipment – ASIC, because computing resources required for block hashing are enormous and exceed greatly the capacity of the largest supercomputers.
At the same time, there was also the “other side of the coin”: rather quickly PoW turned into a monster, devouring electricity in a race for profit.
The power of the mining equipment is constantly growing, and the number of participants in this industry is also increasing. As a result, the total power consumption increases. However, the energy efficiency of miners is also increasing, and bitcoin’s share of global electricity consumption will remain low in 2022.
Cryptocurrencies that use Proof-of-Work
Many cryptocurrencies use proof-of-work (PoW) as their consensus mechanism to secure and validate transactions on the blockchain. Some of the most well-known PoW cryptocurrencies include:
- Bitcoin: The first and most widely-used cryptocurrency, Bitcoin uses PoW to secure its blockchain. Miners compete to solve complex mathematical problems and are rewarded with new bitcoins for their efforts.
- Litecoin: Litecoin is a peer-to-peer cryptocurrency that is based on the Bitcoin protocol but with faster block times and a different hashing algorithm.
- Monero: Monero is a privacy-focused cryptocurrency that uses PoW to secure its blockchain.
- Bitcoin Cash: Bitcoin Cash is a fork of the Bitcoin blockchain, which aims to increase the block size limit to allow for faster transaction times and lower fees.
- Dash: Dash is a digital currency that aims to offer faster transaction times and more privacy than Bitcoin.
- Dogecoin: Dogecoin is a peer-to-peer digital currency, based on the popular “Doge” internet meme and it uses PoW.
These are some examples but there are many other cryptocurrencies that also use PoW as a consensus mechanism, they can have different reward systems and different algorithms, but they all share the same goal of providing a secure and decentralized network.
Alternatives to Proof-of-Work
While proof-of-work (PoW) is a widely-used and effective consensus mechanism for securing and validating transactions on a blockchain network, it does have some drawbacks, as previously discussed. As a result, alternative consensus mechanisms have been proposed to address these issues. Some of the most notable alternatives to PoW include:
- Proof-of-Stake (PoS): In PoS, instead of solving complex mathematical problems, validators are chosen to create new blocks based on their stake in the network. This means that the more cryptocurrency a user holds, the more likely they are to be selected to validate transactions and create new blocks.
- Delegated Proof-of-Stake (DPoS): DPoS is similar to PoS, but instead of being chosen randomly, users vote for a smaller number of validators, who are then responsible for creating new blocks.
- Proof-of-Authority (PoA): PoA uses a set of pre-approved and known identities to validate transactions and create new blocks. This is useful for private blockchain networks where all participants are known and trusted.
- Proof-of-Capacity (PoC) : PoC uses hard disk space as a proof of investment and it is more energy-efficient than PoW. Miners need to prove that they have allocated a certain amount of space on their hard drive as a proof of investment and then they use a subset of that space to perform the computation required to validate transactions and add new blocks to the chain.
- Proof-of-Elapsed-Time (PoET): PoET uses a randomized wait time to determine who gets to add the next block to the chain. This approach is energy efficient and can be used in consortium blockchain networks.
- Proof-of-Burn (PoB): PoB requires users to ‘burn’ a certain amount of their own cryptocurrency by sending it to an unspendable address, in order to prove their commitment to the network and be selected as validators.
These are examples of consensus mechanisms that were proposed as an alternative to PoW. Each one has its own advantages and disadvantages, and different suitability for different use cases, some of them are already implemented on some blockchain networks.
FAQ
Proof-of-work (PoW) is a consensus mechanism used to secure and validate transactions on a blockchain network. It is a method by which miners solve complex mathematical problems to create new blocks, and are rewarded for their efforts with new cryptocurrency.
In proof-of-work, miners race to solve complex mathematical puzzles, which, when solved, add a new block to the blockchain. The miner who solves the puzzle first is rewarded with a certain number of cryptocurrency tokens. As more miners join the network, the puzzles become more difficult to ensure a steady flow of new blocks.
The purpose of proof-of-work is to prevent double-spending and to establish consensus on the state of the blockchain. It helps to secure the network by making it costly and resource-intensive to tamper with the blockchain.
Proof-of-work and proof-of-stake are two different consensus mechanisms. In PoW, miners solve complex mathematical problems to create new blocks and are rewarded with new cryptocurrency. In PoS, validators are chosen to create new blocks based on their stake in the network, and are rewarded with transaction fees rather than new coins.
Proof-of-work is energy-intensive, and the energy consumption required to maintain a PoW blockchain can be significant. It also allows for centralization of mining power which could lead to a concentration of wealth among a small group of miners.
Bitcoin is the first and most well-known cryptocurrency that uses proof-of-work. However, many other cryptocurrencies also use PoW, including Litecoin, and Monero.
The reward for solving a proof-of-work puzzle is typically a certain amount of cryptocurrency tokens. The reward is not fixed and varies according to the specific cryptocurrency and its blockchain.
Proof-of-work prevents double-spending by ensuring that a block cannot be added to the blockchain unless the miner who created it has solved the correct mathematical puzzle. If a miner tries to tamper with the blockchain, the other miners on the network will reject the block and the attempt to double-spend will fail.
Hashing plays an important role in proof-of-work. In PoW, miners use a hashing function to turn input data (such as transactions) into a fixed-length output, known as a hash. The mining process is essentially the process of finding a hash that meets certain specifications set by the blockchain protocol.
Yes, there are alternative consensus mechanisms such as proof-of-stake and others being researched, such as proof-of-elapsed-time, proof-of-burn, and proof-of-capacity. They were proposed to solve the drawbacks of PoW and some of them are already implemented in some blockchain network.
Comments (No)