For more than 10 years, the innovative technology industry has been talking about cryptocurrencies, Bitcoin, hashes, mining, and much more. However, many people still have no clear understanding of what these terms mean or how they work. Today, we will explore the topic of mining and understand how it works.
Mining is the process of solving mathematical problems, resulting in the addition of new blocks of information to a cryptocurrency blockchain. It is the process that enables transaction verification, the addition of new information to the database, and the issuance of new coins into circulation. Its importance lies in ensuring that cryptocurrencies function as a decentralized P2P network.
As follows from this definition, cryptocurrency mining performs three main functions:
- Transaction confirmation — including a transaction in a block.
Miners must verify that a transaction is legitimate before including it in a block that will be added to the blockchain. This is necessary to prevent the same funds from being spent more than once (double-spending). The process of including a transaction in a successfully mined block is called transaction confirmation. - Ensuring security through decentralization.
Miners (full nodes) store copies of the blockchain on their computers, creating a fully decentralized network. This ensures that tampering with information in one copy of the database cannot compromise the blockchain. The more miners participating in the process, the more secure the network becomes. The distributed mining power (hashrate) is what provides the network with its security. - Issuing new coins.
While the fiat currencies we use are issued by central banks, bitcoins are mined. The concept is similar to gold mining, with the key difference being that Bitcoin exists within software, but it must be mined before it can enter circulation. In other words, nodes solve computational tasks and, in return, receive rewards in the form of cryptocurrency.
Nodes are computers connected to other computers (nodes) within the network to record and synchronize information. Naturally, these computers are operated by people, who are referred to as miners.

As you can see, there are many participants, and their actions must follow a common set of rules. This is the purpose of the network's consensus mechanisms. A consensus mechanism is a process that enables the network to agree on the validity and order of transactions that will be added to the blockchain history through the sequential addition of new blocks. This mechanism ensures a clear and unambiguous order of transactions and blocks while guaranteeing the integrity and consistency of the blockchain across all nodes in the network.
Types of Consensus Algorithms Used in Mining
Not all blockchains are built the same, and many differ significantly depending on the type of consensus algorithm they use.
• Proof of Work (PoW) is the oldest and therefore the most widely used consensus algorithm in mining. Under this model, the largest mining reward goes to the miner with the most powerful hardware.
• Proof of Stake (PoS) is built on a different principle. In this system, the legitimacy of transactions is verified by special nodes called validators, which are selected based on a combination of several factors: the number of coins held in the validator's wallet (stake), the age of the stake, and randomization. Participants (stakeholders) voluntarily lock up a portion of their assets, thereby contributing to the operation of the consensus mechanism. The more assets they stake, the greater the reward they receive. In this process, computing power plays little to no significant role. Transaction validators receive only a portion of the transaction fee as their reward.
Proof of Stake vs Proof of Work
| Proof of Stake | Proof of Work |
|---|---|
| Transactions are validated by a validator selected based on the amount of coins staked, the age of the stake, and the participant's activity. | Mining is required, involving complex computations performed using powerful computing hardware. |
| There is no block reward. Transaction validators receive only the transaction fees. In DPoS and LPoS systems, validators share their rewards with the participants who supported them by staking their coins (votes). | There is a reward for creating a new block in the form of newly issued coins. It is awarded to the first miner who solves the mathematical puzzle. There is also a reward for verifying transactions in the form of transaction fees. |
| PoS is highly cost-effective for investors because there is no need to purchase powerful computing hardware such as ASIC miners. | PoW is cost-effective only with very large investments that provide an advantage over other miners, and only if the market value of the mined coin is high. |
Today, there are many variations of the PoS algorithm. One of the most popular is Delegated Proof of Stake (DPoS). There are also Byzantine Fault Tolerance (BFT) and other consensus mechanisms. We will not go into them in detail.
Bitcoin Mining. How Does It Work?
Let's imagine that a user wants to send a certain amount of Bitcoin to another person and confirms the transaction in their wallet application.
The wallet application broadcasts the transaction to the Bitcoin blockchain network. There, it enters the pool of unconfirmed transactions (mempool), where it remains until it is picked up by a miner. This pool consists of unconfirmed transactions waiting to be processed. In most cases, unconfirmed transactions are not stored in one giant pool but are distributed across multiple smaller local pools.

Step 1. Creating a Candidate Block: When a miner receives notification that the previous block has a valid Proof of Work (PoW), they begin creating a candidate block. It is called a candidate block because it does not yet have a valid Proof of Work. The miner removes any transactions that have already been included in the previous block, selects transactions from the transaction pools, and starts building their own block. The same transactions may be included by multiple miners in their respective candidate blocks, and each miner simultaneously begins searching for the hash (digital signature) of their own block using their own set of unconfirmed transactions. Thus, a block is essentially a collection of transactions (which, at this stage, are still unconfirmed) along with additional metadata. Before adding a transaction to a block, the miner must verify that it meets the execution requirements based on the transaction history recorded on the blockchain, in order to prevent double-spending of cryptocurrency, as mentioned earlier. If the sender's wallet contains sufficient funds according to the existing blockchain transaction history, the transaction is considered valid and can be included in the block.
Â
Step 2. Signing the Block: Before a block can be added to the blockchain (meaning that all nodes on the blockchain will record the transactions contained in that block), it must first have a digital signature. This signature is created by solving a highly complex mathematical problem that is unique to each block of transactions. A block consists of two main parts: the Header and the Payload (the list of transactions). The block header contains data from both the previous block and the current block, making it impossible to tamper with any block without invalidating the chain. The block header also contains a special number called the nonce, which the miner must discover. The miner finds this nonce through trial and error (brute-force search) and, once found, generates the block's hash (digital signature). Solving this mathematical problem requires enormous computing power (and, consequently, a significant amount of electricity), because the entire process relies on repeatedly testing different values until the correct one is found. This process is known as mining.
Let's explain the mining process in a bit more technical detail. If you don't want to dive into the technical aspects, you can skip ahead to Step 3.
Mining, also known as hashing (the Proof of Work consensus algorithm), works as follows.
The mathematical problem every miner must solve when attempting to add a block to the blockchain is to find the hash(also called a digital signature) for the data contained in that block. Moreover, the resulting hash must begin with a certain number of consecutive zeros (this determines the mining difficulty). Sounds like a very difficult task, doesn't it? In reality, it's not as complicated as it may seem. Let us explain it in a simplified way.
As mentioned earlier, every block consists of two main parts: the Header and the Payload. Header contains the information responsible for the stability and immutability of the network. Payload contains the list of all transactions that are to be stored in that block and added to the blockchain.
In a classic blockchain, the Header contains the following fields:
- Version — the version number
- Hash of the previous block (prev_block)
- Hash of all transactions in the current block (mrkl_root)
- Timestamp (Time) indicating when the block was created
- Bits and Nonce, which are used in the mining process
Before we continue, it is important to understand what a hash function is. Simply put, a hash function is a mathematical problem that is very difficult to solve but very easy to verify once the result has been obtained. A hash function takes an input string consisting of letters and numbers (literally any string of random letters, numbers, and/or symbols) and converts it into a new 32-character string made up of seemingly random letters and numbers. This 32-character string is called the hash. If even a single letter or number in the input string changes, the resulting hash will also change completely and unpredictably. However, the same input string will always produce exactly the same hash.
Now keep in mind that the data contained within a block serves as the input for the hashing process. We take the entire block data: version, prev_block, mrkl_root, time, bits, nonce, along with the list of all transactions the miner has selected from the mempool. After this input is processed by the hash function, the result is a hash (a 32-character string). However, our goal is to obtain a hash that begins with a specific number of consecutive zeros. This is because the rules of the Bitcoin blockchain specify that only blocks whose digital signatures (hashes) begin with a required number of leading zeros are eligible to be added to the blockchain. This is how the blockchain regulates the mining difficulty. Everything would be simple if the output generated by the hash function were predictable. However, for different input data, the resulting hash is always effectively random. So what happens if the block data, after being processed by the hash function, does not produce a hash that begins with the required number of consecutive zeros? This is exactly why miners repeatedly modify a small portion of the block's data known as the nonce—our "magic number." Each time the miner changes the nonce, the structure of the block's data changes slightly. And whenever the data inside the block (its input) changes, its digital signature (the output hash) changes as well. As a result, every time the block's nonce is modified, the block receives a completely new, seemingly random hash.

Miners repeat this process of changing the nonce over and over again until they eventually, by chance, produce an output string that satisfies the block signature requirements (a hash beginning with the required number of consecutive zeros). The example above illustrates this process. In the example, three leading zeros are used, but in reality, the required number of zeros depends on the block's mining difficulty. Mining difficulty is a more advanced topic, so we recommend exploring it separately at a later stage. This is exactly how miners search for a valid signature for their block, and it is also the reason why solving this mathematical problem requires such enormous computing power. Testing an immense number of nonce values in an attempt to find the correct one takes considerable time and computational resources. It is also important to understand that as the total hashing power of the blockchain (that is, the number of miners) increases, the mining difficulty increases as well. As a result, the average amount of electricity required to successfully mine a block also rises.
Step 3. The miner who is the first to find a valid signature for their block broadcasts the block and its signature to all other miners on the network.
Step 4. The other miners now verify the validity of the signature by taking the data of the broadcast block and hashing it to confirm that the resulting hash matches the signature included in the block and begins with the required number of leading zeros (remember—it is difficult to find but easy to verify). If the signature is valid, all other miners confirm its authenticity and agree that the block can be added to the blockchain (in other words, they reach consensus—they all agree with one another. This is where the term consensus algorithmcomes from). This is also the origin of the term Proof of Work. The digital signature serves as the required proof that the computational work has been performed (that is, that computing resources have been expended). The block can now be added to the blockchain and distributed to all other nodes on the network. The nodes, in turn, accept and store the block by adding it to their copy of the blockchain, provided that all transactions within the block are valid according to the transaction history already recorded on the blockchain. The miner receives a Bitcoin reward for their work. Once the block has been added to the blockchain, every subsequent block added after it is considered a confirmation of that block.