Why Bitcoin needs Segregated Witness

Magnum Wallet
5 min readMar 20, 2019

--

Satoshi Nakamoto deserves praise for creating Bitcoin and opening a world of possibilities to all of us, but his project was not without flaws. In this article, we will explain why SegWit was proposed and how it can benefit Bitcoin in the long term.

Bitcoin’s Woes

Blocks are largely comprised of transaction data, which in turn mostly consist of signature information and are used to create transaction IDs.

One persistent issue in Bitcoin’s original protocol has been malleability, as these transaction IDs can be rewritten before a miner includes them in a block. Fraudsters can trick users into sending their coins twice if the other side only has the original transaction ID and can’t verify if there is another pending transaction with the same data.

Although this has been fixed by the majority nodes and wallet services, it nevertheless makes interdependent transactions very unreliable. For instance, if someone is waiting for an incoming transaction to be confirmed, they could theoretically use this information as proof of balance. But merchants are not inclined to accept it, as malleability exposes this transaction information to changes by a third party.

The Long and Winding Road

Segregated Witness, or SegWit, was first put forward by Pieter Wuille in 2015. Seeing the enormous impact Bitcoin’s malleability had on the network as a whole, he suggested a patch that would provide a permanent fix and open new possibilities for Bitcoin. Regardless of how relevant his proposal was, it was not implemented right away.

Overall, it took the community the better part of the two years after the initial proposal to come to terms with the idea and release it on the mainnet. There were many ideas floating around on how to activate SegWit with minimal damage. One that probably attracted the most public attention was SegWit2x, a hard fork proposed by miners and other businesses in May 2017 and aimed to double the block size in addition to SegWit.

However, it failed to gain traction, and a user activated soft fork (UASF) eventually took over as the main driver of SegWit adoption. Known as Bitcoin Improvement Proposal (BIP) 148, it was activated on August 1st, 2017, which is often referred to as the Bitcoin Independence Day. BIP 148 revealed the power that users and nodes hold in the network.

Introduction of SegWit caused the split in the community leading to the creation of Bitcoin Cash. This fork was created by a group of Bitcoin activists and promoted by Roger Ver with a goal to expand the block size limit and achieve a higher throughput within the same block times. Unlike Bitcoin and Litecoin, this cryptocurrency does not see malleability as a real issue and thus does not plan to deal with it in the near future.

And yet even now, as of March 2019, SegWit accounts for barely half of all transactions in Bitcoin. Many nodes and wallets in particular are reluctant to part with higher fees, and they refuse to store what can be described as a sidechain without due compensation.

It is worth mentioning that Litecoin, a brainchild of Charlie Lee and a fork of Bitcoin, had implemented SegWit on its blockchain over 3 months before Bitcoin. Furthermore, it has a larger share of transactions being done with Segwit.

The Nitty Gritty

To understand just how SegWit works, we first need to briefly go over how Bitcoin transactions are handled:

  1. First, a user signs and submits a transaction to the network.
  2. After some time the transaction is included in a block by a miner.
  3. Other nodes verify and accept the transaction thereby cementing it in the ledger.

Each block produced without SegWit is limited to 1MB and, as mentioned above, contains the transaction data, two-thirds of which is taken up by digital signatures.

By removing the signature information (or “Witness”) from the block, SegWit allows more transactions to fit in the same space. The signature information is stored separately on the same blockchain but does not count towards block size.

This way nodes that do not support SegWit are still able to identify the transactions but are not able to verify them. Since the majority of the miners already support SegWit, the rest of the nodes do not require access to the signatures at all.

There are three different types of addresses currently used in Bitcoin:

  1. P2PKH are standard Bitcoin addresses that start with the number 1.
  2. P2SH, beginning with number 3, can be used as so-called SegWit legacy addresses, meaning that they can be handled by a node that does not fully support SegWit.
  3. Bech32 (or P2WPKH), starting with bc1, are native SegWit addresses that have not yet seen widespread adoption as of March 2019.

While wallets, exchanges, and explorers are taking their time in catching up to bech32, some already see it as an urgent issue in the community.

SegWit makes the network lighter for many nodes and therefore cheaper for the end user. At the same time, other solutions such as Lightning Network can be implemented over it. They need SegWit addresses (bech32 ones by default) to be able to safely operate on the mainnet. Lightning allows its users to perform transactions without having to submit them all into the main blockchain.

Pros & Cons

To recap, SegWit is a promising technology that has brought about long-awaited changes to the Bitcoin protocol:

  • Lower fees
  • No transaction malleability
  • Lightning Network and other solutions
  • Backward compatibility

On the other hand, SegWit came with some drawbacks.

  • Many companies lack the incentives to adapt and switch to new standards.
  • It has led to conflicts in the community.
  • Having gotten off to a rocky start, it is still not universally accepted.

How to use SegWit

In order to start using SegWit, one must first obtain a SegWit wallet. Magnum provides its users with the ability to create and manage Bitcoin accounts with all possible types of addresses, including native and legacy SegWit. Keep in mind that it takes no time to set up a new account, so you can start saving on transaction fees right away.

--

--