image source: bitcoinmining.com
Mining is the process of generating new digital currency or coins in the supply. How coins were generated? Coins were minted after creation of new block at fixed and diminishing rate. For example with Bitcoin, Satoshi Nakamoto programmed generation of new coins with mathematical computations. Every 210,000 blocks, which is approximately 4 years, the constant reward of 50 coins will diminished to half(25 coins). Mining is also the way to secure the blockchain network.
In mining process, so called miners arranges transactions by sequence and groups it into a block. This is done by doing complicated computations by using lot of CPU speed. Mining process also prevents fraudulent activities by checking each transactions for double spending. This thing confused me when I was learning about cryptocurrency. All I knew was miners have helmets with flash lights and a shovel. In cryptocurrency concept, miners uses a computer. Think of a miner as an accountant who balances transactions in a ledger and keeping it updated every time.
Every cryptocurrency has an average time when a new block is going to be generated. In Bitcoin, a new block is generated in average of every 10 minutes. Since cryptocurrencies is decentralized and no central bank to issue a coin, cryptocurrency is designed to be generated through mining only. Every time a new block is generated, new coins are also generated as a reward for the miners. This kind of concept was designed first by Satoshi Nakamoto, the inventor of Bitcoin. Satoshi Nakamoto wants to distribute bitcoin for free. The free bitcoin will be rewarded to anyone who participated the mining process. There are 2 types of reward that will be given to the miners: new generated coins and the transaction fees included in each transaction by the users.
How mining works?
Each miners solve a very difficult mathematical problem based on a cryptographic hash algorithm. The solution to this mathematical problem is called a proof-of-work and will be included to the block. Proof-of-work will serve as a proof that a miner used up an effort for generating this block. Proof-of-work also gives a right to the miner to write transactions on a blockchain making the blockchain so secured. In mining, a miner also verifies and confirms transactions. These verification and confirmation by miners makes a cryptocurrency decentralized. By the consensus or agreement between miners, it makes no central authority is necessary in cryptocurrency.
Every participant(read about full node wallet here) in the blockchain network holds a copy of a public ledger. This public ledger is sometimes referred to as blockchain. Through mining, this public ledger is maintained, updated and balanced making the network secured and free from fraud.
Who are the miners?
Miners could be anyone who wants to participant on mining in the cryptocurrency network. Their difference from other full nodes or participants is that they run a specialized computer exclusive for mining or ASIC (Application Specifc Integrated Circuit).
Process of mining
A mining node(miner or mining computer) receives and propagates unconfirmed transaction in the network. Mining node groups transactions into a new block. Discovering a new block happens by grouping, arranging, confirming and verifying transactions. All mining nodes are waiting for a new block to be propagated to the network and to their mining node. Receiving a new block means there’s a new winner that mined a new block and received a reward of new issued coins.
How cryptocurrency distributes new coin?
Let’s see Bitcoin as example: Every 10 minutes, 50 bitcoin were given as jackpot prize, 3000 btc per hour, 72,000 btc per day, 2,160,000 btc per year, and 8,640,000 for 4 years. Every 4 years, bitcoin reward for miners are halved. In 2016 the reward was dropped to 12.5 bitcoin per new discovered block after two times of halving. In consensus with Bitcoin network, they have agreed the 21,000,000 coin set by Nakamoto. With the computation above, by year 2041, all 21,000,000 bitcoin will already be distributed.
Other than new issued coins, miners also benefits from the transaction fees. Each cryptocurrency transaction may require small fees for the miner. Miners get these fees by summing up all inputs(income) and outputs(expense) then subtract outputs from inputs. The resulting difference is the reward for miners.
Ex: reward = sum(inputs) – sum(outputs)
Why the heck miners got a fee?
Miners deserves this because of their effort on electricity and hardware. Cryptocurrencies were designed that way so that many people will participate. Miners are very essential in blockchain technology since they’re the ones who arranges and maintains transactions ledger.
Simple analogy about mining
I have learned about this from Bobby Lee, CEO of BTC China. Satoshi Nakamoto wants to distribute Bitcoin for free. He designed a lottery where anyone can join. This lottery(mining) rewards 50 bitcoin for every winner who can discover a new block in the first year. To join this lottery you need a computer and of course internet and electricity. Read more about mining here.