DEV Community

Cover image for Let Us Mine!
Apoorv Tyagi
Apoorv Tyagi

Posted on • Edited on • Originally published at apoorvtyagi133.blogspot.com

Let Us Mine!

With all this recent craze in bitcoins, many wonder how these bitcoins generate since there is no central power who controls all this.
The answer is through MINING.

So what exactly is bitcoin mining?

Bitcoin mining is the process of updating the ledger of bitcoin transaction known as blockchain.

Anyone can do mining who posses extremely powerful computers like ASICs which compete against other miners to find a specific number which is known as the 'Target'.
The miner who gets the target number first updates the ledger and get rewarded with 12.5 bitcoins(currently).

But not everyone sitting at their home can do that because miners have to hash many combinations of letters, numbers and characters until the resulting hash contains the required number of leading "0"s which is called a target.

The more powerful your computer is, the more guesses you can make per second, increasing your chances of winning this game.

If you manage to guess right, you earn bitcoins and get to write the next page of Bitcoin transactions on the blockchain.

what-ifitold-you-bitcoin-mining-uses-more-electricity-than-139-29294504.png

What does those powerful machines solve?

The miner takes a list of all the active transactions, and then groups them together which is called a "block", if i put it more accurately - the miner software converts all the transactions in a summary view called a "merkle root", and hashes it, which is representative of the transactions.

The mining software then converts this to into a binary format called a Block Header, which references the previous blocks as well(also called a chain).

The miner then changes a small portion of this block called a "nonce". The block header is hashed and compared simply to the Target like 10,000>7,000 (the real numbers are much bigger, and in hexadecimal). An expanded target looks like this: Target=0000000000000083ef000000000000000000000000000000000. And the goal is to make sure the SHA256 hash of the block is less than this value.

How to start mining?

Now that we know what is mining you might wanna start doing it BUT Satoshi Nakamoto made some rules regarding mining in a way that the more mining power the network has, the harder it is to guess the target to the mining math problem.

So the difficulty of the mining process is actually self-adjusting to the accumulated mining power the combined network has. If more miners join, it will get harder to solve the problem; if many of them drop off, it will get easier. This is known as bitcoin mining difficulty.
Mining difficulty is set so that, on average, a new block will be added every ten minutes (i.e., the number will be guessed every ten minutes on average).

Another thing is Bitcoin Mining pool, assuming you’re just entering the Bitcoin mining game, you’re up against some heavy competition. Even if you buy the best possible mining machine out there, you’re still at a huge disadvantage compared to professional Bitcoin miners That’s where mining pool comes into existence.

The idea is, multiple miners group together to form a pool (i.e., combine their mining power to compete more effectively). Once the pool manages to win the competition, the reward is spread out between the pool members depending on how much mining power each of them contributed. This way, even small miners can join the mining game and have a chance of earning Bitcoin.

Final Words

So the bottom line is that bitcoin and other cryptocurrencies like ethereum are a high risk high reward investment, if you can afford to spend heavily on expensive equipment and energy bills then it is the right thing to do but still with a little uncertainity about the economic role it will have in future since in many countries digital coins are ban.

Other articles that you might like

  • Improving Time Complexity - Understanding how to improve the time complexity of your code.
  • GPT-3 - A large open source state-of- the-art language model with more than 175 billion parameters by OpenAI.
  • Merkle Tree - A special data structure with hash pointers.

If you like what you read here and want to show support, consider buying me some coffee

Top comments (0)