How Bitcoin Mining Works

von Satoshi Nakamoto

Last updated: 29th January 2018

When you hear about bitcoin "mining," you envisage coins being dug out of the ground. But bitcoin isn't physical, so why do we call it mining?

Because it's similar to gold mining in that the bitcoins exist in the protocol's design (just as the gold exists underground), but they haven't been brought out into the light yet (just as the gold hasn't yet been dug up). The bitcoin protocol stipulates that 21 million bitcoins will exist at some point. What "miners" do is bring them out into the light, a few at a time.

They get to do this as a reward for creating blocks of validated transactions and including them in the blockchain.

Nodes

Backtracking a bit, let's talk about "nodes." A node is a powerful computer that runs the bitcoin software and helps to keep bitcoin running by participating in the relay of information. Anyone can run a node, you just download the bitcoin software (free) and leave a certain port open (the drawback is that it consumes energy and storage space – the network at time of writing takes up about 145GB). Nodes spread bitcoin transactions around the network. One node will send information to a few nodes that it knows, who will relay the information to nodes that they know, etc. That way it ends up getting around the whole network pretty quickly.

Some nodes are mining nodes (usually referred to as "miners"). These group outstanding transactions into blocks and add them to the blockchain. How do they do this? By solving a complex mathematical puzzle that is part of the bitcoin program, and including the answer in the block. The puzzle that needs solving is to find a number that, when combined with the data in the block and passed through a hash function, produces a result that is within a certain range. This is much harder than it sounds.

(For trivia lovers, this number is called a "nonce", which is a concatenation of "number used once." In the case of bitcoin, the nonce is an integer between 0 and 4,294,967,296.)

Solving the puzzle

How do they find this number? By guessing at random. The hash function makes it impossible to predict what the output will be. So, miners guess the mystery number and apply the hash function to the combination of that guessed number and the data in the block. The resulting hash has to start with a pre-established number of zeroes. There's no way of knowing which number will work, because two consecutive integers will give wildly varying results. What's more, there may be several nonces that produce the desired result, or there may be none (in which case the miners keep trying, but with a different block configuration).

The first miner to get a resulting hash within the desired range announces its victory to the rest of the network. All the other miners immediately stop work on that block and start trying to figure out the mystery number for the next one. As a reward for its work, the victorious miner gets some new bitcoin.



Economics

At the time of writing, the reward is 12.5 bitcoins, which at time of writing is worth almost $200,000.

Although it's not nearly as cushy a deal as it sounds. There are a lot of mining nodes competing for that reward, and it is a question of luck and computing power (the more guessing calculations you can perform, the luckier you are).

Also, the costs of being a mining node are considerable, not only because of the powerful hardware needed (if you have a faster processor than your competitors, you have a better chance of finding the correct number before they do), but also because of the large amounts of electricity that running these processors consumes.

And, the number of bitcoins awarded as a reward for solving the puzzle will decrease. It's 12.5 now, but it halves every four years or so (the next one is expected in 2020-21). The value of bitcoin relative to cost of electricity and hardware could go up over the next few years to partially compensate this reduction, but it's not certain.

Difficulty

The difficulty of the calculation (the required number of zeroes at the beginning of the hash string) is adjusted frequently, so that it takes on average about 10 minutes to process a block.

Why 10 minutes? That is the amount of time that the bitcoin developers think is necessary for a steady and diminishing flow of new coins until the maximum number of 21 million is reached (expected some time in 2140).

If you've made it this far, then congratulations! There is still so much more to explain about the system, but at least now you have an idea of the broad outline of the genius of the programming and the concept. For the first time we have a system that allows for convenient digital transfers in a decentralized, trust-free and tamper-proof way. The repercussions could be huge.

Authored by Noelle Acheson. Bitcoin and bitcoin mining images via Shutterstock. Source coindesk

NEXT: HOW TO SET UP A BITCOIN MINER


INDEX: A BEGINNERS GUIDE TO BITCOIN AND BLOCKCHAIN TECHNOLOGY



What is Bitcoin?
It's a decentralized digital currency


Why Use Bitcoin?
It's fast, cheap to use, and secure


How Can I Buy Bitcoin?
From an exchange or an individual


How to Buy Bitcoin in the UK
Buying bitcoin in the UK


How to Store Your Bitcoin
Use a digital or paper wallet


What Can You Buy with Bitcoin?
Spend your bitcoins


How to Sell Bitcoin
A guide on how to sell your bitcoins


How to Accept Bitcoin Payments for Your Store
Learn about bitcoin POS systems


How do Bitcoin Transactions Work?
Bitcoin addresses and private keys


Is Bitcoin Legal?
The current regulation around bitcoin


Who is Satoshi Nakamoto?
The founder of bitcoin


How Bitcoin Mining Works
By confirming transactions


How to Set Up a Bitcoin Miner
Generate bitcoins yourself


What are Bitcoin Mining Pools?
What are pools how and how to join them?


How Does Cloud Mining Bitcoin Work?
Alternative bitcoin mining solutions


How to Calculate Mining Profitability
Can you make a ROI?


How to Make a Paper Bitcoin Wallet
Creating an unhackable bitcoin wallet


Can Bitcoin Scale?
A look at the debate and the tech


What is SegWit?
A new way of storing transaction data


What is the Lightning Network?
Off-chain transaction channels


What is Bitcoin Cash?
Same blockchain, different characteristics.


Hard Fork vs Soft Fork
Why and how do blockchains split?


What is the Difference Between Litecoin and Bitcoin?
It's the silver to bitcoin's gold


How to Buy Litecoin
How to buy the bitcoin alternative litecoin


How to Mine Litecoin and other Altcoins
How to generate your own altcoins


Understanding Bitcoin Price Charts
A primer on bitcoin price charts


Bitcoin E-Commerce Services for Merchants
How to accept bitcoin at your business


What is Blockchain Technology?
A system of distributed data and logic


How Does Blockchain Technology Work?
Cryptographic keys, distributed networks and network servicing protocols


What Can a Blockchain Do?
Identity, recordkeeping, smart contracts and more


What is a Distributed Ledger?
A dynamic, independently maintained database


What is the Difference Between Public and Permissioned Blockchains?
Can anyone read or write to the ledger?


What is the Difference Between a Blockchain and a Database?
It begins with architectural and administrative decisions


What Are the Applications and Use Cases of Blockchains?
Tokenization, auditing, governance, settlement and more


How Could Blockchain Technology Change Finance?
Cross-border payments, new asset classes, regulatory compliance and more


What are Blockchain's Issues and Limitations?
Complexity, size, costs, speed, security, politics and more


Why Use a Blockchain?
To manage and secure digital relationships as part of a system of record


What is Ethereum?
A blockchain application platform and 'world computer'


What is Ether?
The 'fuel' of the ethereum network


How to Use Ethereum
Wallets, trading and ‘dapps’


Who Created Ethereum?
Vitalik Buterin


How Ethereum Mining Works
'Proof of Work' and 'Proof of Stake'


How to Mine Ethereum
GPUs, mining software and pools


How Ethereum Works
'Turing-complete' programming, 'state' and the 'EVM'


What is a Decentralized Application?
A distributed 'smart contract' system


What is a DAO?
A 'decentralized autonomous organization'


How Do Ethereum Smart Contracts Work?
Code, transaction fees and 'gas'


How Will Ethereum Scale?
‘Sharding’ and ‘off-chain’ transactions


What is an ICO?
Initial Coin Offerings refer to the distribution of digital tokens.

Read the full article
Porträt von Satoshi Nakamoto

Satoshi Nakamoto

Zur Person

Satoshi Nakamoto