Hashing: What crypto miners actually do…

Giottus
4 min readMay 23, 2022

By: Sruthi Menon

Bitcoin is a digital form of currency that works like money. Unlike traditional forms of currency, bitcoins are entirely virtual and must be “mined” using sophisticated computer hardware and software.

The traditional fiat that we know is produced by printing whereas bitcoin is produced through mining. In the most basic terms, cryptocurrency mining is the process of using computer power to verify crypto transactions and create new coins.

This process of blockchains requires solving complex equations. A miner is someone with a supercomputer that runs a mining program in it. Whoever solves the puzzle first can add a new block to the blockchain and make some money as well. On solving, new bitcoins are generated and awarded to these miners and that is how new bitcoins are created.

If you are thinking that there can be infinite bitcoins that can be mined, then you are wrong! There are only 21 million bitcoins that can be mined and until now 12 million have been mined.

So, now we know what mining is, but what are these computers decrypting? What is this puzzle that the bitcoin miners are constantly trying to solve?

The cryptographic hash puzzle

By now, you must have heard about hashing. According to Bybit Learn, “Hashing refers to the transformation and generation of input data of any length into a string of a fixed size, which is performed by a specific algorithm. In particular, the Bitcoin hash algorithm is SHA-256 or Secure Hashing Algorithm 256 bits.” Hashing is the technique of creating a fixed-size output from a variable-size input.

Let us consider bitcoin mining like a big data center. Numerous supercomputers are working to perform the calculations required to verify and record each new bitcoin transaction and ensure blockchain security. Every machine on the network competes to be the first to guess a ‘hash’, which is a 64-digit hexadecimal number. The miner is more likely to get the incentive if the computer can spew forth guesses quickly. To find this, the only option is to attempt all possible digit combinations of varying lengths, one by one.

Each transaction has its own hash, which is held in a tree-like structure known as the Merkle root or Binary hash trees. The Merkle root is a mathematical data structure composed of hashes of several data blocks that summarizes all transactions in a block. All transactions are recorded using this technique and are used to encrypt blockchain data more efficiently and securely. It also allows for fast and safe content verification across large databases, ensuring data consistency and content.

You might think that a miner with the most powerful computer always wins in the processing of mining. But the system in fact works like a lottery system. Even if the individual with the most tickets has a higher probability of winning, there is no assurance that they will win every time.

The task of a miner is to collect unconfirmed transactions from the memory pool and group them into a block that they will try to validate.

Each transaction is hashed, and their outputs are sorted into pairs after the list of unconfirmed transactions is produced. These pairs are hashed again, resulting in fresh outputs that are also grouped into pairs and hashed. The is repeated until only one hash remains.

The function of hash in cryptography

Cryptographic hash functions are an essential part of the bitcoin mining process and are executed to ensure the integrity of the transactions. Hashing requires high power as it deals with massive amounts of information.

Hashing is used by all cryptocurrency protocols to link and condense groups of transactions into blocks, as well as to create cryptographic links between each block, resulting in a blockchain.

Two miners cannot hash the same blocks and hence mining remains decentralized. All miners will have to keep hashing until they find a number that provides a result that the network accepts when their block is uploaded to the blockchain.

In a nutshell, miners must perform a plethora of hashing operations to obtain a valid solution for the next block and this is what makes the Bitcoin network safe.

--

--