In 2015, a Bitcoin core developer named Pieter Wuille suggested an update to the Bitcoin protocol that came to be known as Segwit. The update was meant to address a security challenge known as transaction malleability, but it also added other benefits to the protocol.
The term Segwit is short for Segregated Witness. Knowing the Segwit meaning is one thing, but understanding how it works requires us to go back to the fundamentals of Bitcoin transactions.
Overview: How Bitcoin Transactions Work
Think of a single Bitcoin transaction. You have a sender, a recipient, and a group of instructions that govern and authenticate that transaction. These instructions are a digital signature that authenticate the transactions, and are also known as witness data or a witness script.
Bitcoin Transaction Malleability
When you want to transact on the Bitcoin network, the unverified transaction is broadcast to all the nodes in the network. Miners verify the transaction data and bundle it together with transactions from other users to create a new block every ten minutes. Learn more about how distributed ledger technology works here.
The data contained in the block is immutable once it is put in a block. However, before the transaction can be verified, the digital signature could be altered; this was a weakness in the original Bitcoin protocol.
You can get an idea of how this kind of transaction fraud happens undetected in this video.
Another problem with the legacy Bitcoin protocol is that there are so many transactions that could be bundled into a single block. The protocol specifically states that the size of one block cannot exceed 1MB, which can only hold approximately 2700 transactions.
At the best of times, your transaction takes 10 minutes to get authorized. When the network is busy, it can take hours or days, especially if the transaction fee isn’t attractive enough for miners to make it a priority.
One proposed solution to the problem was to just make the blocks bigger. This would solve the problem, but it would go against Bitcoin’s core protocols and would require a hard fork. It would also not be backward-compatible.
How Segwit Solves These Problems
The Segwit update separates the core transaction data (sender and recipient) from the witness data. One part of the block, 1MB in size, contains the core data of all the transactions stored in it. A bigger extended block, 3MB in size, contains the witness data of all these transactions.
By separating the core transaction data and witness data, several advantages are immediately achieved:
- Since the transaction data and witness data are segregated, one can no longer change the transaction details before confirmation takes place
- More transactions can be packed in the block and be verified more quickly. The transaction rate increases from single digits (6 or 7 Tx a second) to double digits.
- The updated protocol is backwards-compatible. Nodes not running Segwit receive only the block with core transaction data, while updated nodes that can handle the bigger Segwit blocks receive and can verify the full block.
With this update, there was no need to do a hard fork on the Bitcoin protocol. Nodes could update to the new Segwit protocol over time, and currently, 51% of all Bitcoin transactions are now Segwit transactions.
Two of the biggest limitations that have kept Bitcoin from mass adoption are the rate of transaction (Tx) and security. These issues are closely tied in with how the Bitcoin protocol works, and thus the Segwit update or soft fork.
With the new updates in place, BTC transactions are more secure and faster than before.