How Bitcoin Works
At its core, a blockchain is a distributed ledger, a data base disseminated between multiple users who can make changes. Distributed ledgers have been around for many years, used by people, businesses, and governments to store information (data). Authorized users can make changes in the data, and in most distributed ledgers, changes are recorded with identifying information about who changed the data, along with timestamps and possible other information.
A distributed ledger can consist of a chain of blocks of information, arranged chronologically. The information could include emails, contracts, land titles, marriage certificates, bond trades, or any other recordable information.
Most ledgers are encrypted via various cryptographic protocols to ensure the databases can only be accessed by authorized users with the correct decryption technology. A blockchain uses encryption to hide user information and adds a protocol that closes access to a block after the data within it has been verified. Once a block closes, a new block is opened to record ownership and transaction data.
Blockchains also implement a verification and validation mechanism which use multiple sources to confirm any data changes in the ledger. This has come to be known as a consensus mechanism—one in which encrypted data is verified by a pool of peer programs that reaches a predetermined consensus about whether the information contained in the encrypted block information is valid.
The process that maintains this trustless public ledger is known as mining. Undergirding the network of Bitcoin users who trade the cryptocurrency among themselves is a network of miners who record these transactions on the blockchain.
Recording a string of transactions is trivial for a modern computer, but mining is difficult because Bitcoin's software makes the process artificially time-consuming. Without the added difficulty, people could spoof transactions to enrich themselves or bankrupt other people. They could log a fraudulent transaction in the blockchain and pile so many trivial transactions on top of it that untangling the fraud would become impossible.
By the same token, it would be easy to insert fraudulent transactions into past blocks. The network would become a sprawling, spammy mess of competing ledgers, and Bitcoin would be worthless.
Combining “proof of work” with other cryptographic techniques was Nakamoto's breakthrough. Bitcoin's software adjusts the difficulty miners face in order to limit the network to a new 1-megabyte block of transactions every 10 minutes. That way, the volume of transactions is digestible. The network has time to vet the new block and the ledger that precedes it, and everyone can reach a consensus about the status quo. Miners do not work to verify transactions by adding blocks to the distributed ledger purely out of a desire to see the Bitcoin network run smoothly; they are compensated for their work as well. We'll take a closer look at mining compensation below.
As previously mentioned, miners are rewarded with Bitcoin for verifying blocks of transactions. This reward is cut in half every 210,000 blocks mined, or, about every four years. This event is called the halving or “the halvening.” The system is built-in as a deflationary one for the rate at which new Bitcoin is released into circulation.
This process is designed so that rewards for Bitcoin mining will continue until about 2140. When all Bitcoin is mined from the code and all halvings are finished, the miners will remain incentivized by fees that they will charge network users. The hope is that healthy competition will keep fees low.
This system drives up Bitcoin's stock-to-flow ratio and lowers its inflation until it is eventually zero. After the third halving that took place on May 11, 2020, the reward for each block mined became 6.25 bitcoins.
Here is a slightly more technical description of how mining works. The network of miners, who are scattered across the globe and not bound to each other by personal or professional ties, receives the latest batch of transaction data. They run the data through a cryptographic algorithm that generates a “hash”—a string of numbers and letters that verifies the information's validity but does not reveal the information itself. (In reality, this ideal vision of decentralized mining is no longer accurate, with industrial-scale mining farms and powerful mining pools forming an oligopoly. More on that below.)
Given the hash 000000000000000000c2c4d562265f272bd55d64f1a7c22ffeb66e15e826ca30, you cannot know what transactions the relevant block (#480504) contains. You can, however, take a bunch of data purporting to be block #480504 and make sure that it hasn't been subject to any tampering. If one number were out of place, no matter how insignificant, the data would generate a totally different hash. For example, if you were to run the Declaration of Independence through a hash calculator, you might get 839f561caa4b466c84e2b4809afe116c76a465ce5da68c3370f5c36bd3f67350. Delete the period after the words “submitted to a candid world,” though, and you get 800790e4fd445ca4c5e3092f9884cdcd4cf536f735ca958b93f60f82f23f97c4. This is a completely different hash, although you've only changed one character in the original text.
A hash allows the Bitcoin network to instantly check the validity of a block. It would be incredibly time-consuming to comb through the entire ledger to make sure that the person mining the most recent batch of transactions hasn't tried anything funny. Instead, the previous block's hash appears within the new block. If the most minute detail had been altered in the previous block, that hash would change. Even if the alteration was 20,000 blocks back in the chain, that block's hash would set off a cascade of new hashes and tip off the network.