You may have heard that Bitcoin and other cryptocurrencies are trustless and operate on a distributed consensus. People frequently pass those buzzwords around but they are integral to Bitcoin and many other cyrptocurrencies. In short, a trustless, distributed consensus relies on many users instead of one central third party. The consensus of Bitcoin’s ledger is public, which means that if somebody were to attack the Bitcoin blockchain by approving invalid transaction, those new transactions would be public. This makes Bitcoin’s blockchain tamper-evident, but not tamper proof. Although it would be costly and difficult, somebody could theoretically generate enough power to attack the Bitcoin blockchain, but that attack would be public, and users could agree to revert to the blockchain that existed prior to the attack.
Mining – The process that facilitates a distributed consensus
There are many ways to reach a decentralized consensus but the two most used methods in cryptocurrency are Proof of Work (PoW) and Proof of Stake (PoS). Bitcoin and Ethereum (and all ERC-20 Tokens) use PoW but Ethereum intends on switching to a PoS system in 2018-2019.
Mining serves a couple main purposes:
- Verifies the legitimacy of transactions and eliminates a potential double-spending issue
- Rewards miners for verifying transactions, which encourages a decentralized/distributed ledger
- Issues/prints new cryptocurrencies in a formulaic process
How does the mining system with Proof of Work (PoW) work?
- Transactions are bundled into a block
- A user verifies those transactions
- Miners solve a puzzle known as a Proof of Work problem to verify those transactions
- The first miner to solve the puzzle is given a reward (called a block-reward)
- Those verified transactions are added to the blockchain
What is the puzzle??
From the Bitcoin whitepaper, “The proof-of-work involves scanning for a value that when hashed, such as with SHA-256, the hash begins with a number of zero bits. The average work required is exponential in the number of zero bits required and can be verified by executing a single hash.”
In layman’s terms, there is an executable code (value), that when executed (hashed), produces a string of text. The miners know what string of text they are looking for, but they need to guess the executable code. Once somebody finds out the code that creates that proper string of text, everybody can test that code and see that it works. Once there is a consensus, that code is added to the blockchain, a block reward is awarded to the user who found the code, and the cycle repeats itself.
The puzzle is like guessing a password for an account. Guessing the password will require a guess and check algorithm, and once the password is found, it can easily be checked because the password will work.
Downside to PoW
PoW is secure but the process of guessing a correct hash output requires a lot of energy. Additionally, a lot of that energy used to guess a hash output gets wasted when miners use energy but do not even find a hash solution. Proof of Stake was created to solve this problem but Proof of Stake also has its imperfections.
How does the mining system with Proof of Stake (PoS) work?
Proof of Stake serves the same purpose as PoW but uses a different process. Instead of finding a user who solves a cryptic math problem to create new blocks in the blockchain, the creator of the new block is determined by who puts their cryptocurrency at stake. Putting a cryptocurrency at stake means locking it in a wallet for a fixed period. The chance of being the creator of the block and receiving the transaction fee is proportionally equal to the amount of that cryptocurrency they have at stake compared to the rest of the network. So, if they stake .001% of the total amount of cryptocurrency being staked in the network, they will receive on average .001% of the transaction fees. In PoS systems, blocks are usually said to be forged or minted instead of mined.
Downside to Proof of Stake
Individuals or organizations with large amounts of a currency using PoS may form a monopoly over the coin
PoS promotes saving and not spending
Individuals could potentially stake multiple chains at once, adding to a chain without consensus