Many of you do not know the behind-the-scenes of how transactions are verified and blocks are generated. This blog will explain of the various ways and concepts that this is done.
Proof of Work
Proof of Work is defined as an economic measure to deter denial of service attacks and other service abuses such as spam on a network by requiring some work from the service requester, usually meaning processing time by a computer. Proof of Work is not a new concept. Coins like Bitcoin use Proof of Work.
Simply put in terms of crypto currency, this means that calculations are required by the network nodes in order to form a distributed ledger. This process is called mining.
A distributed ledger is a decentralized system that can agree on and keep track of the correct amount a wallet has by providing a history of every single transaction.
The Purpose of Mining
Mining is the process in which Proof of Work is generated. Before we go into the exact purpose of mining, we need to address what a Block is. A block is a permanent storage of record that includes a group of data of all or some transactions that have not yet been included in previous blocks.
The main purpose of mining is to verify the legitimacy of a transaction and prove that it is not a double spend. A double spend is when the same coins are spent more than once. Since mining is a strenuous process, miners are rewarded for their work upon successful completion of mining a block. Rewards vary by coin and can change over time.
Explaining like I am five, here is what happens:
A transaction is made and included with other transactions in a Block;
Miners verify every transaction in the block are legitimate;
In order to do this they must solve a mathematical problem;
Rewards are handed out to the miner that successfully solved the problem;
All legitimate transactions are stored in the mined block on the blockchain.
Due to the strenuous computation nature Proof of Work, it can become an expensive process.
Proof of Stake
Proof of Stake is an alternative to Proof of Work and aims to achieve distributed consensus. The idea was first discussed on bitcointalk in 2011 and first used with Peercoin . There are many different alternatives and solutions in itself, so we will talk about the basics of PoS.
Instead of having miners prove each and every transaction is legitimate, proof of stake requires that a person stake (hold or lockup) coins and validate ownership. There are different ways the new block creator are selected to avoid centralization or more than 51% ownership taking control. We will talk about this next.
Randomized Block Selection
Nxt and Blackcoin use randomization to predict the next block creator. They do this by using an algorithm to look for the lowest hash value in combination with the size of the stake. Since all stakes are public, the nodes can predict which stake will create the next block.
Coin Age Selection
Coin age refers to the age of transaction inputs.
Coin age is equal to the number of coins sent times the average age on these coins. Age is measured in days. Age is reset to zero whenever a coin is sent AND whenever a coin provides a signature. Coin age could be used to calculate mandatory fees, block reward or proofhash target.
Unspent coins must wait 30 days before they can begin competing to generate the next block. Coins like Novacoin and Peercoin use this method.
The reward for staking will either come from new coins generated by inflating the current supply, called minting, or they may come from recycled transaction fees, called forging.
The Differences from Proof of Work
- Proof of Stake is more efficient. Electricity and hardware is not needed.
- More people are encouraged to run nodes due to efficiency.
- Proof-of-stake is not ideal for a distributed consensus protocol.
- The "Nothing At Stake" problem. This can be avoided in different ways
Everything I have talked about are quick overviews of the concepts. I wanted this thread to be easy for members to educate themselves. For the technical aspects on the various concepts, please read the whitepapers.