Bitcoin presently uses an agreement protocol referred to as proof-of-work (PoW). That allows the Bitcoin network nodes to agree on the state of all information recorded on the Bitcoin blockchain and prevents certain kinds of economic attacks.
What is Proof-Of-Work (POW)?
This explanation focuses on proof of work as it works on the Bitcoin network. Bitcoin is a digital currency secured by a distributed ledger known as a "blockchain." This ledger keeps a record of all bitcoin transactions organized into consecutive "blocks" so that no user can spend any of their holdings twice. In addition, the ledger is public or "distributed," which helps to prevent tampering. In this case, if any modifications appear, they will quickly be rejected by other users.
In practice, users detect tampering based on hashes, long strings of numbers that serve as proof of work. Run a given record through a hash function (Bitcoin uses SHA256), and only a hash is generated (Example 1). However, due to the "avalanche effect", even a small change to any part of the original data will result in a completely unrecognizable hash (Example 2). Regardless of the size of the original record, the hash generated by a given function is the same length. The hash is a one-way function: it cannot be used to retrieve the original data, only to verify that the data that generated the hash matches the original data.
Example 1:
Result: 1c54a38ac265306c2af248416451386b8c57cc2ceb50f5b38a8e255b975cd744
Example 2:
Result:
Given that a given record can only generate one hash, how do miners ensure they generate a hash below the target? They modify the input by adding an integer called a nonce ("one-time-use"). Once a valid hash is found, it is broadcast to the network, and the block is added to the blockchain.
Generating an arbitrary hash for a series of bitcoin transactions would be trivial for a modern computer. So, in order to turn the process into “work”, the bitcoin network sets a certain level of “difficulty”. This setting is adjusted to "mine" a new block approximately every 10 minutes, which is added to the blockchain by generating a valid hash. The configuration difficulty is achieved by setting a "goal" for the hash: the lower the goal, the smaller the set of valid hashes, and the more difficult it is.
Proof-of-work makes it extremely difficult to change any aspect of the blockchain, as such a change would require re-mining all subsequent blocks. Also, it becomes difficult for one user or group of users to monopolize the computing power of the network because the machines and power required to find a valid hash are expensive.
Finality
A transaction has "finality" on Bitcoin when it's part of a block that can't change.
Because miners add a suburbanized way, 2 valid blocks will get well-mined at constant time. This creates a brief fork. Eventually, one among these chains can become the accepted chain once a resultant block is mined and added, making it longer. However, to complicate things further, dealings rejected on the temporary fork could be enclosed within the accepted chain. That implies it may get reversed. Thus determinateness refers to the time you ought to wait before considering a transaction irreversible. For Bitcoin, the counseled time is six blocks or simply over one minute. Once six blocks, you'll say with relative confidence that the dealing was successful. You'll wait longer for even larger assurances. Determinateness are a few things in contact in mind once coming up with DApps. It might be poor user expertise to misrepresent transaction info to your users, particularly if the transaction is of high value. Remember, this temporal order doesn't embody the wait times for having a transaction picked up by a miner.
Proof-Of-Work and Security
Miners are incentivized to try and do this work on the most Bitcoin chain. There's a minimal incentive for a set of miners to begin their own chain – it undermines the system. Blockchains have confidence in having one state as a supply of truth. And users can invariably opt for the longest or "heaviest" chain. The target of proof-of-work is to increase the chain. The longest chain is most plausible because the valid one had the foremost procedure work done as a result of it. Inside Bitcoins, it's nearly impossible to form new blocks that erase transactions, create tampering ones, or maintain a second chain. To systematically produce malicious however valid blocks, you'd need over 51% of the network mining power to beat everyone else. You'd need heaps of computing power to be ready to do that quantity of "work". And therefore, the energy spent would possibly even outweigh the gains you'd build in an attack.
Proof-Of-Work Economics
Proof-of-work is also liable for issuing new currency into the system and incentivizing miners to try to do the work. Miners who successfully create a block get rewarded with some freshly minted BTC.
Proof-Of-Work Energy-usage
A major criticism of proof-of-work is the quantity of energy output needed to keep the network safe. To maintain security and decentralization, Bitcoin on proof-of-work consumes tens of TWh annually, the energy equivalent of a medium-sized country.
Pros and Cons
Pros |
Cons |
Proof-of-work is neutral. You don't need BTC to get started, and block rewards allow you to go from 0 BTC to a positive balance. With proof-of-stake, you need BTC to start with. |
Proof-of-work uses up most energy that it's unhealthy for the environment. |
Proof-of-work is a tried and tested consensus mechanism that has kept Bitcoin secure and decentralized for many years. |
If you would like to mine, you would like such specialized instrumentality that it’s an enormous investment to start. |
Compared to PoS, it's relatively easy to implement. |
Due to increasing computation needed, mining pools could potentially dominate the mining game, leading to centralization and security risks. |
References
[1] Andreas M. Antonopoulos, Mastering Bitcoin: Programming the Open Blockchain, accessed April 19th, 2022.