Lumerin Blog
Published in

Lumerin Blog

Bitcoin mining 101

What is Bitcoin mining?

Understanding the Bitcoin mining process for beginners

Photo by Brian Wangenheim on Unsplash

Everyone with some knowledge of Bitcoin knows that mining requires powerful computers to perform calculations to provide security to the network.

However, not many know what the actual process consists of and how it works from start to finish.

This article will explain how Bitcoin’s mining process work from A to Z in its most basic terms.

Bitcoin basics: What is SHA-256?

Before we dive into mining, we have to understand how hashing works.

Bitcoin is protected by a hashing function called SHA-256, an algorithm that converts an arbitrary data input of any length to a hexadecimal code of a fixed length — 64 characters, to be precise. This 64-digit string of code is what we know as “hash.”

Photo by Twitter @ethmessages on Unsplash

The SHA-256 algorithm will always return the same hash if you input the same data. However, if you change something as small as a capital letter, the hash obtained in return will change completely.

There’s no correlation whatsoever between the 64-digit code and the original message, so it’s virtually impossible to deduct the data introduced by knowing the hash without proper equipment.

Give it a try! Use this SHA-256 hashing simulator to see how you can encrypt data and how hashes change when you modify the input.

Bitcoin blocks and mining difficulty

As you may know, blockchains are called that because all the data is stored in small containers called blocks. These blocks are, in turn, linked to their predecessor, hence forming a “chain.”

Bitcoin blocks have a capacity of 1MB, which enables them to store two sets of information:

  • A handful of Bitcoin transactions.
  • The block’s metadata — called block header.

In turn, the block header contains:

  • The hash of the previous block, needed to link back to the chain.
  • The mining difficulty under which the block was found, a timestamp, and the block’s nonce (we’ll come back to this term later).
  • The merkle root — a data structure that summarizes all the transactions included in that block.
Photo by Shubham Dhage on Unsplash

How are blocks recorded in the blockchain? Once miners compile all the information required to make their block valid, they must meet the network’s difficulty target.

Bitcoin adjusts its difficulty by setting a specific target for a new block’s hash. All new blocks need to have a hash equal to or less than the target set. To do that, the network determines that the hashes need to start with N amount of zeros.

0000000000000000000af8ea3aa782a1c74e91b45d306663c2145235b362904a

— Hash of block #710859

The first miner to find a hash that meets these requirements gets to record the block and earn the reward. Now, let’s see how they can do that.

Bitcoin mining and how to “find blocks”

Let’s rewind a little: We started this article by explaining how the SHA-256 function returns a 64-digit string of code specific to a particular data input.

We’ve also seen how miners have to find a hash that meets the difficulty requirements of the network to create and record a block in the blockchain. Miners can do this by adding a particular number to the block: the nonce — or number only used once.

Photo by Mika Baumeister on Unsplash

Remember how even the slightest modification to the data input would make the SHA-256 function return a completely different hash? This is precisely what miners do to try to find a hash that meets the difficulty targets. And this is also the particular part of the process popularly referred to as mining.

By adding a random number — the nonce — to the block’s data, miners get a different hash for that block. They keep trying other numbers until the hash they obtain in return meets the difficulty targets.

The reason why miners are constantly trying to expand their hashrate is that the more of these “guesses” you can try per second, the more likely you are to be the one who finds it first, thus earning the reward.

Don’t forget that each block contains the previous block’s hash, so once a block is confirmed and added to the ledger, miners have to start a new block from scratch.

Photo by Jeremy Bezanger on Unsplash

Final steps and considerations

After miners find a block, they transmit it — along with its valid hash and all the data — to validator nodes, who check that the block effectively meets the networks’ parameters.

Once the block is correctly verified, it is recorded on the public ledger permanently. The process then starts again, with miners including other transactions in a new block.

Summing up, the Bitcoin mining process can be broken down into these steps:

  • Bitcoin establishes a difficulty target for new blocks’ hashes according to the network’s total hashrate.
  • Miners select the transactions and data they want to include in a block and start “guessing” by trying a different nonce until they come up with a valid hash.
  • After they “find the block,” they send it to validator nodes, who verify that it meets all the requirements and record it on the blockchain.

We hope this article was helpful and cleared some of your doubts about the very complex process that is Bitcoin mining.

If you have any questions, don’t hesitate to ask them right here in the comments or in any of the Lumerin social channels, where you’ll be welcomed by a growing, friendly community.

Did you learn something new?

We publish educational content like this article every week. Make sure to follow us on Medium so you don’t miss it. You can also subscribe to our blog and visit Lumerin.io for more information. We’ll be glad to have you!

Join the Lumerin community!

--

--

--

An extensive library of newsworthy, analytical, and educational content regarding cryptocurrency and crypto mining. By Lumerin Protocol, built by Titan Mining.

Recommended from Medium

GARI Mining - Create-2-Earn, Watch-2-Earn, Engage-2-Earn

Interview with Dr. Giovanna Massarotto, UCL Blockchain Rules Online Programme Coordinator

Zilliqa — The First Sharded Public Blockchain

AMA Session with Edverse: Decentralize and Democratize Education in Metaverse

Blockchain In Medicine: Integrating Technology Into Modern Healthcare

Data Day 10/13

From a remote Sichuan village, blockchain technology is helping rural farmers sell tea leaves in a…

About us

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Lumerin Protocol

Lumerin Protocol

Making crypto mining hashpower a tradeable commodity. Built by Titan Mining. Visit us on https://lumerin.io/.

More from Medium

How to choose a Bitcoin mining pool

XDC Network Smart Contract Growth by the Numbers

An update on what’s coming

Weekly update from PointPay (February 28 – March 4, 2022)