DEV Community

Cover image for What is Blockchain Mining? And how does it happen?
Saroj
Saroj

Posted on

What is Blockchain Mining? And how does it happen?

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

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

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.

Top comments (0)