SegWit is a solution devised in order to solve Bitcoin's transaction malleability problem and improve its scalability.
De among the great improvements it has undergone Bitcoin since its inception, followed It has been one of the most important and transformative of this blockchain. SegWit is the contraction of Segregated Witness o Segregated Witness, name used for a change in the Bitcoin transaction format. This is a proposal from the company Blockstream and the customer development team Bitcoin Core.
This soft fork, was proposed in one of the BIP , specifically under the BIP-141, Under the name of "Segregated Witness (Consensus Layer)". With this improvement to Bitcoin, two problems were sought to be solved:
- Solve the problem of transaction malleability.
- Improve the scalability of the Bitcoin network.
But its use extended beyond Bitcoin, reaching other blockchain like Litecoin, DigiByte, VertCoin and even EOS. All of them with the same problem to solve, and who saw SegWit as an ideal solution to them.
Introductory course to DeFi
Medium levelTime to update. Traditional finance has changed, discover the revolutionary ecosystem of decentralized finance (DeFi).
The birth of SegWit
During the cryptocurrency boom, Bitcoin faced some problems due to the way its transaction structure worked. These limitations became more apparent when Bitcoin faced high levels of transactions. The result was, that Bitcoin was unable to handle the huge number of network transactions optimally.. Its ability to handle 7 to 8 transactions per second was insufficient for the needs of the network and its growing number of users.
Additional to this, developers considered the serious risk of Bitcoin transactions being malleable. Which could lead to manipulations that could lead to the loss of hundreds or thousands of bitcoins on the network. Another unacceptable situation. To solve this, the developers of Bitcoin Core and Blockstream got down to work. After hard work, SegWit came up with a proposal presented on December 21th 2015, by the developers Eric Lombrozo, Johnson lau y Pieter Wuille.
SegWit was proposing to solve Bitcoin's transaction malleability and scalability problem. To achieve this, SegWit separates the Bitcoin Script and cryptographic signatures to a new block structure. While the blocks with the transactions were in another structure. All this, without breaking the ability to verify the signatures and transactions in each structure at any time thanks to the merkle tree.
The problems solved by SegWit
There are two problems that SegWit solved in Bitcoin: malleability and the ability to improve its scalability. To understand both points more fully, it is best to explain them more carefully:
Malleability
Malleability, It is the possibility that a third party can modify a code or serial at will. Originally in Bitcoin, this property is considered a type of denial of service attack (DoS). This is so because, malleability leads to the transaction identifier (TXID), may be altered in unconfirmed transactions.
This problem is related to the fact that the Bitcoin signature hashes do not protect the signature script (scriptSig). This script includes a signature type (secp256k1) It is not possible "sign" Likewise. In addition, the way in which the TXID is calculated allows that there is the possibility that a malicious third party modifies the identifier of a certain unconfirmed transaction. These two problems create a weakness that allows an attacker to modify the TXID at will while the transaction is in the unconfirmed state.
As a result of this modification, if you want to trace a certain TXID on the network, it could not be found because it has been modified. This would make the receiver mistrust the sender, and even break trust in the overall network.
A simpler example of the malleability problem
To explain the above situation more easily, consider this example:
Maria has made a transaction with Daniel. The funds from that transaction will be used by Daniel to pay Sofía in a second transaction. But it happens that a miner by mistake or a malicious third party modifies the TXID of the transaction from Maria to Daniel and confirms it with that different TXID. That means that Daniel's payment to Sofia will be invalidated. In this scenario, the honesty of the parties begins to play a transcendental role. This is because if Daniel is honest, he will send the funds back to Maria. But if you are dishonest, you can keep the cryptocurrencies.
With this example we can see in a simple way that, when the funds reach their destination, they will do so with the TXID different from that of their creator (María). So the latter (Daniel) will perceive that his transaction has disappeared from the network. By modifying the identifier without invalidating the transaction in question, the child transactions are invalidated. This is because new transactions are linked to old ones.
Scalability
The worst problem faced by Bitcoin developers and supporters was, scalability. The high traffic in the Bitcoin network, placed very far from the promises of fast and inexpensive transactions. This because, the rise of Bitcoin pushed its limit to the network to the point where a transaction took hours to confirm. In addition, the cost per commission removed the possibility of using bitcoins to make micro-payments. It was a small disaster that cost a lot to the community that supported Bitcoin as a global, fast and secure payment technology.
To address this, the SegWit developers sought to mitigate this situation and lay the foundation for new forms of scalability. To make it, SegWit segregates or separates transaction scripts and signatures into a new structure. At the same time, it was possible to increase the block size to 1,8 MB, with respect to the original size of the 1 MB blocks. This has a strong impact on the scalability and the number of transactions per block within Bitcoin.
Thanks to this, it was possible to put more transactions within a block and increase the number of transactions processed every second. A situation that positively impacts the reduction of commission costs and the speed of transaction confirmation. However, SegWit also allowed to start the construction of new scalability systems by overcoming the problem of malleability and the signatures within the blocks.
In this particular case, we refer to Lightning Network. This scalability solution designed by Blockstream uses the same SegWit format to carry out transactions within its channels. A situation that is clarified directly in the documentation Lightning Network RFC.
The impact of SegWit on Bitcoin
SegWit has been quite a significant change in the handling of Bitcoin transactions. On the one hand, it has brought to the Bitcoin network a soft fork which allows legacy nodes (without SegWit) and SegWit nodes to work at the same time. All this without interrupting the work of the network, or compromising its security.
On the other hand, SegWit opens the door to larger block sizes for Bitcoin. One of SegWit's biggest structural changes, is to take the maximum size of the Bitcoin block, from 1 MB to 4 MB. In this way SegWit guarantees important updates in the size of the Bitcoin blocks without having to apply a hard fork and its consequences. Another major SegWit change is that it has generated a new type of Bitcoin addresses, called SegWit addresses that start with "bc1" o «3».
In addition to this, SegWit has enabled a user with a SegWit-supported wallet to send cryptocurrencies to a user with a legacy wallet (and address). In this way, the user with SegWit benefits from a lower cost per transaction and faster confirmation. The same can happen in the opposite way, a legacy user can send cryptocurrencies to a user with SegWit, using a legacy address but without enjoying the benefits of SegWit.
At the same time, SegWit's proposal enabled the bases for the creation of Lightning Network. This is because SegWit is necessary in this new structure to ensure that off-chain transactions are not vulnerable to a malleability attack. A situation that is explained in detail in the whitepaper from Lightning Network.
SegWit Advantages
- Disallows attacks of malleability of transactions. This by separating the signature data from the rest of the data in a transaction.
- Increase the size of blocks to a maximum of 4 MB.
- The presence of witness data becomes optional, and will only be needed when nodes. require validating a transaction, but not to verify it.
- SPVs (Simplified Payment Verification) will improve its performance. This is due to the reduction in the size of the verification tests and the use of bandwidth.
- Write the foundation for scalability protocols like the Lightning Network when solving the malleability problem.
- Competition for priority rates among users decreases. This consequently lowers network commissions.
Activation of SegWit in the Bitcoin network
El July 21, 2017, Bitcoin miners made a new software update. By this time, the miners followed the protocol outlined in the Bitcoin Improvement Proposal. BIP-91. This paved the way for this update and the final activation of SegWit. In this proposal the work of Luke dashjr was decisive for the success of this operation.
El August 8st, 2017 The other great milestone was reached. At the time it was stated that 100% of Bitcoin mining groups indicated SegWit support. However, SegWit would not be fully activated until at least August 21. After this point, miners could reject blocks that did not include SegWit transactions.
Finally, the August 23st, 2017, SegWit is officially activated during block mining 481.822 a 99,95% support network. I mean
Purses with SegWit support
In order for Bitcoin users to be able to make use of SegWit transactions, they must use a wallet that supports this feature. These wallets can provide users with legacy addresses or SegWit addresses to send and receive transactions. Among the Bitcoin wallets that offer such support, the following can be mentioned:
- Ledger. This is a manufacturer of hardwares purses that support a great diversity of currencies. All include support for the implementation of SegWit for Bitcoin, without compromising the security features in the product.
- Trezor. It is another hardware wallet manufacturer that offers SegWit support on their devices.
- BitcoinCore. This is the reference wallet of the Bitcoin development team. Includes support for SegWit since version 0.13.1.
- Bitcoin Armory. This wallet is written in the Python programming language and also has SegWit support. It is available for Windows, Linux and Mac OS X desktop operating systems.
- electrum. This is a wallet available for the Android mobile operating system and for Windows, Linux and Mac OS X. Activa since 2011 is one of the wallets with a faithful user base in the bitcoin community. It is open source and supports SegWit, also allowing users to configure transaction fees.
- Green Bits. This is another wallet with support for SegWit. It is available for Android and iOS. It also allows users to use it through a Google Chrome extension or via the web.
- Samurai. This is a project in development, but also supports the improvement of SegWit. Samourai is a project focused on privacy and anonymity.
- Coinomi. This wallet is multi-cryptocurrency and offers SegWit support for Bitcoin and Litecoin