What is Blockchain Mining? And how does it happen?
Tags: blockchain, web3, crypto, webdev
Published: 2022-04-17 03:51:27

**Well,**

I hope all are doing good. Today we will see about blockchain mining and its process.

Cool!

**So, what exactly is Blockchain mining?**

Any idea?

In simple words, Mining is the process of recording new transactions on the blockchain ledger. Or we can say, it is the process by which we can add a new block inside a blockchain network.

_Saroj, what is this process, what is mining, it's confusing... huh! explain more._

wait guys, we will see in-depth!

:)

**Process of Mining**

As you know, a blockchain is a decentralized network(_or group of nodes_), and there is no central or head node. So when a new node wants to join that network, it's not possible to join directly. It must have some process to add to that network, it's called the Mining process.

_Ohh is it? Saroj, we got some idea about Mining Process, but who actually add this node into the network?_

Yaa, Good question.

_So, who will do the mining?_

Miners need to do the Mining! A miner is nothing but a computer or group of computers. Humans can also be a miner, but the solution is more complex for us to solve. A Miner needs to do some solution to add a block. Mining rewards are given to the miner who first finds the solution to a complicated hashing problem(_solution_).

**Still, getting confused? Let's try to understand using a diagram.**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i7awmocz5ray46jlesh0.png)

Let's say I am a miner. I need to solve a mathematical solution to add a block to the network. If I found the solution, then the block will be added to the blockchain network. But, what happens if I am not able to find the solution? In that case, my transaction will be added to the transaction pool. It is nothing but, a group of unconfirmed transactions, that are waiting to be added.

**wait wait... it's not finished yet!**

Let's imagine, there is a blockchain network containing 30 blocks. And there is a hacker, he/she wants to hack this network by adding a new block or group of blocks. Then it's a problem, right?

_yes Saroj, it's a big issue. How can we solve this issue?_

Here, the Longest Chain Rule comes into the picture. :)

**Longest Chain Rule**

The longest chain rule is a rule that a miner must follow if he/she wants to do the mining.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nn04bvlu65lvsgo21gzy.png)

Let's say, there are two groups of blocks(_nodes_), one is about 6 blocks, and the second one(_attackers_) is about 3 blocks. In that case, the blockchain network will accept only the longest chain blocks(_group one_) and the second group will be rejected. A blockchain with more blocks will consume more energy to build than a chain with fewer blocks. And, always node follows the longest chain rule.

**Also, mining is two types**

- Solo Mining
- Polo Mining

In solo mining, only 1 computer is involved in the mining process, whereas in the case of polo mining, a group of computers is involved in the mining process.

**Got some idea about mining and miners?**

_yes man, thanks for the great info about mining and miners._

**Great!**

Thank you guys for reading this article. I hope you found it interesting :)

See you soon with a new article.