Segregated Witness (SegWit) is a protocol upgrade introduced in 2015 as a solution to the scalability problem faced by blockchain. Currently, the Bitcoin blockchain can only process around 7 transactions per second, which can take a long time compared to conventional payment solutions and financial networks that can process thousands of transactions per second. The concept behind SegWit is to reorganize block data so that signatures are no longer placed along with transaction data. The upgrade involves segregating the witnesses (signatures) from transaction data, allowing more transactions to be stored in a single block, and increasing the transaction throughput of the network.
SegWit was developed in 2015 by Pieter Wuille, a Bitcoin developer, and 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, as well as solved the transaction malleability bug. On average, the Bitcoin network validates a new block every 10 minutes, with each block containing several transactions. The block size affects the number of transactions that can be confirmed in each block.
Benefits of SegWit
SegWit provides several benefits to the Bitcoin network. One of the most significant benefits is the increase in block capacity. With SegWit, more transactions can be stored in a block since the signature data is removed from the input. Previously, the signature data could take up to 65% of a block, but now it is separated from the input field, allowing the effective block size to increase from 1 MB to about 4 MB.
SegWit is not an actual block size increase but rather an engineering solution to increase the effective block size. The block size remains at 1 MB, but the effective block size limit is 4 MB, which is calculated using the concept of block weight.
With more transactions being processed in each block, SegWit also increases transaction speed and reduces transaction costs. Prior to SegWit, transaction fees could reach over $30 per transaction, but SegWit has significantly reduced the cost to less than $1 per transaction.
SegWit also fixed the issue of transaction malleability, which was a significant problem with Bitcoin transactions. Altering a transaction's signature could corrupt a transaction between two parties, and the data stored on blockchains are immutable, making invalid transactions permanently stored on the blockchain. SegWit solved this problem by separating the signatures from the transaction data, allowing for further innovation within the blockchain community, such as second-layer protocols and smart contracts.
SegWit and the Lightning Network
The transaction malleability bug fix paved the way for the development of second-layer protocols, which are new platforms built on top of blockchains like Bitcoin. One popular protocol is the Lightning Network, which is an off-chain micropayment network that aims to confirm more transactions in a shorter time frame, leading to faster transactions for users. Transactions are buffered off-chain and later processed by the Bitcoin network.
Initially developed for Bitcoin, the Lightning Network is being considered by other blockchain projects to reduce confirmation time for transactions and develop new solutions to scalability issues.
SegWit vs. SegWit2x
The proposed SegWit2x (S2X) implementation of the Bitcoin network would have required a hard fork upgrade, whereas SegWit is a backward-compatible soft fork. 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). However, a larger block size would increase the burden on node operators and miners, as there would be more data to be handled.
While the SegWit proposal was supported and enforced by the Bitcoin community, the SegWit2x movement was ultimately suspended due to the inability of developers to reach a consensus on its adoption and implementation. The SegWit upgrade gave birth to the concept of UASF, or user-activated soft fork.
Nested SegWit vs. Native SegWit (bech32)
Native SegWit, also called bech32, is an improved version of Nested SegWit. It offers several benefits, including faster transaction speed, better error-detection mechanisms, and lower transaction fees. Bech32 addresses are also more readable as they are in lowercase letters.
It's important to note that blockchain transactions are compatible between non-SegWit (Legacy), Nested SegWit, and Native SegWit addresses. However, not all exchanges and cryptocurrency wallets support SegWit, so you might not be able to withdraw funds directly to a SegWit address.
The support and implementation of SegWit by the decentralized community marked the most significant protocol upgrade of Bitcoin. SegWit solved several scalability issues related to Bitcoin and other blockchain networks, making it a crucial step forward. Through SegWit and second-layer protocols, blockchain networks can handle more transactions, efficiently and with lower costs.
However, despite being a powerful and innovative solution, the full adoption of SegWit is yet to be achieved. Presently, only 53% of Bitcoin addresses use SegWit.