Bitcoin technology primer
It can take many years to understand Bitcoin in every detail, but luckily you don’t need to know everything to design great products. Let’s look at the most important ideas and technologies behind Bitcoin by answering some basic questions.
Is it Bitcoin or bitcoin? #
It’s both. Lowercase bitcoin refers to the currency. So you may have 1 bitcoin in your wallet. Capitalized Bitcoin refers to the protocol and payment network.
What is a bitcoin? #
You can own fractions of 1 bitcoin, they are just numbers in a digital ledger of transactions. We call that ledger the Bitcoin blockchain. Transactions are used to assign bitcoin from one address to another. This process reduces the available balance of the sending address and increases the balance of the receiving address. A small amount has to be added as the fee to pay for the verification.
Therefore, owning a bitcoin means being in control of one or more addresses that have received bitcoin.
What is the Bitcoin network? #
Just as the internet allows computers to exchange information, the Bitcoin network enables participants to exchange value. By running the Bitcoin software, you are running a node connected to the Bitcoin network. Some nodes use powerful computers that compete to verify transactions and update the blockchain for a reward. These nodes are called miners. Others are run by businesses like exchanges or merchants. They are also used by individuals making payments from mobile applications. Since January 3rd, 2009, every transfer of bitcoin has been permanently recorded in its shared global ledger.
What are the benefits of this ledger? #
Imagine a global spreadsheet where all transactions get recorded, and all entries are publicly accessible. With Bitcoin, each participant can verify a transaction for themselves in their copy of the spreadsheet. In comparison, traditional banks keep their spreadsheets private from each other and their customers. Besides opportunities for fraud, there are many points of failure due to this, so you can’t guarantee a payment will always happen. Even though all transactions are stored publicly on Bitcoin, there is no personally identifiable information attached to them.
With thousands of nodes and tens of millions of users worldwide, it becomes implausible to manipulate or corrupt the previously agreed-upon transactions stored in the blockchain. To do so would require a majority of nodes to accept such a change.
What is a blockchain? #
Instead of processing each transaction individually, the Bitcoin network bundles them into blocks. A new block is created roughly every 10 minutes. A strict file size limit results in the transactions with the highest fees typically getting chosen first. Every new block must link to the one before it. Since this is a continuous process, a chain of blocks forms, hence the name blockchain.
Once a transaction is in a block that the network has accepted, it is considered to have one confirmation. With every new block created, the number of confirmations increases.
How is the blockchain secured? #
While miners check that the transactions included in the block are valid, they must also be kept accountable that the information they are submitting is correct. After a miner constructs a block transactions, it must race against other miners to solve a cryptographic puzzle, which incentivizes them to only include valid transactions in the block. This process is called Proof of Work, and it is fundamental to the security of the blockchain. The first miner to solve the puzzle and submit a valid block to the network will earn all the fees from the transactions in the block and a block reward as compensation; however, if they submit an invalid block, it will be rejected by the network.
We also call the Bitcoin blockchain “base layer” as it provides strong security, and is the foundation for other things to be built on top.
Do all transactions have to be this secure? #
Layers in Bitcoin serve to provide alternative settlement rules. Bitcoin’s block generation time of 10 minutes and the 1 MB size means that the blockchain can handle around 300 000 transactions per day or 4.6 transactions per second. Layer 1, the base layer, is the most secure, so it has the most time-consuming verification process.
To scale as a currency of the internet and meet the demands of the global economy, Bitcoin needs a way to handle fast and frequent payments. Such payments don’t all need to be secured by every node and be added to the blockchain immediately. That is why a second layer is necessary to allow the delay of the base layer settlement.
How can you build on the base layer? #
Transactions get verified and stored by the entire network of nodes and miners who must constantly verify, exchange, and secure transactions they receive from wallets and other services.
While creating a transaction to move your funds from one address to another is common, setting up more complex spending rules is also possible. Such rules could require multiple parties to agree before moving funds, how much each is entitled to, and even the amount of time that must pass before a transfer. These transaction features make Bitcoin customizable so that it’s possible to build other applications and even networks on top of the base layer.
There are multiple scaling solutions built on top of Bitcoin’s base layer, but we will be focusing on the Lightning Network in this guide.
What is a payment channel? #
A payment channel is a joint account where two parties agree to bypass recording their payments on the blockchain. Opening a payment channel involves them locking up funds in a transaction. This enables faster and cheaper subsequent payments between the two parties as they only update their balances in the payment channel. For each update, a new transaction is created, but it is only published when the parties agree to close the channel.
The Lightning payment network #
The Lightning network is a network of payment channels. Lightning nodes allow you to have multiple channels with different parties to route payments through. This new network forms a second layer on top of Bitcoin and has some privacy benefits too since payments are not individually recorded on the blockchain. Only when the channel is opened and the final settlement transaction gets broadcasted when closing the payment channel.
What are ways to receive bitcoin? #
To transfer bitcoin, the recipient needs to provide the sender with the destination for the payment. On the base layer, this is typically done in the recipient’s wallet application by generating and sharing an address. For Lightning payments, an invoice is used. While base layer transactions update balances on the public ledger, Lightning invoices contain information for a payment to be routed through the network of payment channels.
How are payments routed? #
To make a Lightning payment, you don’t need to open a channel with everyone you transact with. Lightning nodes talk to one another and declare their payment channels. It’s typical for nodes to have multiple channels to access different parts of the network for better routing. With an invoice, the sender finds a path to the receiver, and the payment hops from channel to channel until it reaches the destination.
What are hot and cold private keys? #
Just like a key for a door, a private key gives you access to your bitcoin. Private keys authorize the movement of bitcoin on the base layer as well as Lightning.
Lightning node private keys are referred to as hot as they are stored on a device that is connected to the internet. This is not typically advised for storing large amounts as it is possible for a remote attacker to get access to that device. A more secure way to store private keys is cold storage, which is not connected to the internet.
There’s a lot more #
These are some of the basic technical concepts that make Bitcoin work. Each one individually is complex, and the interplay between them is a whole other area of interest. Dive into the other chapters in this guide to explore the technology and its applications in more detail.
Now, if you’d like to go all the way to the beginning of Bitcoin, the most fundamental read is the Bitcoin whitepaper. Published on October 31, 2008, by the mysterious Satoshi Nakamoto, it lays out the fundamental system design in only nine short pages. It is not necessarily an easy read, but still highly recommended reading.
Take a look at how these technologies are implemented in the various types of bitcoin software.