Segregated Witness, or SegWit, is a significant protocol upgrade (technically, a soft fork) for the Bitcoin network that was activated in August 2017, after more than two years of community debate and testing.
It was introduced to solve some of the pressing issues faced by the Bitcoin blockchain, particularly the problem of transaction malleability and Bitcoin’s block size limit. Since its launch, the SegWit upgrade has introduced technologies that have inspired other updates in the Bitcoin blockchain network, including Taproot.
In 2023, the SegWit protocol was instrumental in the development and launch of a milestone protocol for Bitcoin: Ordinals. SegWit's role in the implementation and execution of Ordinals shed another light on its ability to help Bitcoin scale and build applications on top of the Bitcoin network.
In this Learn Center post, we'll explore what SegWit is, how it works, its benefits, its impact on the Bitcoin network and Bitcoin scalability.
What is Segregated Witness?
In every Bitcoin transaction from one party to another, a public address and a private key are required. The public address allows Bitcoin users to send and receive Bitcoin, and it's an address that's public to the entire network.
But for extra security, every public address has a private key associated with it. Private keys cannot be seen as they are used to verify that an address actually belongs to a user. A digital signature is something that users can use to prove that they do, in fact, own the private key associated with the public address.
In order to send and receive Bitcoin, users need to broadcast the request to the Bitcoin network. That request includes the public address, the amount of Bitcoin in the transaction, and a transaction fee for the miners. Miners validate the transaction, and the validated transaction is then added to the mempool -- a waiting area of sorts for unconfirmed Bitcoin transactions. Transactions are added until the block limit is reached, and then a block is created and broadcasted to the nodes. Once these nodes are validated, then the blocks are added to the blockchain.
The digital signature is part of the transaction data and takes up space in the block. The size of each block on the Bitcoin network is limited to 1 megabyte (MB), which was set in the early days of the Bitcoin protocol. This limitation meant that only a fixed number of transactions could fit in each block. As more people started using Bitcoin and joined the Bitcoin community, this limit became a bottleneck as an increasing number of users wanted to receive and send bitcoin. Ultimately, this led to slower transaction processing times and high transaction fees.
SegWit was introduced as a solution to this problem by separating the digital signature from the transaction data, effectively allowing more transactions to be included in each block. This results in faster transaction processing times and lower transaction fees.
How Does SegWit Work?
SegWit works by separating the digital signature, the "witness data," from the transaction data and storing it in a separate block (the "segregated witness" block). The witness block is attached to the original transaction block, but it is not counted towards the 1 MB limit. This means that more transaction data can fit in the block, resulting in faster transaction processing times.
In addition to separating the digital signature from the transaction data, SegWit also includes a new transaction format that is more efficient than the previous format. This new format, known as the SegWit transaction format, reduces the size of the transaction by removing certain data elements that are not necessary for the transaction to be verified. This further reduces the amount of space that each transaction takes up in the block, allowing more transactions to be included in each block.
The Benefits of SegWit for Bitcoin
Most notably, SegWit implementation allowed for increased transaction capacity. Thanks to SegWit, Bitcoin's block weight limit increased to 4 million weight units from 1 million weight units. By separating the digital signature from the transaction data, SegWit allows for more transaction data to fit into each block. This increases the overall transaction capacity of the Bitcoin network, leading to faster transaction processing times and lower transaction fees.
SegWit also addressed concerns on the Bitcoin block like transaction malleability. Transaction malleability is the ability to modify the transaction ID (TXID) of a transaction without invalidating the signature, which can create confusion and make it difficult for the network to recognize the transaction. SegWit fixed transaction malleability by separating the signature data from the transaction ID, which makes it impossible to modify the TXID without also invalidating the signature.
The advantages that SegWit introduced to the Bitcoin core also solidified how SegWit helps find a solution to the scalability problem. One of the most notable examples of SegWit adoption was with the Lightning Network. SegWit's transaction malleability fix and separation of witness data from transaction data were essential in enabling the Lightning Network to become a reality. Nowadays, the Lightning Network has become an important layer 2 solution for Bitcoin, allowing for faster and cheaper transactions and paving the way for further innovation on the Bitcoin network.
SegWit vs. SegWit2x
SegWit and SegWit2x are two different proposals for improving the Bitcoin network's scalability and transaction speed. While they share similarities, they also have distinct differences that led to controversy and debate within the Bitcoin community. SegWit2x was a proposed hard fork upgrade that aimed to increase the block size limit from 1 MB to 2 MB. The proposal was introduced in May 2017 and gained support from a group of miners and businesses in the Bitcoin ecosystem.
However, the SegWit2x proposal quickly became controversial, with some members of the Bitcoin community arguing that it was unnecessary and potentially harmful to decentralization on the Bitcoin network. Opponents of SegWit2x argued that increasing the block size limit would make it more difficult for regular users to run nodes and participate in the network, which would lead to further centralization.
Despite the controversy, SegWit2x moved forward with plans to implement the hard fork in November 2017. But as the fork date approached, it became clear that there was not enough community consensus for the upgrade to go through. Several key businesses withdrew their support for SegWit2x, and the fork was ultimately called off.
SegWit and Scaling the Bitcoin Network
Nowadays, many cryptocurrency wallets support SegWit as the implementation of SegWit has grown. Its overall positive perception throughout the Bitcoin community has given Bitcoin and other blockchain networks an example of what is possible.
And more recently, the Ordinals protocol has shown how upgrades like SegWit can impact the future of the Bitcoin blockchain. Ultimately, it enabled a change to the Bitcoin protocol that transformed what people thought of Bitcoin and cryptocurrency, which has left the wider web3 community wondering what else can be done to improve not only transactions on the Bitcoin blockchain, but more.