Introduction
There are over two thousand cryptocurrencies and tokens in the market, and all of them have a set of rules to ensure they work properly. These rules are also referred to as protocols, and they are continuously in progress. Similarly to any computer code, mobile phones, and apps, the cryptocurrency protocols must be updated and improved, which means teams of programmers work every day to detect code errors, improve their performance and add new functionality. And SegWit is one of the updates that has been implemented in the Bitcoin protocol.
What is SegWit?
Pieter Wuille was the man who came up with the idea of SegWit at a Bitcoin conference in 2015. Wuille claimed that SegWit was a possible solution to the flaw in the Bitcoin protocol. SegWit was a proposed solution to the problem of transaction malleability. Transaction malleability is a way of saying that coins can be stolen from the user just by changing tiny pieces of transaction information.
How does transaction malleability work?
Let’s say Bob sends 10BTC to Billy. But, with transaction malleability, Billy can trick Bob into sending him 20BTC instead of 10. The transaction malleability flaw in Bitcoin’s code enables Billy to tamper Bob’s witness before the transaction is confirmed on the blockchain network.
In this case, the transaction ID changes, but the transaction does not (10BTC were still sent from Bob to Billy). Now, Billy contacts Bob, saying that he hasn’t received 10BTC, though he actually has. Since the transaction id was altered, Bob checks and sees that the original transaction hasn’t been confirmed. So, seeing this, Bob sends 10BTC again to Billy. And Billy now receives 10 BTC more and 20 BTC in total.
The patch to transaction malleability
As mentioned earlier, a patch is a solution to this glitch in the Bitcoin protocol. SegWit is a patch designed by Pieter Wuille to bring a stop to transaction malleability. To prevent witness data from being used to alter the transaction ID, Peiter suggested removing it from the transaction. Hence, it is given the SegWit, which is the abbreviation for segregated witnesses, means to remove or separate the witness data.
A segregated witness creates something called as sidechain where witness data is stored aside from the main blockchain. This method efficiently prevents transaction IDs from being changed by dishonest users. Also, a smart thing about SigWit is that it’s backward compatible. So the nodes that are updated with the SegWit protocol can still work with nodes that are not updated yet. Such an update is called a soft fork, as opposed to updates that are not backward compatible, which are called hard forks.
Wuille wanted SegWit to be backward compatible so that the witness data was still recorded on the main blockchain. To solve this problem, he encrypted all the witness data of a block on the SegWit sidechain and then stored this root code on the main blockchain. Hence, transaction malleability was successfully patched without a hard-fork update.
The Pros on SegWit
💡 Patch to the transaction malleability – The problem of the malleability of transactions was solved by SegWit.
💡 Faster Blockchain transactions – SegWit makes the network much lighter. More transactions can be performed without increasing the overall block size.
💡 Room for more development – Things don’t end just at transaction malleability. If the use of blockchain increases drastically, the issue of scalability must be figured. And SegWit helped lightning network technology come to reality.
Conclusion
The problem of transaction malleability was a real concern to Bitcoin. A patch to it was really in need. Hence, Pieter Wuille came up with a successful patch to it. And this brought talks about the bright future of the Bitcoin platform. We hope you understood the concept of segregated witness (SegWit). If you have any questions, let us know in the comments below. Cheers!