Home » SegWit: What Is It and How Does It Work?

SegWit: What Is It and How Does It Work?

by CryptoWordTalk
what is segwit

Segregated Witness (SegWit) is a protocol update that alters the way data is stored. On May 10, 2017, it was enabled on litecoin, and on August 23, 2017, it was launched on bitcoin.

The SegWit technology solves the problem of ” transaction malleability .” This issue prevents bitcoin transactions from being used in certain business applications.

This article takes a deep look at what Segregated Witness (SegWit) is and how it works.

What is SegWit?

SegWit is a technique that reduces the size of blocks on a blockchain by deleting signature data from Bitcoin transactions.

The process involves segregating select transaction details and placing them into an extended block. All non-witness-related information still remains in the original block, making it smaller.

Since this extra data does not need to be trusted, it can be removed. Therefore, Segregated Witness is a trustless mechanism that helps to shrink the size of transactions and increase the capacity of the blockchain network.

SegWit was implemented in response to Bitcoin’s scalability issues because SegWit allows for more transactions than would normally fit into one block. When fully utilized, SegWit will allow bitcoin transaction data to take up only 1 megabyte (MB) per block, as opposed to the current standard of 1 MB per every 2-3 transactions.

Seemingly insignificant changes like these pack a powerful punch in terms of innovation potential; some even say that they singlehandedly created an entirely new asset class: Bitcoin Cash (BCH). BCash shares the history of the Bitcoin blockchain up to August 1, 2017, but then diverges from it. It is essentially an altcoin that enables larger block sizes and faster transaction confirmation times than bitcoin.

Cutting it down

A secondary advantage that is becoming more important is that transactions are lighter without signature information. This implies that more data may be stored in a block, allowing bitcoin to process more transactions without increasing the block size.

SegWit pioneered a new notion known as “block weight.” Block weight is an estimation of the total size of a block and is determined by multiplying together the number of transactions, their sizes in bytes, and their weights.

Why was SegWit implemented?

Segregated Witness solves two different problems: transaction malleability and scalability. Transaction malleability describes situations where changes to specific details within a transaction can change its ID. This makes it possible to create two different transactions with the same ID and make it look like only one was created, thereby allowing for fraudulent activity on a blockchain network.

Transaction malleability is caused by bitcoin’s use of “inputs” in transactions. Inputs are essentially the addresses that receive funds from previous outputs.  A change of any input would result in a new hash (or ID), making all signatures and validation checks invalid. In other words, SegWit fixes problems relating to transaction malleability through transactions being untied from their IDs and additional scripts added to witness data.

When people talk about scalability issues in blockchain networks, they often refer to how many transactions can be processed per second (TPS). Currently, there is a 1MB block size limit that creates an upper boundary for the number of transactions per block.

While SegWit does not directly increase the TPS, it allows more transactions to be packed into each block without increasing the block size, which indirectly increases transaction volume. Since each new transaction must have its own input, this directly increases the output count on the network and indirectly increases throughput and performance.

Understanding SegWit

SegWit was originally introduced in 2016 as “Segregated Witness” and was intended to integrate Segregated Witness functionality with the bitcoin network from then onwards. Instead, after some delays due to lack of consensus on activation date from miners, Segregated Witness activated on August 24, 2017.

An official proposal about the benefits of Segregated Witness was published on March 2, 2016 by Sergio Demian Lerner.

SegWit gets its name from the concept of segregating transaction signatures to a more efficient data structure known as “witnesses.”  SegWit transactions also use less space in blocks, allowing for more transactions and ultimately higher scalability.  For example, if block weight was one million times larger than it is today due to SegWit implementation, then block size would only increase marginally from 1MB to 1.05MB (which is still far below the theoretical maximum capacity).

How does it work? What do you mean by “witnesses”?

Transactions on bitcoin’s blockchain are identified by a hash, derived from the transaction’s content.  The main problem with this mechanism is that it makes transactions immutable and directly links them to their inputs.

This means that if a single input changes, the entire transaction ID also changes. Thus, there is a possibility of creating different transactions with the same ID (known as transaction malleability), since they have the same hash but different signatures and content. In order for SegWit to fix this issue, inputs needed to become independent from transaction IDs; they must be decoupled in such a way that changing the input would not affect the output’s validity.

Another problem is scalability—bitcoin transaction volumes are growing gradually over time, and the number of transactions per block is limited.  This creates a situation where the network becomes congested with unconfirmed transactions that are waiting for miner confirmation so they can be added to blockchain blocks and become validated.

SegWit increases volume limits by separating signature data from transactional data, which increases transaction capacity within each block because now more space is available for transactions.

A SegWit transaction also has two separate parts: the original input (the witness), and second, its resulting output. The separation between these two parts of a transaction means that signatures do not have to be included in the calculation of the transaction ID; as such, all inputs are treated equally, making it possible to remove some signatures from every transaction on the bitcoin blockchain network.

At the same time, removing signatures also means that the output is smaller in size.

Segregated Witness (and its removal) will not affect previous transaction IDs; hence, it does not cause any problems with current transactions. A similar concept worth mentioning is MAST — Merkelized Abstract Syntax Tree. It’s a technique used to store and retrieve scripts as part of a Merkle tree instead of storing them directly on data structures like an unspent transaction output (UTXO). MAST was originally proposed by Pieter Wuille for scaling up bitcoin’s Script language—an imperative programming language designed specifically for bitcoin transactions. Bitcoin uses Script to verify if a transaction is authorized and valid in accordance with the network consensus rules, but it can be used for other purposes as well.

Where are we now?

Despite the apparent benefits, the update is being implemented slowly. At that time, the new format was used in 14% of transactions. Now, however, the Segwit2x proposal has brought it back into focus.  In addition to showing what is possible with this technology, it also shows that adopting changes in a decentralized environment like cryptocurrencies is not as easy as it might seem.

How can I correctly use SegWit? What is your advice to merchants?

We’d advise you to implement SegWit support for your bitcoin wallet and be ready for possible blockchain forks if you want your transactions to work properly. If you never plan on using SegWit (for example because of some hardware limitations), then we also recommend keeping some “dry powder” in non-SegWit addresses. In other words, it’s better if there are both non-SegWit and SegWit addresses in your wallet. This way, if there is a blockchain fork due to the SegWit2x proposal after all, you will still be able to use non-SegWit addresses and perform transactions with them.

Final Thoughts

SegWit is a good example of how much it costs to make such a significant change, even in a decentralized environment. SegWit improves the scalability of bitcoin by separating signature data from transactional data. It does this without changing transaction IDs, which allows for further improvements like MAST and Schnorr signatures .

Related Posts

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More