On the Bitcoin network, Mining is the method that, both creates new bitcoins and updates the decentralised ledger with transactions.
The thing that is special about bitcoin as a currency is that it decentralised. With old fashioned fiat currency, a centralised bank keeps track, in a ledger, of how much money is created and in the case of sending money over the internet, who owns how much money. With Bitcoin, no one person has control of the ledger. Anyone can download the bitcoin software and run a Bitcoin “node”. This node keeps track of the records of transactions in a public ledger called the “Blockchain”.
A full node has an entire copy of the blockchain, it verifies the block chain is valid by ensuring the consensus rules are enforced. It requires a lot of storage (currently over 140GB).
A light node, only has a part of the blockchain that it requires. In order to work, it needs to be connected to a full node. This requires some trust in the full node, but can be made more secure by connecting to multiple full nodes
When you spend some bitcoin, you create a “transaction” and this transaction is shared to the network of Bitcoin nodes. “Miners” then verify the transactions and ensure that the bitcoin you spent isn’t duplicated and then these transactions are added to the blockchain. On its own this takes very little computing effort, and if you had enough powerful computers it could be easy to fool the rest of the network and create fraudulent transactions to add to the blockchain ledger.
This is where mining comes in. In order for a miner to add transactions to the network, they take a list of transactions, perform some mathematical work on them and then try to find a “hash” solution to create a block.
This hash solution is
1) much smaller in size than the list of transactions
2) very hard to find
3) but very easy to check that the hash corresponds to the list of transactions.
This process is required to make it too costly to be dishonest and try and add fake transactions. The hash is considered to be proof that the miner did the costly mathematical work and the network of nodes sees this “proof of work” and agrees to add the block to the block chain. The name blockchain comes from the fact that it is simply a chain of these hashed blocks.
The process of mining takes a lot of computing power. As a result, not only does it require time and hardware investment but it consumes electricity to perform. In order to reward miners for their effort and resources, when a hash is found, new bitcoins are created and rewarded to the miner. Initially in 2009 when Bitcoin was first developed, the reward for miners was 50 bitcoins. This “block reward” halves every 210,000 blocks, which works out to around every 4 years. Currently, the reward has just been halved to 6.25 bitcoin. This not only incentivises miners to try and find the solution but also to ensure the integrity of the network as miners who have invested resources would not want to have the security and integrity of bitcoin to be questioned and value to drop as a result.
Miners are basically full nodes but also listen to transactions and put them into blocks. It needs to proof of work to do this and the block reward is the incentive to do this.