Bitcoin: Fundamental Technical Structure
Look no further if you’ve ever wondered what goes on behind the scenes of Bitcoin. We delve into the technology that underpins Bitcoin’s operation.
The Bitcoin network is a decentralized, trustless peer-to-peer network for securely sending monetary value in the form of bitcoin from one party to another. This article covers the technical aspects of Bitcoin, such as the blockchain, nodes, miners, and proof-of-work mining.
- The Blockchain Ledger
- Peer-to-Peer Network Nodes
- Proof-of-Work Mining: Bitcoin’s Consensus Mechanism
- Anatomy of a Block
- Bitcoin Halving
- Bitcoin Forks
The Blockchain Ledger
The Bitcoin network keeps a distributed public ledger that keeps track of who owns how much bitcoin, the network’s native digital asset token. New transactions are grouped into “blocks” and added to the network’s ongoing chain of blocks in sequential order, hence the term “blockchain.”
The Bitcoin blockchain contains every block since the cryptocurrency’s inception, dating all the way back to the “Genesis Block.”
Identical copies of the blockchain are stored on computers running the Bitcoin software all across the world. The computers are referred as to as “nodes.” This design ensures that the blockchain or protocol that governs it is not controlled by a single party. Bitcoin’s distributed nature makes it decentralized and resistant to the government or central authority control (or shut down).
To wipe the Bitcoin blockchain, all nodes that keep a complete copy of the blockchain — known as “full nodes” — would theoretically have to be destroyed. It’s no easy undertaking, as there are even entire nodes floating in space above the earth!
The goal of “miners,” or nodes that validate Bitcoin transactions and secure the blockchain ledger, is to secure the blockchain ledger.
When you transmit money from one bank account to another in the traditional banking system, the banks operate as trusted intermediates, deducting monies from one account and adding them to another. Bitcoin replaces centralized intermediaries with a trustless network of miners. We’ll go over how this works in a minute.
Peer-to-Peer Network Nodes
Nodes are the foundation of decentralization, security, and transparency in blockchain-based protocols. On the Bitcoin network, there are various different types of nodes.
A user’s computer works as a node when she joins to the Bitcoin network to send or receive bitcoin. Light nodes are the most common type of node, as they simply download the most recent blockchain data required to process and validate new transactions. This simple strategy ensures that light nodes function quickly and effectively without consuming excessive computing or storage resources.
Full nodes, on the other hand, have a real-time copy of the blockchain. They download every block of transactions that has ever occurred on the network, not just the most recent ones, since the Genesis Block. There will be a record of all bitcoin and bitcoin transactions throughout history as long as the whole blockchain survives on at least one full node.
Finally, there are nodes known as miners, which create fresh bitcoin by writing blocks of new transactions to the blockchain.
Proof-of-Work Mining: Bitcoin’s Consensus Mechanism
Miners compete to solve a proof of work puzzle that requires a lot of computing power.
The “winning” miner receives the “block reward,” which is a fixed amount of bitcoin (plus network transaction fees) awarded to the “winning” miner. Every 10 minutes, one miner gets the block reward, regardless of how much processing power the network’s miners collectively bring to bear. More processing power boosts a miner’s chances of winning, but it doesn’t make the competition go faster.
Bitcoin’s predictable supply schedule cannot be accelerated or altered in any way by miners.
A miner must solve the riddle by “hashing” all of the network’s new and unconfirmed transactions, as well as information from the previous block (i.e., its “block header”), into a new block using the SHA-256 method. Hashing is a method of generating a specified output from a specific input (in this example, recent transaction data and the block header) using an algorithm.
A Miner must take this information and guess a number known as a “nonce,” which, when entered into SHA-256, will produce an output that meets the Bitcoin protocol’s output threshold. Mining is essentially a game of guessing nonces as fast as feasible.
When a miner reaches the desired output threshold, she broadcasts her new block (which includes her nonce) to other miners on the network, allowing them to hash it and validate her solution. She will be able to add her new block to the blockchain and get the block reward if a majority of miners — 51 percent or more — agree on her approach. The race then starts all over again.
The essential element is that the hash result will change if any of the transaction data is changed by even the tiniest amount (say, a “satoshi,” which is 0.00000001 BTC). As a result, a large number of miners will be unable to agree on any nonce that solves the puzzle using altered transaction data.
This makes it impossible for a dishonest miner to win, and it motivates miners to be cautious with their valuable computational resources.
Bitcoin mining is a beautiful design that performs two functions: verifying transactions and minting new bitcoins. But there’s more…because mining needs computer processing power (i.e., energy), minting bitcoin has a real cost, resulting in digital scarcity.
In the sense that they both take energy to mine, this is similar to real-world gold production. Gold mining, unlike Bitcoin, does not serve to validate (or process) transactions. Bitcoin mining accomplishes both, which is a wonderful thing.
Anatomy of a Block
Each Bitcoin block can only hold one megabyte of data. Transaction data is limited to one megabyte in “Segregated Witness” (SegWit) blocks, whereas signature data (aka witness) is segregated and limited to three megabytes. This maintains a one-megabyte block size while boosting block capacity for transaction data.
A block contains the following information:
A Block header:
- Version number
- Hash of the previous block header
- Hash of the root of Merkle tree of all the transactions in the current block
- Difficulty target of the current block (meaning how difficult the target hash will be to find)
Data for each transaction:
- Version number
- Flag (only for SegWit transactions)
- Transaction inputs
- Transaction outputs
- Witnesses (only for SegWit transactions)
- Lock time
The total quantity of bitcoin is capped at 21 million bitcoins, according to a deterministic supply schedule. As previously stated, when a miner wins the block reward, fresh bitcoin are created. Every 210,000 blocks, or nearly every four years, the block reward amount is “halved.” The following is the Bitcoin halving schedule:
- 2009 to 2012: block reward = 50 BTC
- 2012 to 2016: block reward = 25 BTC
- 2016 to 2020: block reward = 12.5 BTC
- 2020 to 2024: block reward = 6.25 BTC
In early 2024, the block reward will be halved again, reaching 3.125 BTC. The block reward will eventually reach zero, around the year 2140, as it continues to halve. In other words, no new bitcoin will be created after 2140, and the block reward will be made up entirely of transaction fees collected by miners when bitcoin is moved over the network.
Many people refer to bitcoin as “digital gold” or “gold 2.0” because of its fixed and predetermined supply schedule, which gives it “hard money” and “store of value” features.
When an existing blockchain separates into two separate blockchains, this is known as a fork. This occurs when a protocol is updated but not all nodes have adopted it. Blockchains can suffer two sorts of forks: a soft fork, in which both old and new nodes can read both blockchains (compatible); and a hard fork, in which old nodes cannot read the new blockchain and vice versa (incompatible).
Hard forks create two unique blockchains with distinct native digital asset tokens that are distinct from one another.
Individual nodes must decide whether or not to upgrade and accept new changes when the Bitcoin protocol is updated. A hard fork occurs when a portion of the network’s nodes refuses to accept the modifications. Bitcoin has gone through a number of hard and soft forks, the most recent of which happened at block 661,647, the last common block between Bitcoin and Bitcoin Cash.
A debate in the Bitcoin community about block size led to the Bitcoin Cash fork. Bitcoin Cash uses an eight-megabyte block size to boost transaction throughput, whereas Bitcoin uses a one-megabyte block size to encourage more node participation and ensure decentralization.