A Beginner’s Guide to Segregated Witness (SegWit)
Əsas səhifə
Məqalələr
A Beginner’s Guide to Segregated Witness (SegWit)

A Beginner’s Guide to Segregated Witness (SegWit)

Advanced
Dərc edilmişdir Nov 25, 2019Yenilənib Jun 13, 2023
6m

What is SegWit?

Segregated Witness (SegWit) is a protocol upgrade developed in 2015. The concept was introduced as a solution to the scalability problem that blockchain networks were and are still facing today. 

On average, the Bitcoin network validates a new block every 10 minutes, each containing several transactions. As such, the block size affects the number of transactions that can be confirmed in each block. Currently, the Bitcoin blockchain can process around 7 transactions per second.

SegWit’s main idea is to reorganize block data so that signatures are no longer placed along with transaction data. In other words, the SegWit upgrade consists of segregating the witnesses (signatures) from transaction data. This allows for more transactions to be stored in a single block, increasing the transaction throughput of the network.

By only being able to process about 7 transactions per second, a Bitcoin transaction can sometimes take a long time to go through. That's a lot slower when compared to conventional payment solutions and financial networks, which can process thousands of transactions per second.

SegWit was developed in 2015 by Bitcoin developer Pieter Wuille, along with other Bitcoin Core contributors. In August 2017, the SegWit upgrade was implemented as a soft fork on the Bitcoin network.

Today, several cryptocurrency projects are using SegWit, including Bitcoin and Litecoin. The protocol upgrade brought up many benefits, such as improved transaction speed and block capacity. Also, SegWit solved the so-called transaction malleability bug (discussed below).


What are the main benefits of SegWit?

Capacity increase

One of the biggest benefits of SegWit is the increase in block capacity. By removing the signature data from the transaction input, more transactions can be stored within a single block.

Transactions consist of two main components: inputs and outputs. Essentially, an input contains the sender's public address, while the output contains the public address of the recipient. However, the sender must prove that they have the funds being transferred, and they do so with a digital signature.

Without SegWit, the signature data can take up to 65% of a block. With SegWit, the signature data is moved away from the transaction's input. This causes the effective block size to increase from 1 MB to about 4 MB.

Note that SegWit is not an actual block size increase. Instead, it is an engineering solution to increase the effective block size without having to increase the block size limit (which would require a hard fork). To be more specific, the actual block size is still 1 MB, but the effective block size limit is 4 MB.

Also, SegWit introduced the idea of block weight. We may consider block weight as a concept that replaces the idea of block size. Essentially, block weight is a measure that includes all block data, including transaction data (1 MB) and the signature data (up to 3 MB), which is no longer part of the input field.


Transaction speed increase

With a block that can store more transactions, SegWit also has the ability to increase transaction speed, since there can be a larger amount of transactions moving through the blockchain. Even though a block may take the same amount of time to mine, more transactions are being processed in it, so the TPS rate is higher.

Increased transaction speed has also helped reduce transaction costs in the Bitcoin network. Before SegWit, it wasn't uncommon to spend over $30 per transaction. However, SegWit has dropped that cost dramatically to less than $1 per transaction.


Looking to get started with cryptocurrency? Buy Bitcoin (BTC) on Binance!


Transaction malleability fix

A major issue with Bitcoin was the ability to potentially tamper with transaction signatures. If a signature is altered, it could result in a transaction between two parties being corrupted. Since the data stored on blockchains are virtually immutable, invalid transactions could be permanently stored on the blockchain.

With SegWit, signatures are no longer a part of the transaction data, which removes the possibility of altering this data. This fix has allowed further innovation within the blockchain community, including second-layer protocols and smart contracts.


SegWit and the Lightning Network

The development of second-layer protocols was partially enabled by fixing the transaction malleability bug. Simply put, second-layer protocols are new platforms or products that are built on top of a blockchain, such as Bitcoin. One of the more popular second-layer protocols is the Lightning Network, an off-chain micropayment network.

The Lightning Network is a second-layer protocol that operates on top of the Bitcoin network. The Lightning Network's main purpose is to allow more transactions to be confirmed in a shorter amount of time, resulting in faster transactions for users. Transactions are collected off-chain and effectively buffered for the Bitcoin network to eventually process.

The Lightning Network was originally developed for Bitcoin. However, several other cryptocurrency and blockchain projects are working on implementing the technology for their networks. This will not only reduce the confirmation time for transactions but also foster the development of new solutions to the scalability problem.


SegWit vs. SegWit2x

SegWit is a soft fork upgrade, meaning that it is backward-compatible. In other words, Bitcoin nodes that are not updated to include SegWit are still able to process transactions. However, there was another proposed SegWit implementation called SegWit2x (S2X), which would require a hard fork upgrade.

The key difference between SegWit and SegWit2x is that the latter would have not just included a change in transaction batching, but also an increase in the block size (from 1MB to 2MB). Still, a larger block size would increase the burden on node operators and miners, as there would be more data to be handled. 

Another notable difference is that the SegWit proposal was supported and enforced by the Bitcoin community. The episode gave birth to the concept of UASF, which stands for user-activated soft fork.

On the other hand, the SegWit2x proposed a substantial change to one of the fundamental rules governing Bitcoin. But since developers were unable to come to a consensus on its adoption and implementation, the SegWit2x movement was ultimately suspended.


Nested SegWit vs. Native SegWit (bech32)

In short, Native SegWit (also known as bech32) is an updated version of the Nested SegWit. The bech32 format offers increased transaction speed, better error-detection mechanisms, and even lower transaction fees. Also, bech32 addresses are lowercase, making them easier to read.

Note that blockchain transactions between non-SegWit (Legacy), Nested SegWit, and Native SegWit (bech32) addresses are fully compatible. However, not all exchanges and crypto wallets support SegWit, so you might not be able to withdraw funds directly to a SegWit address.

The Binance exchange supports SegWit deposits and withdraws for Bitcoin (BTC). You can find more information on the SegWit FAQ.


Closing Thoughts

The implementation of SegWit marked the biggest protocol upgrade of Bitcoin, and the fact that it was supported and implemented by the decentralized community makes it even more interesting.

The introduction of SegWit was a major step forward in solving many problems related to Bitcoin and other blockchain networks - especially in regards to scalability. Through the combination of SegWit and the second-layer protocols, blockchain networks can handle a larger number of transactions, with more efficiency and lower costs.

Despite being a powerful and innovative solution, SegWit is yet to be fully adopted. Currently, the percentage of Bitcoin addresses using SegWit is around 53%.