Proof of Work (first proposed in 1993)
Why Proof of Work instead of any other techniques? Well ! We need to understand the problem here, and to which Proof of Work was introduced. The problem is ‘double spend’ing. Let’s’ have an example here. In a digital world, Tshering sends an email with the picture to Karma. Tshering still owns the picture on his/her computer and ‘if he sends the same picture to Yonten’. This way, he sends the image twice and he may continue doing this as he/she wishes. This is the biggest issue with digital currency in the past. Similar ‘double spending’ may happen with the digital currently like ‘bitcoin’, and Proof of Work solved this.
Proof of Work (or referred as PoW hereafter in this blog), is the method of confirming transactions on the blockchain known as ‘mining’. Blockchain is the distributed ledger (or database) of blocks and is decentralized-meaning distributed to all nodes (machines or miners) over the globe. Only the nodes who are willing to spend computational resources are able to add the new blocks to the ledger or the blockchain. With PoW, miners are solving mathematical ‘one-way functions’. Multiple miners simultaneously compete against each other and whoever solves the function first, gets the financial rewards and his solution/answers is broadcasted to all the other nodes.
What’s ‘one-way function’? With SHA256, one can get Y from X but not the other way. Such function is used in cryptography. For example, Bitcoin wallet address is an output of a private key, which is hashed into a SHA256 output.
For example, the hashed word ‘NiceHash” has the SHA256 output as
D22df564d771ed4e6785029de215e9f9e2affe9bbe37bacc8544c32f0a162ba3
The word NiceHash acts as a private key and the output is the public key. Thus, it’s impossible to reverse the function and find out what it means without the private key.
Blockchain network will set a desired output to start with 6 zeros. For example
000000c49ede7f965ba8e7e6419d6efb0afc99e7ecd10095b286310ca55a6355
The miner will literally guess the nonce until the block hash output will start with 000000. This what miners do, they combine block transactions as a data input then guess the nonce, until the SHA256 output starts with 000000. A miner must also include previous block hash output in the data input alongside the transaction data. Also, with increasing difficulty, the number of zeroes increases, which makes guessing the correct nonce less likely to occur, therefore it is more difficult to guess the correct output hash. It is easier to find output with one zero (0) than with four zeroes (0000).
Still did not understand PoW?
The solver that answers a mathematics puzzle the fastest, will create a
cryptographic link between the current and previous blocks and earn some
freshly minted crypto coin. This process is known as mining, and the
solvers are known as miners. It is through their combined efforts that a
blockchain is kept secure for all parties involved. Moreover, the
computational task of solving this puzzle itself is called
proof-of-work.
A blockchain is a system that consists of a series of blocks arranged in chronological order based on a transaction order called blockchain ordering. The genesis block, or block zero, is the first block in a PoW blockchain, which is hardcoded into the software. This block does not, by definition, refer to a previous block. The subsequent blocks uploaded to the blockchain always refer back to the prior blocks and contain a complete and updated ledger copy.
Through a competitive race in which some participants or miners are encouraged to expend computational resources to submit legitimate blocks that fit the network's regulations, PoW algorithms select who gets to amend the ledger with the new entries. The ledger keeps track of all transactions and organizes them into successive blocks so that no user can spend their funds twice. To avoid tampering, the ledger is distributed, allowing other users to reject an altered version rapidly.
In practice, users identify tampering using hashes, which are long strings of numbers that act as proof-of-work. The hash function is a one-way function, which means it can only be used to check that the data that generated the hash matches the original data.
After that, nodes verify transactions, prevent double-spending and decide whether or not the proposed blocks should be added to the chain. The act of making payments twice with the same currency to deceive the recipient of those funds is known as double-spending. Double-spending would wreak havoc on the network and eliminate one of its most valuable features: immutability, decentralization and trustlessness.
Proof-of-work makes double-spending incredibly difficult because changing any part of the blockchain would involve re-mining all subsequent blocks. Because the machinery and power necessary to execute the hash functions are expensive, it makes it impossible for users to monopolize the network's processing capacity.
Furthermore, to generate consensus and secure the legitimacy of transactions recorded in the blockchain, a PoW protocol combines computational power with cryptography.
Miners compete to develop the correct answer to the mathematical problems during the hashing process to produce new blocks. Miners achieve this by guessing a hash, which is a string of pseudorandom numbers. A cryptographic hash (e.g., SHA-256) is a type of text or data file's signature. For a text, SHA-256 provides a nearly-unique 256-bit (32-byte) signature.
Proof of Stake (first proposed in 2011)
To lower the amount of computational resources required to run the blockchain network, instead of PoW, PoS which is based on the existence of a verifiable stake in the ecosystem is used to run the blockchain i.e., to validate the transactions on the crypto network, a user only needs to show that they own a particular amount of cryptocurrency tokens that are native to the blockchain.
For example, lets says a miner A stakes 30 coins, miner B staked 50 coins, and miner C stakes 75 coins. Thus, in this scenario, miner C would be given the priority to write and validate the flowing block. Thus, miner C get the rewards such as transaction fees (network fees). Users who want to be considered for inclusion in the process of adding blocks to a PoS blockchain must stake, or lock, a specific amount of the network's cryptocurrency in a unique contract. Their odds of being chosen as the next block producer are determined by the quantity of crypto assets they have staked.
Key Take-Away from PoW and PoS
While PoW engages large computational resources such as electricity, which invites huge investments on the resources; on the contrary in PoS, with the need to stake coins, it is possible that a large stakeholder could exert significant influence on the validation of transactions on a blockchain network.
What will happen if the bitcion network is hacked?
The greatest worry concerning PoS is the
Will review your comment and get back!