Bitcoin Mining

Bitcoin Mining is like a giant lottery where the ticket is computing power and electricity. If you participate, your computer will be trying to generate a hash that matches the current difficulty of the network. That hash is generated using double SHA-256 by adding a set of information in the block header and hashing it. Miners compete to find a hash below a target value, requiring significant computational power and energy. The first to solve it broadcasts the solution, and if verified by the network, they earn a block reward (newly minted bitcoins plus transaction fees). The difficulty adjusts every 2,016 blocks to maintain a ~10-minute block time. PoW secures the network, ensuring Bitcoin’s decentralised, trustless operation by making attacks computationally expensive.
To learn how SHA-256 works, check the chapter The Blockchain.
The Block Header
This is a decoded version of the block header from block
00000000000000000000442ec33b694ec198ecce81ec54fb00156022e1838e3f at height 924, 444:

On the block, you can see all the data from the block header:
Version: The version number of the block.
Previous block hash: The block hash of the previous block, forming a chain.
Merkle root of transaction hashes: A fingerprint of all transactions included in the block, enabling efficient verification.
Timestamp: The current time of the block, in Unix* timestamp format.
Bits: A compact representation of the current mining target.
Nonce: A 32-bit (4-byte) integer in the block header, which miners keep changing until the SHA-256 output meets the difficulty.
Below is the hexadecimal version. This is what got hashed as binary bytes twice with SHA-256. This one met the difficulty requirement to win the block.
00e00220c729a477609bb8ee47eddc43bd0fc5c2602e0b8c1ba200000000000000000000b91457ba322b3ed5b556b969f4dd2808995fa983054233946a0a1c42a5f53462f0471f6936d901171a2435ce
Try it yourself by copying the block header and use the double SHA-256 calculator below:
00e00220c729a477609bb8ee47eddc43bd0fc5c2602e0b8c1ba200000000000000000000b91457ba322b3ed5b556b969f4dd2808995fa983054233946a0a1c42a5f53462f0471f6936d901171a2435ce
The Big-Endian result (leading zeroes) is what will be displayed on all the blockchain explorer as the block ID. The Little-Endian result (trailing zeroes) is what is processed internally within the software.
Finding the right hash
The goal of a miner is to find the right hash that corresponds to the current difficulty of the network. The difficulty adjusts every 2,016 blocks to maintain a ~10-minute block time. This is to ensure that the new Bitcoin supply remains predictable, like the halving every 210,000 blocks (or roughly every four years), and the last fraction of Bitcoin to be mined around the year 2140.
The difficulty is set by a target value (lower = more difficult), or put it simply, how many leading zeroes in the 64-character hash.
Did you know?
You might think that Satoshi picked a random number for the difficulty adjustment (2016 blocks interval).
But if you reverse the number, you get 6102: the infamous 1933 Executive Order by Franklin D. Roosevelt that banned private gold ownership for Americans.
Satoshi may have embedded a quiet message: Bitcoin is digital gold that cannot be seized the same way.

Bob wants to start Bitcoin mining

To do this, he provides computing power coupled with electricity.
Today a dedicated computer that only mines Bitcoin is essential for efficiency, the one used for Bitcoin mining are called ASICS miners.

His Bitcoin miner will hash the block header trillions of times
by changing the nonce on the block header each time and the timestamp as required.

This is the result of hashing the above block header twice using double SHA-256.
This result doesn’t fit the right difficulty, so we must try again.

As you can see, by only changing one number from the block header nonce, the hash result is entirely different. This is what SHA-256 does; even changing as little as one input, the output will end up completely unrecognisable from the previous one, making changes unpredictable and drastic. Let's try again!

That’s it! By changing the nonce one more time, we found the correct hash output. This block was already mined, so I knew the right block header to hash, but in reality, it takes trillions of tries to get the right result.
The double SHA-256 output, when interpreted as a little-endian integer, has trailing zeros indicating a small numerical value that meets the difficulty target.

For display, the bytes are reversed to big-endian, shifting those zeros to the front for human readability. This is the hash you will find in block explorer.
Fun fact
Did you know that the number of bitcoins mined in each block is also the percentage of the total supply that will be mined in that halving? During this halving, the mining reward is 3.125, and through this halving, 3.125% of the bitcoin supply will be mined.
A new block added to the blockchain.
Bob found the right hash meeting the current difficulty of the network by hashing the block header, now all the rest of the information gets added to that block, that is, the transaction count and the list of transactions.
This is block 00000000000000000000442ec33b694ec198ecce81ec54fb00156022e1838e3f at height
924, 444.

Block hash: Double SHA-256 hash that successfully met the network difficulty, it becomes an unique identifier for the block.
Block header: Hexadecimal version of the block header.
nTx: The number of transactions included in this block.
Coinbase transaction: The first transaction in the block is a special one that creates new Bitcoins to reward the miner, plus the fees from all the transactions included in the block. The reward is cut in half every 210,000 blocks (or roughly every four years). The Coinbase transaction is mandatory in every block; without it, the block would be invalid.
Regular transaction: All regular transactions that the miner selected from the memory pool (often called mem pool). The miner is free to add as many or as little amount of tx in their block, as long as it doesn’t exceed the block size limit. Tx all includes fees, so they are incentivised to add as many as possible.
From there, Bitcoin nodes all around the world will verify that the block is valid and follow the rules. If it does, it will be added to the blockchain, therefore granting the Coinbase transaction to the miner, making him the owner of the full block reward (subsidy and transaction fees). If the miner doesn’t follow the rules, the nodes will reject his block, therefore loosing his reward after spending an enormous amount of resources. The nodes operate independently and are very cheap to run; this is to allow for wide decentralisation as seen in the chapter “The Blockchain”.
Bitcoin mining is worldwide.
People mine Bitcoin all around the world because all you need is internet, computing power, and electricity to start mining a global currency that no one can temper with or seize. The financial incentive allows for global mining adoption as miners chase cheaper electricity and Bitcoin-friendly countries to host their mining rigs.
When a country decides to ban Bitcoin, they simply move to a different country. The only thing that could stop Bitcoin mining is a worldwide power or internet outage, but if that ever happens, we will have bigger problems on our hands than Bitcoin mining. Even then, it will simply resume as normal when power or internet comes back.
Security through Proof of Work (PoW)
Mining Bitcoin demands substantial computational power and energy, making it costly for malicious actors to attempt attacks like double-spending or rewriting the blockchain. To alter a block, an attacker would need to control 51% of the network’s hash rate, an economically prohibitive feat due to the decentralised network of miners.
Even if a miner gained 51% of Bitcoin’s network hash rate, launching an attack (such as double-spending or rewriting the blockchain) would be economically irrational. Such an attack would erode trust in Bitcoin, crashing its value and rendering the miner’s rewards worthless. The massive capital invested in specialized ASIC miners, which are purpose-built for Bitcoin mining and useless for other tasks, plus the enormous electricity costs, represent a sunk investment. Destroying Bitcoin’s value would ruin the miner’s business, as their infrastructure relies entirely on the network’s success, making cooperation more profitable than sabotage.
In summary, PoW ensures Bitcoin’s integrity, immutability, and trustless operation, safeguarding the network against tampering and fraud.
Conclusion
-
Bitcoin mining enforces blockchain finality, making it impossible to cheat (like spending the same Bitcoins twice). The block must follow the consensus rules to be relayed by the nodes. If it doesn’t, the block reward will not be received. This creates an incentive for the miner to follow the rules and make sure any transactions he adds to his block follow them too. This is how Bitcoin can operate without a central authority.
-
The competitive environment of mining also makes it more secure, because if anyone wanted to control the transactions being added to the blockchain, they would need enough computing power to surpass the rest of the network (51% attack). That would not only be extremely difficult and costly, but by doing so, the attacker would hurt the value of Bitcoin, which would make his loot worthless. Any operator that tries to cheat or control Bitcoin will end up with a massive financial loss.
-
The difficulty adjusts every 2016 blocks (or roughly every two weeks) to ensure that a block will be mined roughly every 10 mins. This is crucial to ensure Bitcoins are released per schedule. Bitcoin halving happens roughly every four years (210,000 blocks), and the last Bitcoin ever mined should be in the year 2140. This is crucial to maintain Bitcoin’s scarcity values by having a tight, ever-decreasing inflation schedule.
Is Bitcoin mining worth it for you?
Bitcoin mining’s worth depends on electricity costs, hardware efficiency, and Bitcoin’s price. High energy prices and competition from large-scale miners with advanced ASICs make it unprofitable for small-scale miners unless electricity is cheap (below $0.05/kWh). Efficient hardware like the Bitmain Antminer S19 can still yield profits in low-cost regions, but upfront costs (us$2,000-$5,000) and halving events reducing rewards (currently 3.125 BTC per block) shrink margins. For most individuals, mining is less profitable than buying Bitcoin directly, but it can support network security and decentralisation if done strategically.
You can use a mining calculator such as CoinWarz to work out if mining can be profitable for you depending on the miner you're looking to buy.
Solo Mining
Solo mining with low-power lottery miners like Solosatoshis offers an alternative to pool mining for those with high electricity costs. These compact devices use minimal energy, costing just a few dollars monthly, while still contributing to Bitcoin’s network decentralization. Unlike pool mining, where rewards are split, solo mining gives a slim but real chance to win a full block reward (currently 3.125 BTC plus fees), making it a low-cost, high-reward gamble for supporting the network. I personally use a Bitaxe Touch and find it amazing.
Check out their website by clicking on their logo below.
Links to more mining equipment:
Just click on the images below to visit their website.






