What is SegWit? Guide to Bitcoin’s Segregated Witness

Interested in knowing what is SegWit? Read our in-depth explanation of the technology, its origins, and its uses in the Bitcoin (BTC) network.

Staying current with technical innovations in crypto is crucial for anyone involved, whether you’re a miner, trader, or enthusiast. Although a few years old, one noteworthy innovation worth knowing about is segregated witness, commonly known as SegWit.

In this article, we will help answer the question, “What is SegWit?” We will break down the technology, explain how it works, and what are its benefits as well as drawbacks for the Bitcoin blockchain.

What is SegWit?

SegWit is a protocol upgrade proposed in 2015 by Peter Wuille that Bitcoin implemented in August 2017. Wuille proposed SegWit to solve the problem of transactional malleability, which is the ability to change the unique identifier or digital signature of a crypto transaction before miners confirm it on the blockchain.

Incidentally, the solution also enhanced Bitcoin’s scalability and enabled the computers that make up the Bitcoin network, also known as nodes, to adopt a new transaction structure.

However, despite the benefits that came with it, SegWit faced significant opposition, leading to a split in the Bitcoin community. The central conflict was between miners, who were concerned about their profitability, and developers, who wanted to make Bitcoin faster and more affordable. 

This tension resulted in the network’s first user-activated soft fork and triggered the events that led to several new Bitcoin-forked projects, including Bitcoin Cash (BCH).

Nevertheless, SegWit eliminated Bitcoin’s malleability issues and improved its scalability and efficiency by altering how the blockchain stores transaction data. 

In past Bitcoin transactions, all parts of the transaction, including the sender and receiver information and digital signatures, also known as witness data, were stored together in a single block. SegWit, however, separates the witness data from the transaction data, allowing more transactions to fit into a single block. 

It effectively made it near impossible to alter a transaction’s digital signature, an act that can potentially invalidate other transactions (often called child transactions) that depend on it.  Bad actors can use this vulnerability to defraud or disrupt a blockchain’s operations.

Additionally, it increased the block size limit of the Bitcoin blockchain, thereby enhancing its capacity to handle more transactions per second (TPS).

How does SegWit work?

To answer the question “How does SegWit work,” you first need to grasp the structure of a Bitcoin transaction. 

As touched on in the section above, Bitcoin transactions usually consist of two main components:

  • Transaction data: This includes the sender’s and recipient’s addresses, the amount users are sending, and other essential information.
  • Witness data: It consists of the digital signatures that verify the transaction’s validity.

Before segregated witness, transaction data and witness data were stored together in a block. This arrangement limited the block size and made the network vulnerable to transaction malleability.

How did SegWit fix transaction malleability?

SegWit tackled the issue of transaction malleability by separating the signatures from the transaction data. Malleability in transactions can happen in two ways. First, after a transaction is signed, bad actors can add extra data to the script, which holds the signature and other unlocking data. Second, they can alter the signature within the said script. 

Since the script, known as ScriptSig, and its signatures are part of the transaction ID, any changes to them ultimately alter the transaction ID.

SegWit solved this issue by removing all data, including signatures and public keys, from the ScriptSig and moving it to the witness, a new part of SegWit transactions not included in the transaction ID. In that way, the ScriptSig became immutable after signing, thus preventing any changes to the transaction ID without invalidating the entire transaction.

How did SegWit increase the block size?

SegWit increased the block size by introducing a new measurement system called block weight. This system allowed more transactions to fit into each block without directly increasing the block size limit.

Before SegWit, Bitcoin limited each block to 1MB of data, which typically allowed for about 1,650 transactions per block. Block weight, which is calculated in weight units, replaced the block size as the limiting factor and allowed a full block to contain as many as 2,700 transactions.

What is SegWit used for?

Segregated witness provides several significant use cases to the Bitcoin network:

Fixing transaction malleability: The primary purpose of SegWit was to patch the transaction malleability bug in Bitcoin and similar cryptocurrencies that allowed the modification of transaction IDs before they were confirmed, causing issues with transaction tracking and security. 

As previously described, SegWit fixed that issue by moving the signature data to a separate part of the transaction that is not included in the transaction ID calculation, making the transactions immutable once signed.

Increasing transaction throughput: SegWit effectively increases the block size limit, as described in the section above, allowing more transactions to fit into each block. As a result, the network can process more transactions per second, improving Bitcoin’s ability to handle increased activity.

Reducing transaction fees: Since Bitcoin miners can include more transactions in each block they validate, it means the supply of transaction space also increases, which can help lower the fees during periods of high demand.

Enabling layer-2 solutions: SegWit paved the way for layer-2 (L2) solutions on Bitcoin, such as the Lightning Network, by addressing transaction malleability and improving scalability. These solutions are built on top of the Bitcoin blockchain to enable faster and cheaper transactions, significantly enhancing Bitcoin’s usability for everyday transactions.

Improving network flexibility: The SegWit upgrade also made implementing future improvements and upgrades to the Bitcoin protocol easier. It helped create a more modular transaction structure, allowing developers to introduce new features and optimizations without requiring disruptive changes to the network.

Enhancing security: Fixing transaction malleability and making transactions more efficient made the Bitcoin network less susceptible to various types of attacks and vulnerabilities.

Advantages and disadvantages of SegWit

While SegWit has brought many benefits to the Bitcoin network, it’s not without its criticisms and challenges. Let’s look at both sides.

Advantages

1. Scalability: As mentioned earlier, SegWit increases the number of transactions that can be processed per block, helping to alleviate congestion on the Bitcoin network.

2. Reduced fees: More efficient use of block space means that users can often enjoy lower transaction fees.

3. Improved security: SegWit enhances the security of Bitcoin transactions, particularly for complex transactions involving multiple signatures, by eliminating transaction malleability.

4. Enabling future upgrades: SegWit lays the groundwork for future protocol upgrades and innovations, such as the Lightning Network, which aims to further improve Bitcoin’s scalability and speed.

Disadvantages

1. Adoption rate: While SegWit adoption has grown over time, it was initially slow, with many users and services, including Bitcoin wallets, taking time to upgrade. Furthermore, not as many Bitcoin services, including Bitcoin wallets, have supported SegWit changes

2. Complexity: The changes introduced by SegWit can be complex and require significant adjustments by developers and service providers.

3. Block size debate: SegWit caused divisions in the Bitcoin community, with some members believing that simply increasing the block size would be a more straightforward solution to scalability issues rather than implementing SegWit. It triggered the formation of several hard forks, including Bitcoin Cash.

4. Less income for miners: The lower fees occasioned by SegWit may demotivate miners since it affects their profits. Additionally, supporting the sidechain that holds the witness data, may be seen as an encumbrance by participants since it provides no revenue.

Conclusion

So there you have it, a segregated witness explained, as a critical upgrade for Bitcoin, addressing key issues like transaction malleability and scalability. You have read how SegWit works by separating witness data from transaction data and how that allows more transactions to fit within a block, leading to increased transaction throughput and lower fees. 

You have also seen how the separation of data inadvertently increased Bitcoin’s block size and allowed for improved scalability and efficiency. This has in turn allowed for the development of L2 networks on the Bitcoin blockchain.

Share with your friends!

Products You May Like

Leave a Reply

Your email address will not be published. Required fields are marked *