What is Segregated Witness (SegWit)?
Segregated Witness, also known as SegWit, is a Bitcoin soft fork implemented in August 2017 that separated the signature data and the transaction data in a Bitcoin block.
SegWit was officially called BIP 141 and was proposed by Eric Lombrozo, Johnson Lau, and Pieter Wuille in December 2015. The upgrade aimed to solve scalability and transaction malleability issues on the Bitcoin protocol.
It is one of the most notable upgrades of the Bitcoin scaling roadmap.
How Does SegWit Work?
To fully understand the definition of SegWit and why it was implemented, we need to learn the basics of a Bitcoin transaction.
A Bitcoin transaction contains two key parts: the base transaction data and the witness.
- The base transaction data consists of the inputs and outputs of bitcoins from one address to another.
- The witness contains digital signature data that prove the ownership of the bitcoins being spent.
In the legacy Bitcoin protocol, both the transaction and witness data were stored as one in a Bitcoin block.
With Segwit, a new structure was introduced where the witness data containing scripts and signatures was compartmentalized separately in the Bitcoin block.
What Does SegWit Solve?
Transaction Malleability
The Bitcoin protocol has a bug known as the “malleability bug.” The code allows digital signatures to be altered even when a transaction is still waiting to be validated. While the alteration does not affect the validity of the signature, it does affect the hash value (or the unique identifier) of the transaction.
This effect creates complications in layer-two scaling solutions like Lightning Network and affects new transactions created from unconfirmed transactions
SegWit solves this problem by segregating the digital signatures from the input-output transaction data.
Scalability
One of the biggest limitations of the Bitcoin network is its block size limit of 1 MB. Solving this scaling limitation is not as simple as increasing the Bitcoin block size. Many sections of the Bitcoin community have advocated for larger block limits which caused a deep divide within the community, who argued about various consequences, including decentralization and miner revenue risks.
SegWit increases the Bitcoin block size to a theoretical 4 MB by separating the witness and transactional data. As digital signatures normally take up nearly 65% of the space in a Bitcoin block, SegWit increases the block space available by storing the witness data separately
Most importantly, SegWit achieved this feat in a backward-compatible manner and without causing drastic changes to the Bitcoin blockchain.
Therefore, legacy Bitcoin blocks exist alongside SegWit-compatible blocks.
Legacy Bitcoin Addresses vs. SegWit Addresses
Here are some differences and important points about legacy and SegWit Bitcoin addresses:
Legacy Addresses | SegWit Addresses |
Bitcoin’s original addresses that use single-signature P2PKH (Pay-to-Pubkey Hash) address | Use the P2SH script function that can be used for multi-sig addresses |
Addresses start with 1 | Addresses start with 3 |
Legacy blocks do not separate witness and transaction data | SegWit blocks separate witness and transaction data |
Transactions using legacy addresses incur higher fees compared to SegWit addresses | SegWit addresses offer lower gas fees due to the availability of higher block space compared to legacy blocks |
Supported by nearly all software and hardware wallets | Used only by SegWit-compatible wallets |
Bitcoins can be transferred to and from legacy addresses to a SegWit address | Bitcoins can be transferred to and from legacy addresses to a SegWit address |
History of SegWit: The Blocksize War
The history of SegWit is a fascinating one, filled with controversy and politics.
The implementation of SegWit was not straightforward. At the time, the Bitcoin protocol was embroiled in a civil war. Two factions within the community tussled with each other over the future of the blockchain.
Small Blockers
One camp known as the “Small Blockers” fought to keep the Bitcoin block size at 1MB. Small Blockers prioritized decentralization and security above all else.
They argued that a bigger block size would make it expensive for individuals to run Bitcoin nodes, thereby allowing centralized organizations with resources to dominate the network.
Big Blockers
The other camp, known as “Big Blockers,” reasoned that increased block capacity would allow Bitcoin to compete with traditional payment networks such as Visa and Mastercard.
Bigger blocks would allow the Bitcoin protocol to process more transactions and lower transaction fees.
The SegWit soft fork was caught in the middle of the tension between the two warring factions, which led to delays in its release. At one point, there was also the possibility of the SegWit upgrade being thrown out of the window as influential Chinese Bitcoin miners refused to support the upgrade.
The UASF
As SegWit failed to garner support from Bitcoin miners, a pseudonymous developer, “Shaolinfry,” introduced a proposal (BIP 148) called “user-activated soft fork” (UASF).
Shaolinfry argued that the hash power controlled by the miners was never intended to be a proxy for voting power on the Bitcoin protocol. Instead, Shaolinfry called for users running nodes to signal support for SegWit in order to enforce a user-activated soft fork. The reasoning behind BIP 148 was that if SegWit held an economic majority among Bitcoin users, miners would be compelled to support the soft fork.
The End of the Civil War
1 August 2017 was marked as the D-day for miners to activate SegWit. The proposal finally saw fruition in July 2017 as major Bitcoin mining companies like Bitmain flagged support for SegWit.
The decision was seen as a “compromise” by many, while others saw it as a win for the Small Blockers. Big Blockers – who vehemently opposed the Bitcoin roadmap – went on to hard fork a separate blockchain called Bitcoin Cash with a block size of 8MB.
The implementation of SegWit and the creation of Bitcoin Cash marked the end of the Blocksize War.
At the time of writing, Bitcoin Cash supports 32MB blocks compared to Bitcoin’s 1MB blocks.
The Bottom Line
The SegWit soft fork is an important event in Bitcoin’s history.
As of August 2023, the percentage of transactions using SegWit rose to 95% of all Bitcoin payments, according to data from transactionfee.info.