What the fork is SegWit? Everything you need to know about Bitcoin scaling

What the fork is SegWit? Everything you need to know about Bitcoin scaling

If you’ve been wondering about why Bitcoin transactions have been slowing down lately, that’s because it is reaching its limit in terms of block size.

In August this year, the Bitcoin Core developers finally implemented SegWit on the Bitcoin Blockchain, thus making the platform faster and more scalable.

To put simply, the SegWit modification provides a way to get more transactions committed faster by changing which data is stored within each block and which is segregated. But to really understand what it means, let’s take a step back and understand the concept of the blockchain and what blocks are.

What is a block?

Cryptocurrencies and blockchains are essentially built out of blocks, which are a unit of information.

With the Bitcoin blockchain, each block has a limit of 1 MB. The blockchain is composed out of a series or “chain” of blocks, which make up the public ledger, a copy of which resides on all the Blockchain nodes. It’s an endless number of blocks being tied or chained to one another through a cryptographic hash.

A block consists of two parts: a header and a body. Within the block, there are different layers of data. The header stores a cryptographic hash of the previous block, along with a time signature and other data. The body stores the transactions, including sender data and receiver public keys, which help ensure that these are legitimate transactions.

The problem is that as transactions increase and become data-heavy, it clogs the blocks, which bogs down the network when demand is high. This becomes an increasing issue as more people start using Bitcoin and adopt the technology. In order for the Bitcoin to succeed and be useful, a solution to process the blocks faster is necessary.

This is called Bitcoin Scaling.

Credit: The Atlas
Increasing size of Bitcoin Blocks

SegWit

One of the proposed code improvement protocols designed to solve the Blockchain size limitation is called SegWit — a portmanteau of “Segregated Witness”.

Proposed by the Bitcoin Core development team in 2016, the SegWit protocol breaks the original block into two parts: the original block and an extended “witness” block. It removes the script or code from the transactions and puts it into an extended block, which creates more vacant space in the original block. The blocksize remains the same, but it can contain data more efficiently. Meanwhile, the witness segment is counted as a quarter of its original size.

The original section will still contain the sender and receiver data, while the new “witness” segment would now contain the scripts and signatures. So, you’ll have the block with just the header (recipient’s details) and another independent block (extended block) with the “code” or script (signatures and the public key of sender).

Consider this analogy:

A single lane highway runs smoothly with 5,000 cars driving in it simultaneously. But, as more cars start using the highway — say 50,000 vehicles — the lane will be clogged since the cars are being forced to wait for their turn.

SegWit is basically creating one more fast lane in the highway, in order to accommodate more traffic.

And to put things into perspective, in 2009 when Bitcoin was created, there was only one “car” or transaction driving in the proverbial lane. Let’s imagine the car was driven by Satoshi Nakamoto. Then another car (transaction) entered the fast lane and then more and more followed. Being forced to drive one after the one or processed one after the one (Blockchain ledger) means everyone needs to wait his or her turn. It is now coming to a point when transactions are so slow that users have to wait hours for confirmation.

SegWit is considered a “soft fork”, meaning it’s compatible with the old code, which also means it can be retroactively implemented on the entire Bitcoin Blockchain. It is different from a hard fork, wherein new code is not compatible with the existing Blockchain, thus creating another “currency” and a separate Blockchain (more on that later).

In late July, the world’s biggest miners “agreed” or signaled on its activation, and now it is finally implemented. The protocol basically boosts Bitcoin’s capacity whilst maintaining compatibility with its legacy version.

There are several implications here.

First, by improving efficiency, it enables transactions to be confirmed faster. As a result of that, it will also potentially reduce the relatively higher transaction fees that were an offshoot of the increased demand.

SegWit also addresses “transaction malleability” which is a potential vulnerability that could be used to modify transaction IDs. By moving the malleable parts of the transaction to the segregated witness, any changes will not affect the calculation of the transaction ID.

Lightning Network

SegWit laid the groundwork for a “Lightning Network”, where transactions are faster, cheaper, and more scalable. It also opens up payment channels that move transactions off the main blockchain, and some developers have already worked on this technology.

The Lightning Network expands on the Bitcoin Blockchain’s basic transaction functionality by providing a means for users to execute smart contracts on the blockchain itself, providing for a mechanism for users to establish near-instant micropayments without the need to offload transactions to a custodian, which makes small payments impractical because the fees might be more expensive than the transaction itself.

Through time-lock and hash-lock mechanisms and a trust-less system wherein transactions can be committed while broadcasting to the rest of the Blockchain at a later time, users can send as little as 0.00000001 BTC, or 0.01 bits, without the need for custodian fees (which can make such micropayments impractical otherwise).

Lightning Network effectively makes Bitcoin Scaling possible by conducting such transactions off-chain using Bitcoin scripting, with enforcement done through broadcasting signed multi-signature transactions on the blockchain itself.

The Lightning Network isn’t ready yet and is currently being tested.

SegWit2x

Another proposal to address Blockchain limitations is SegWit2x, which segregates the witness data and also increases block sizes from 1 MB to 2 MB.

Sounds pretty similar, right?

Well to start things off, SegWit2x will be a hard fork, meaning it will not be compatible with previous blocks (a.k.a. the entire existing Blockchain). Users will have to update their version to the latest protocol.

In other words, a hard fork is a permanent divergence from the previous/existing blockchain, and nodes running previous versions will have to update to the new one. This essentially means the emergence of a new blockchain.

To implement SegWit2x would need the absolute majority of miners to agree to fork, however, since it’s a very and radical change, which will require significant hardware and capability upgrade for nodes due to the blocksize increase.

SegWit2x does have the support of a significant number of high-profile businesses and individuals attached to Bitcoin, although the Bitcoin Core team itself does not endorse the proposal.

So to finish off with an analogy, SegWit2x is creating another fast line as well as widening the existing highway lane.

The August Hard Fork (a.k.a. Bitcoin Cash)

Meanwhile, while these proposals were being put forward and tested, a group of major Bitcoin miners who previously supported the SegWit2x proposal decided that deploying SegWit without increasing the block size would not be sustainable, as it would simply delay the scaling issue due to the size limit.

At 13:20 UTC on August 1, 2017, “Bitcoin Cash” forked from the main Bitcoin block 478559, inheriting all previous blocks in the chain, but rejecting Bitcoin and Bitcoin block transactions henceforth.

The hard fork essentially increases the block size to 8 MB, and it also removes the SegWit code change that was targeted to be activated later in the month.

This new blockchain makes it easier to make a block.

And in contrast to the Bitcoin Blockchain wherein mining gets tougher with time, with the Bitcoin Cash Blockchain mining gets tougher with the number of blocks created.

At the beginning, it proved to be profitable to mine on the Bitcoin Cash blockchain, but once miners started to exploit it, sporadic block generation and adjustment difficulties resulted in challenges for miners.

What you need to understand

Bitcoin is a peer-to-peer decentralized currency, and therefore transactions are a democratic “public agreement”.

When it was first launched, the founders and core developers probably did not expect adoption to scale at the level we are in now, and hence stuck with a 1 MB blocksize limit.

This particular limit has been a point of contention for years now, and it has resulted in so-called “civil wars” that have led to breakaway groups, like BitcoinUnlimited. The recent hard fork of Bitcoin Cash, however, still needs to prove its long-term viability.

Either way, whether you are an investor into cryptocurrencies, a user, a miner, or basically anyone with a stake in this industry and technology, the above are steps taken toward improving the security and reliability of the network.

As for the long-term impact of hard forks and difficulty in gaining consensus from the network of nodes and miners, we have yet to see.

This post is part of our contributor series. The views expressed are the author's own and not necessarily shared by TNW.

Read next: Bassheads will love VAVA's $26 wired 'gaming' earphones