We’re going to break this down step by step. Each of these steps forms part of the understanding of Bitcoin mining
Peer to peer network
We are generally used to using computers with a “client-server” model where the client makes a service request from the server. The key point about a client-server model is that the client is dependent on the server to provide and manage the information.
For example, websites are stored on web servers. A web browser is the client which makes a request to the server, and the server sends the website to the browser.
A peer to peer (P2P) network is created when two or more PCs are connected and share resources without going through a separate server computer. In a P2P network no single provider is responsible for being the server. Each computer stores files and acts as a server. Each computer has equal responsibility for providing data.
What is Bitcoin?
Bitcoin was invented as a P2P network for online payments. It does not require a trusted central authority (no client-server required).
The innovation with Bitcoin is the ability to verify payments using a massive P2P network. This verification is necessary to avoid the “double spending problem”
Double spending problem
Digital things can be copied easily so what stops you spending a Bitcoin more than once? If you buy a cup of coffee you hand over the cash. The merchant gets the cash and you get the coffee. If you buy something using PayPal then the purchase is handled, managed, controlled and verified by PayPal for the buyer and the merchant.
Bitcoin manages the double spending problem by implementing a confirmation mechanism and maintaining a universal ledger (meaning a set of financial accounts) similar to the traditional cash monetary system. This ledger is called the blockchain.
Bitcoin’s blockchain maintains a chronologically-ordered, time-stamped transaction ledger from the start of its operation in 2009.
At last we got here; basically Bitcoin mining is the process by which transactions are verified and added to the blockchain. It is also the means through which new Bitcoins are released.
Anyone with access to the internet and suitable hardware can participate in mining. The mining process involves compiling recent transactions into blocks and trying to solve a computationally difficult proof of work problem.
The participant who first solves the problem gets to place the next block on the blockchain and claim the rewards. The rewards are transaction fees (from the transactions in the block) as well as newly released Bitcoin
Proof of work
Proof of work is a demonstration of the difficulty in making the new block. By difficulty think about the costs and time consumed. Costly in the sense of hardware (PC and processor) and electricity consumed. The time is spent by the computer processing.
It’s supposed to be time consuming
Bitcoin mining is intentionally designed to be resource-intensive and difficult. This is to ensure that the number of blocks found each day by miners remains steady. Remember, individual blocks must contain a proof of work to be considered valid. This proof of work is verified by other Bitcoin nodes each time they receive a block.
The primary purpose of mining is to allow Bitcoin nodes to reach a secure, tamper-resistant consensus. In other words to ensure transactions are valid and to ensure there is no double spending.
The Bitcoin “mining difficulty”
The Bitcoin mining (or network) is the measure of how difficult it is to find a new block (in the blockchain) compared to the easiest it can ever be.
This measure is recalculated every 2016 blocks. It is recalculated to a value such that the previous 2016 blocks would have been generated in exactly two weeks had everyone been mining at this difficulty. That’s worth repeating but essentially it is adjusting the mining of 2016 blocks to 2 weeks by looking at the previous two weeks activity and making the necessary adjustment in difficulty for the next two weeks.
The purpose of this is to control block creation – so if more miners join the rate of block creation will increase. As the rate of block generation increases, the difficulty increases to compensate. This will mean the rate of block creation will decrease so no more than 2016 blocks are created every two weeks.