• A Blockchain is the database underlying the Bitcoin network. It is a distributed ledger which records all Bitcoin transactions and ensures they cannot be altered at a later date.
  • Since Bitcoin is a distributed, trustless system, a blockchain is needed to ensure all parties can agree on a single source of truth: who owns which bitcoin at a certain point in time.
  • Miners write new blocks to the blockchain in a competitive and expensive guessing game. This effort is rewarded with new bitcoin payouts to successful miners. This system keeps miners honest while also strictly controlling the rate of inflation and block production.

What Is a Blockchain?

A blockchain is the foundational data structure behind Bitcoin.

As its name suggests, a blockchain is a chain of blocks. Each of these blocks contains data — in Bitcoin’s case, each block contains transactions, representing transfers of bitcoin from one user to another.

The blockchain can be thought of as a digital ledger that keeps track of every account on the network. The entire blockchain is the book that stores the record of every transaction that has ever taken place on the network between its accounts. Each block, then, is like a new page added to the ledger to update the state of accounts on the network.

How Does a Blockchain Work?

Each block in the blockchain is “chained” together using a cryptographic technique called “hashing”. This technique ensures that blocks cannot be changed or reordered after they are added to the blockchain.

To maintain the ledger, Bitcoin miners compete with each other to find the blockchain’s next “hash,” a very long alphanumeric string that connects the old block with the new. The miner that guesses the hash correctly gets to “mine” the next block in the chain. This means they take whichever transactions are next in the Bitcoin network’s queue (also called the mempool), order them into the block, then broadcast that block to the network to make it permanent. Miners are rewarded for this process with the “block reward” — the collective fees for the transactions in that block along with newly minted bitcoin that are discovered in each block.

To understand how the blockchain powers Bitcoin, first consider how people normally transfer money.

When you send money through your bank to a family member who uses the same bank, the bank subtracts dollars from your account balance and adds them to your family member’s balance. All of this happens on the bank’s internal ledger.

But if you transfer money from one bank to another — whether by SWIFT, ACH or a third-party platform like PayPal — the account balances must be reconciled by multiple actors across different bank ledgers.

Using Bitcoin is more like the former scenario involving a single bank. Unlike a bank, however, Bitcoin’s ledger is entirely public and auditable. When you send bitcoin, you submit your transaction to the network’s miners, who include it into a block, making it irreversible and visible to all participants.

Features of the Bitcoin Blockchain

Transparency

The Bitcoin blockchain is a completely public ledger. Anyone with an internet connection can access any number of “block explorers” to audit the supply and see which addresses own which bitcoin. Power users can run their own Bitcoin node and directly examine any block if they prefer to not trust any website.

This transparency is essential. Without it, it would effectively be impossible to verify the circulating supply of bitcoin or audit the validity of the transactions on the network.

Decentralization

Bitcoin’s blockchain is distributed. It is stored and maintained on tens of thousands of computers around the world, rather than in one centralized location.

Since the ledger is public and freely accessible to anyone, how do we ensure this isn’t censored or falsified? For example, what if the block explorer you’re using to query Bitcoin’s blockchain is publishing false data?

This is why Bitcoin’s codebase is open source. Anyone can download a copy of the Bitcoin blockchain to run a full node, so anyone can check its transaction history without having to trust a third party.

Moreover, running a node allows you to enforce the rules of the network yourself. For instance, consider that a group of people decide to increase Bitcoin’s supply to 42 million BTC from 21 million BTC. If you disagree with this change, you could refuse to run the code for this change. Other nodes would have no power to change the rules your node enforces, and thus the original Bitcoin would survive.

If, for example, only 100 out of 10,000 hypothetical nodes decide to run this code change (and the other 9,900 keep the old code), nothing about the Bitcoin network would change for those who didn’t upgrade.

Since the network is being supported by thousands of nodes all around the world, all the nodes have to be “in sync” with each other by running the same codebase. This distribution makes it difficult for anyone, any company or any interest to control or co-opt Bitcoin to change its rules: If you want to implement a rule change, you have to convince (at least) a majority of the node operators and miners to upgrade their nodes with this change for it to be considered valid or reach “distributed consensus.”

To learn more about how running a Bitcoin node can give you greater control over your Bitcoin, read more here.

Immutability

Building on this concept that Bitcoin is “hard to change,” immutability is core to Bitcoin’s design, as well.

Since there are so many entities running the Bitcoin software worldwide, they must be running the same version of code in order to interact with other nodes on the network — and so Bitcoin is very hard to change.

But there are some rule changes that can be applied without forcing everyone to upgrade; these are typically called “soft forks” and represent minor changes or upgrades to the protocol. For example, the SegWit upgrade to increase how much data can be included in each Bitcoin block only required a soft fork. This means that nodes without the upgrade could still interact with nodes with the upgrade — this is called “backward compatibility”.

On the other hand, “hard forks” are major software changes that everyone running the Bitcoin Core software must implement in order for the changes to become standardized across the network. Our earlier example of changing Bitcoin’s supply cap would require a hard fork.

Understanding Proof of Work

The mining process that maintains the Bitcoin ledger uses an algorithm called “proof of work” (PoW) to ensure that blocks are produced according to an encoded ruleset. The “work” occurs whenever a mining computer produces a hash. The first miner to produce a valid hash is allowed to publish a new block and they receive a reward of new bitcoin.

If many people are mining bitcoin because it is profitable, the PoW will adjust to make it more difficult to find a valid hash. If this discourages too many people and they stop mining, the difficulty adjusts downward to make it easier to mine. This process, known as the difficulty adjustment, occurs roughly every two weeks, and it keeps Bitcoin blocks coming in roughly every 10 minutes, no matter how many or few miners mine.

The difficulty adjustment is important because it makes bitcoin costly and energy-intensive to mine. The self-correcting difficulty adjustment ensures that miners can’t mine too much of the supply or hoard bitcoin. Because it costs so much to mine, miners must sell what they mine to pay energy and other costs.

The energy required with a proof-of-work mechanism also means that attacking the network is prohibitively expensive, thereby ensuring the security and integrity of the Bitcoin blockchain. Anyone with enough computing power and energy to attack the network is better off mining honestly for the network and reaping the block reward and transaction fees. Greed keeps miners honest.