Expert Level
Chapter 6 - Bitcoin Scalability
Contents
What is scalability?
Why does Bitcoin need to scale?
How many transactions can Bitcoin process?
What is the Lightning Network?
What are forks?
Soft forks
Hard forks
What is scalability?
Scalability is a measure of a system's ability to grow to accommodate increasing demand. If you host a website that's overrun with requests, you might scale it by adding more servers. If you want to run more intensive applications on your computer, you could upgrade its components.
In the context of cryptocurrencies, we use the term to describe the ease of upgrading a blockchain so it can process a higher number of transactions.
Why does Bitcoin need to scale?
To function in day-to-day payments, Bitcoin must be fast. As it stands, it has a relatively low throughput, meaning that a limited amount of transactions can be processed per block.
As you know from the previous chapter, miners receive transaction fees as part of the block reward. Users attach these to their transactions to incentivize miners to add their transactions to the blockchain.
Miners seek to make a return on their investment into hardware and electricity, so they prioritize transactions with higher fees. If there are a lot of transactions in the network’s “waiting room” (called the mempool), fees can rise significantly as users bid to have theirs included. At its worst, the average fee was upwards of $50.
How many transactions can Bitcoin process?
Based on the average number of transactions per block, Bitcoin can manage approximately five transactions per second at the moment. It’s much lower than that of centralized payment solutions, but this is one of the costs of a decentralized currency.
Because it’s not managed by a data center that a single entity can upgrade at will, Bitcoin must limit the size of its blocks. A new block size that allows 10,000 transactions per second could be integrated, but it would harm the network’s decentralization. Remember that full nodes need to download new information roughly every ten minutes. If it becomes too burdensome for them to do so, they’ll likely go offline.
If the protocol is to be used to payments, Bitcoin enthusiasts believe that effective scaling needs to be achieved in different ways.
What is the Lightning Network?
The Lightning Network is a proposed scalability solution for Bitcoin. We call it a layer two solution because it moves transactions away from the blockchain. Instead of recording all transactions on the base layer, they’re handled by another protocol built on top of it.
The Lightning Network allows users to send funds near-instantly and for free. There are no constraints on throughput (provided users have the capacity to send and receive). To use the Bitcoin Lightning Network, two participants lock up some of their coins in a special address. The address has a unique property – it only releases the bitcoins if both parties agree.
From there, the parties keep a private ledger that can reallocate balances without announcing it to the main chain. They only publish a transaction to the blockchain when they’re done. The protocol then updates their balances accordingly. Note that they don’t need to trust each other, either. If one tries to cheat, the protocol will detect it and punish them.
In total, a payment channel like this one only requires two on-chain transactions from the user – one to fund their address and one to later dispense the coins. This means that thousands of transfers can be made in the meantime. With further development and optimization, the technology could become a critical component for large blockchain systems.
What are forks?
Since Bitcoin is open-source, anyone can modify the software. You could add new rules or remove old ones to suit different needs. But not all changes are created equal: some updates will make your node incompatible with the network, while others will be backward-compatible.
Soft forks
A soft fork is a change to the rules that allows updated nodes to interact with old ones. Let’s take block size as an example. Suppose that we have a block size of 2MB and that half of the network implements a change – from now on, all blocks must not exceed 1MB. They would reject anything bigger.
Older nodes can still receive these blocks or propagate their own. That means that all nodes remain part of the same network, no matter which version they run.
In the below animation, we can see that the smaller blocks are accepted both by older and updated nodes. However, newer nodes will not recognize 2MB blocks, because they are already following the new rules.
Bitcoin’s Segregated Witness (or SegWit) is an example of a soft fork. Using a clever technique, it introduced a new format for blocks and transactions. Old nodes continue to receive blocks, but they don’t validate the new transaction type.
Hard forks
A hard fork is messier. Suppose now that half of the network wants to increase the block size from 2MB to 3MB. If you try to send a 3MB block to older nodes, the nodes reject it as the rules clearly state that 2MB is the maximum they can accept. Because the two networks are no longer compatible, the blockchain splits into two.
The black chain in the diagram above is the original one. Block 2 is where the hard fork has taken place. Here, nodes that have upgraded have started producing larger blocks (the green ones). The older nodes don’t recognize those, so they continue along a different path. There are now two blockchains, but they share a history until Block 2.
Now there are two different protocols, each with a different currency. All the balances on the old one are cloned, meaning that if you had 20 BTC on the original chain, you have 20 NewBTC on the new one.
In 2017, Bitcoin went through a controversial hard fork in a scenario similar to the above. A minority of participants wanted to increase the block size to ensure more throughput and cheaper transaction fees. Others believed this to be a poor scaling strategy. Eventually, the hard fork gave birth to Bitcoin Cash (BCH), which split from the Bitcoin network and now has an independent community and roadmap.
Chapter 7 - Participating in the Bitcoin Network
Contents
What is a Bitcoin node?
How does a Bitcoin node work?
Full nodes
Light nodes
Mining Nodes
How to run a full Bitcoin node
How to mine Bitcoin
How long does it take to mine a bitcoin?
Who can contribute to the Bitcoin code?
What is a Bitcoin node?
“Bitcoin node” is a term used to describe a program that interacts with the Bitcoin network in some way. It can be anything from a mobile phone operating a Bitcoin wallet to a dedicated computer that stores a full copy of the blockchain.
There are several types of nodes, each performing specific functions. All of them act as a communication point to the network. Within the system, they transmit information about transactions and blocks.
How does a Bitcoin node work?
Full nodes
A full node validates transactions and blocks if they meet certain requirements (i.e., follow the rules). Most full nodes run the Bitcoin Core software, which is the reference implementation of the Bitcoin protocol.
Bitcoin Core was the program released by Satoshi Nakamoto in 2009 – it was simply named Bitcoin at the time, but was later renamed to avoid any confusion. Other implementations can be used, too, provided they’re compatible with Bitcoin Core.
Full nodes are integral to Bitcoin’s decentralization. They download and validate blocks and transactions, and propagate them to the rest of the network. Because they independently verify the authenticity of the information they’re being provided with, the user doesn’t rely on a third party for anything.
If a full node stores a full copy of the blockchain, it is referred to as a full archival node. Some users discard older blocks, though, in order to save space – the Bitcoin blockchain contains over 200GB of transaction data.
Global distribution of Bitcoin full nodes. Source: bitnodes.earn.com
Light nodes
Light nodes are not as capable as full nodes, but they’re also less resource-intensive. They allow users to interface with the network without performing all of the operations that a full node does.
Where a full node downloads all blocks to validate them, light nodes only download a portion of each block (called a block header). Though the block header is tiny in size, it contains information that allows users to check that their transactions are in a specific block.
Light nodes are ideal for devices with constraints in bandwidth or space. It’s common to see this type of node being used in desktop and mobile wallets. Because they can’t perform validation, however, light nodes are dependent on full nodes.
Mining nodes
Mining nodes are full nodes that perform an additional task – they produce blocks. As we touched on earlier, they require specialized equipment and software to add data to the blockchain.
Mining nodes take pending transactions and hash them along with other information to generate a number. If the number falls below a target set by the protocol, the block is valid and can be broadcast to other full nodes.
But in order to mine without relying on anyone else, miners need to run a full node. Otherwise, they can’t know what transactions to include in the block.
If a participant wants to mine but doesn’t want to use a full node, they can connect to a server that gives them the information they need. If you mine in a pool (that is, by working with others), only one person needs to run a full node.
For a breakdown of the different kinds of nodes, see What are Nodes?
How to run a full Bitcoin node
A full node can be advantageous for developers, merchants, and end-users. Running the Bitcoin Core client on your own hardware gives you privacy and security benefits, and strengthens the Bitcoin network overall. With a full node, you no longer rely on anyone else to interact with the ecosystem.
A handful of Bitcoin-oriented companies offer plug-and-play nodes. Pre-built hardware is shipped to the user, who just needs to power it on to begin downloading the blockchain. This can be more convenient for less technical users, but it’s often considerably more expensive than setting up your own.
In most cases, an old PC or laptop will suffice. It’s not advisable to run a node on your day-to-day computer as it could slow it down considerably. The blockchain grows continuously, so you’ll need to ensure that you have enough memory to download it in its entirety.
A 1TB hard drive will suffice for the next several years, provided there isn’t any major change to the block size. Other requirements include 2GB of RAM (most computers have more than this by default) and a lot of bandwidth.
From there, the Running a Full Node guide on bitcoin.org details the process of setting your node up.
How to mine Bitcoin
In the early days of Bitcoin, it was possible to create new blocks with conventional laptops. The system was unknown at that point, so there was little competition in mining. Because activity was so limited, the protocol naturally set a low mining difficulty.
As the network’s hash rate rose, participants needed to upgrade to better equipment to stay competitive. Transitioning through various kinds of hardware, the mining industry eventually entered what we might call the Application-Specific Integrated Circuits (ASICs) era.
As the name might suggest, these devices are built with a specific purpose in mind. They’re extremely efficient, but they’re only capable of performing one task. So, a mining ASIC is a specialized computer that is used for mining and nothing else. A Bitcoin ASIC can mine Bitcoin, but can’t mine coins that don’t use the same algorithm.
Mining Bitcoin today requires significant investment – not only in hardware but also in energy. At the time of writing, a good mining device performs upwards of ten trillion operations per second. Although very efficient, ASIC miners consume tremendous amounts of electricity. Unless you have access to several mining rigs and cheap electricity, you’re unlikely to ever turn a profit with Bitcoin mining.
With the materials, however, setting up your mining operation is straightforward – many ASICs come with their own software. The most popular option is to point your miners towards a mining pool, where you work with others to find blocks. If you’re successful, you’ll receive part of the block reward proportional to the hash rate you’ve provided.
You can also choose to solo mine, where you work alone. The probability of generating a block will be lower, but you’ll keep all of the rewards if you create a valid one.
How long does it take to mine a bitcoin?
It’s difficult to give a one-size-fits-all answer because there are a number of variables to consider. How quickly you can mine a coin depends on the amount of electricity and hash rate available to you. You’ll also need to factor in the costs of actually operating a mining device.
To get an idea of the revenue generated from mining Bitcoin, it’s recommended that you use a mining calculator to estimate costs.
Who can contribute to the Bitcoin code?
The Bitcoin Core software is open-source, meaning that anyone can contribute to it. You can propose or review new features to be added to the 70,000+ lines of code. You can also report bugs, or translate and improve the documentation.
Changes to the software go through a rigorous reviewing process. After all, software that handles hundreds of billions of dollars in value must be free of any vulnerabilities.
Source: Binance
Comments