# Technical Explanation of Mining

In this article, let’s examine the technical aspects of crypto mining. In the blockchain, every block has a previous block except the very first block or the genesis block. Miners are competing to validate a new block by solving a complex mathematical puzzle. To explain in details, let’s take a look at the latest bitcoin mined block, block #540909 at the time of writing this article.

Notice that the block height is 540909, which means there are 540909 blocks in the bitcoin blockchain.

Let’s call the successful miner for this block Mr.John. Before John successfully mines block #540909, he was actually competing with other miners in mining the previous block #540908. However, he lost in the contest and block #540908 was mined by a fellow miner. As soon as block #540908 was mined, he needs to quickly update his blockchain and starts mining for a new unvalidated block, known as the candidate block.

In actual fact, while John’s computer(also known as a node)  was searching for the Proof of Work for the previous block, it was also searching for new transactions. Those new transactions are added to the memory pool or transaction pool.  The memory pool is a node’s temporary storage area for transaction data. This is where transactions wait until they can be included in a new block and validated.

In constructing the candidate block, John’s node starts gathering the transactions in the transaction pool. It removes the transactions already present in the previous block if there are any. The block is called a candidate block because it doesn’t have a valid Proof of Work yet.

As you can see that block #540909 has 1696  transactions inside it. This was the number of transactions present in John’s transaction pool when he created his candidate block. The mining process can be illustrated in the following figure.

In the mining process, John’s node is creating a coinbase transaction. This transaction is to create some bitcoins and deposit them into John’s wallet as a reward for finding a valid Proof of Work. This transaction is different from the other ones because the bitcoins in the reward are created out of nothing. They do not come from someone’s wallet. Besides that, John’s node also calculates the transaction fees in the block.

John reward by mining this block is as follows;

Total Reward =  Reward for mining block + transactions fee

= 12.5 BTC+0.15289664 BTC

= 12.65289664 BTC

The details of the transaction is as follows:

You can see the No Inputs (Newly Generated Coins) statement. It is because coinbase transactions do not come from anyone’s wallet, so they cannot have any inputs. You only have the winning miner’s wallet address here