What is Bitcoin Mining?
The beginner’s guide
Bitcoin mining is the process of validating new Bitcoin transactions before adding them to the Bitcoin blockchain.
With traditional government-issued currencies like the U.S. dollar or euro, users are required to place complete trust in a centralized authority – such as a central bank – to manage the creation and circulation of money.
Within such fiat systems, all information regarding user accounts and balances is privately managed by financial institutions. As such, it’s impossible for any one person to know what another is spending or how much money others have in their accounts. Only the bank has access to the complete ledger of transactions.
There are three key problems with this type of system.
- Unpredictable: Because a central bank has the sole authority to print new money into existence, the supply of a fiat currency constantly changes. This creates inflationary issues and can often result in the reduction of a currency’s purchasing power over time.
- Lack of transparency: Traditional financial ledgers are heavily guarded, creating an opaque financial system that is not open to all.
- Dependency: By design, fiat currencies create a user dependence on a country’s central bank and government – creating single points of liability or potential failure.
Launched in 2009, Bitcoin became the first globally viable, decentralized digital currency. It relies on a strict computer protocol to govern its monetary policy along with a globally distributed network of volunteers to issue, manage and secure its currency.
Being a purely digital form of money, all transactions take place electronically over the Bitcoin network and are recorded on a fully transparent ledger technology called a “blockchain.”
The Bitcoin blockchain represents a complete transactional history of every payment users have sent to each other, and is constantly being updated with new blocks containing batches of current transactions.
What’s special about public blockchains, like the one Bitcoin uses, is that anyone, anywhere in the world can view all transactions happening across the network in real-time, and review a full archive of completed transactions — including all recipient and sender addresses, as well as individual balances.
But how does this work in practice?
Bitcoin monetary policy
Unlike the powers assumed by governments and central banks to print new currency into existence whenever they choose, bitcoin’s issuance system is governed by computer code.
There are three main components to Bitcoin’s monetary policy that are baked into its protocol:
- 10-minute block times: New bitcoin enters circulation roughly every 10 minutes. This is managed autonomously via the mining difficulty algorithm.
- Fixed supply: A maximum of 21 million bitcoin will ever exist in circulation. This is Bitcoin’s hard cap supply, meaning once the number of coins released through block rewards reaches 21 million, the protocol will cease minting and distributing new coins to winning miners. As of 2022, there are over 19 million coins of the 21 million in circulation.
- Bitcoin halvings: Every 210,000 blocks (or four years) the number of newly minted bitcoin distributed to successful miners as block rewards is slashed in half. When the Bitcoin network first launched in 2009, 50 BTC were given as block rewards. Since then, block rewards have undergone three separate halving events (2012, 2016 and 2020) – with rewards currently standing at 6.25 bitcoin per block.
Rewards will continue to be halved until the last bitcoin is mined — which is expected to happen sometime around the year 2,140.
This system of halving rewards adds an additional layer of predictability to bitcoin’s monetary policy, allowing users to accurately map the circulating supply of bitcoin throughout its entire lifespan.
Due to the built-in rate of inflation, and Bitcoin’s focus on long-term stability and transparency, confidence in the protocol has remained high for developers. Furthermore, Bitcoin’s fixed monetary policy drives an increasing number of investors toward its currency as a leading store of value.
How Does Bitcoin Mining Work?
In order to keep the distributed Bitcoin network secure and regulate the supply of new digital coins entering circulation, Bitcoin uses a process called “mining.”
Before diving into the mechanics of Bitcoin, it’s important to understand the reason why the mining process is needed in the first place.
As mentioned before, the Bitcoin network is not managed by a central bank or intermediary financial institution. Instead, it’s collectively managed by volunteers spread across the globe.
This decentralization poses one obvious problem; if anyone can participate in the network and there’s no single authority to vet who joins, how are bad actors, who might seek to corrupt the network, prevented from doing so?
This is where something called a consensus mechanism comes in.
Bitcoin Proof-of-Work (PoW) Consensus Mechanism
A consensus mechanism is essentially a computer driven system that’s designed to select honest participants in a network to fulfill a particular role — in this case, the important role of proposing new blocks of transactions.
Because blocks and the transactions inside of them become permanent once they’re added to the blockchain, it’s crucial that the transactions are valid.
For example, does Bob have the required balance to send Alice a certain amount of bitcoin? Has Bob tried to double spend the same balance twice? These are the types of things that must be queried each time to ensure transactions are valid before they are permanently added to the blockchain.
Because of this, participants who perform this particular role are known commonly as “validators.”
There are a variety of different consensus mechanisms that can be employed on a blockchain-based network, each with its own specific method for filtering out dishonest users.
Bitcoin uses the proof-of-work (PoW) consensus mechanism — a system where validators are referred to as “miners” and required to use purpose-built computing equipment to produce fixed-length codes called “hashes” (see below).
The Bitcoin Mining Process
The process is simple. Miners compete by using their machines to generate hashes — usually millions of them per second. To win the exclusive right to propose the next block and earn block rewards (comprising newly minted bitcoin as well as any fees attached to the transactions), miners must create a hash with an equal or lower value to a goal set by the protocol called the “target hash.”
The target hash is a value with a number of zeros at the front and looks something like this:
The target hash for each new block of transactions is first broadcast to the network as a part of the previous block. This information is stored in the block header, where much of the key information regarding the block is stored.
Also inside the block header is a value called a “nonce.” When creating a hash to beat the target hash, all miners take the block header of the previous block, change the nonce to a new number and run it through the Secure Hash Algorithm 256 (SHA-256) hashing algorithm. Each time the nonce value is changed, it produces an entirely new hash.
Because hashes are also generated purely at random, creating a winning hash is simply a matter of trial and error. The process of guessing and checking continues until one miner successfully creates a hash that has the same or more zeros at the front as the target hash.
While finding this value might sound easy, it’s actually incredibly difficult to do and is why some companies have filled huge warehouses with sophisticated mining rigs to stand the best chance of generating a winning hash before anyone else.
Because miners are required to either purchase or rent mining equipment, while also paying to maintain and run these machines for a slim possibility of making a return, bad actors are disincentivized from dishonest behavior. Additionally, when other nodes in the network recognize a malicious node is attempting to add invalid transactions they can simply reject the proposed block — wasting the time and resources committed by the bad actor.
What Are Hashes, Exactly?
Hashes created for the purposes of bitcoin mining are generated via the SHA-256 cryptographic algorithm, which is essentially a mathematical formula that takes an input of any length and turns it into a fixed-length, 64 digit hexadecimal code.
If you are interested in diving further into the cryptography of cryptocurrencies, you can check out our deep dive article on the topic, How do cryptocurrencies use cryptography?
Think of cryptographic hashing as a special password generating machine that turns any data input — whether it’s a single word, random string of keyboard characters or an entire Lord of the Rings novel — into a unique 64 character combination.
These hashes have a number of interesting characteristics:
- One-way: You can’t take a hash and determine what its original input was.
- Deterministic: If you run the same input through the same cryptographic hashing function, it will always deliver the same fixed-length code.
- Unique: Each hash code generated is completely unique to its corresponding input.
As an example, if you were to change a single letter of a word from a Lord of the Rings book and run it through the SHA-256 algorithm again, that seemingly unrecognizable change would result in an immediately recognizable and completely different hexadecimal code.
As mentioned above, newly minted bitcoin enters circulation via block rewards each time a miner successfully beats the target hash and is granted the right to add a new block to the blockchain.
To ensure that new coins don’t flood the market as the network swells with an ever-increasing number of new miners, an algorithmic difficulty adjustment system was coded into Bitcoin’s protocol by its creator, Satoshi Nakamoto, ahead of its launch to manage this issue.
The bitcoin mining difficulty algorithm is such that after every 2,016 blocks (approximately every two weeks), the protocol checks to see how long it took for miners to discover the winning hash for each block.
Bitcoin’s average block time is set to 10 minutes, meaning that on average one miner in the network should stumble across a winning hash every 10 minutes. This is designed to help regulate the flow of new coins entering the circulating supply — providing a predictable issuance rate for the currency.
More specifically, what the algorithm does is check to see how long it took for miners to discover 2,016 blocks and compares that time to the 20,160 minutes it should take (10 x 2,016).
If blocks were discovered faster than the desired time, the algorithm will automatically adjust the difficulty to make it harder for miners to find the winning hash, and vice versa. It does this by adding or removing zeros from the front of the subsequent target hashes in the next batch of 2,016 blocks, which is referred to as an epoch.
As the difficulty increases, so too do the costs associated with mining. In some cases, rising bitcoin mining difficulty has forced smaller miners who aren’t able to break even on their electricity and hardware operating costs to exit their operations.
Since miners with a small percentage of the mining power are unlikely to discover the next block, and thus will rarely get compensated, miners often pool their resources together in so-called mining pools.
Today, the majority of bitcoin mining is done by these groups. Mining pools share their processing power and proportionally split any block rewards they earn among members.
Kraken's Crypto Guides
- What is Bitcoin? (BTC)
- What is Ethereum? (ETH)
- What is Ripple? (XRP)
- What is Bitcoin Cash? (BCH)
- What is Litecoin? (LTC)
- What is Chainlink? (LINK)
- What is EOSIO? (EOS)
- What is Stellar? (XLM)
- What is Cardano? (ADA)
- What is Monero? (XMR)
- What is Tron? (TRX)
- What is Dash? (DASH)
- What is Ethereum Classic? (ETC)
- What is Zcash? (ZEC)
- What is Basic Attention Token? (BAT)
- What is Algorand? (ALGO)
- What is Icon? (ICX)
- What is Waves? (WAVES)
- What is OmiseGo? (OMG)
- What is Gnosis? (GNO)
- What is Melon? (MLN)
- What is Nano? (NANO)
- What is Dogecoin? (DOGE)
- What is Tether? (USDT)
- What is Dai? (DAI)
- What is Siacoin? (SC)
- What is Lisk? (LSK)
- What is Tezos? (XTZ)
- What is Cosmos? (ATOM)
- What is Augur? (REP)
Start buying cryptocurrencies
Now that you have learned about the mining process, you are ready to purchase some bitcoin. Kraken lets you get started buying bitcoin with just $10. Sign up for your account and buy bitcoin today.