How Bitcoin’s SegWit protocol works

SegWit protocol

Blockchain technology is secure because of its decentralized data storage, cryptographic encryption and consensus algorithm. The complex interaction of these characteristics provides protection against external and internal threats. However, experts have found that some parts of the code can be altered in ways that are not cryptographic (without breaking private keys). This jeopardizes the data stored in the system. The second problem is related to scalability. It arises from the limited block size. It can hold a relatively small amount of information. To solve these problems, the developers proposed to update the protocol and activate Bitcoin SegWit (Segwit). Thanks to the soft fork, it was possible to speed up transactions and reduce fees without major changes to the program code. The security of transfers has also increased.

What is SegWit in simple words

Segregated Witness is an update to the Bitcoin network designed to solve the following problems:

  • Scalability. In the BTC blockchain, one block is generated approximately every 10 minutes. The throughput of the network depends on the number of transactions the cell can hold. The block size is limited to 1 MB – this condition is hard-coded in the cryptocurrency’s code. As the number of requests increases, miners first confirm transactions with a higher commission. Therefore, the costs increase. Before the update, some transactions took several days to complete.
  • Plasticity. Cryptocurrency transactions are encrypted lines of program code, one part of which is the transaction ID (Transaction ID, TXID). The indicator is formed from the sender’s electronic signature (calculated by decrypting the private key), the number of coins and data about the participants of the transaction. Knowing TXID, any user can get information about the status of the transaction. Confirmation of the transaction takes time, during which time attackers could change the identifier without canceling the transaction. You don’t need to have access to private keys to do this. The recipient of the transfer can change the TXID after the assets are credited and request the sender to re-pay. This has been exploited by fraudsters, forcing cryptocurrency exchanges to make multiple transactions. Security experts speculate that this is how 64,564 BTC were stolen from the popular MtGox exchange in 2014.

Literally, Segregated Witness translates from English as “Separate Witness.”

The basic idea behind Bitcoin’s SegWit is to separate signatures (proof of ownership of cryptocurrency) from transfer data (number of coins and participants in the transaction). This increases system throughput by saving block space and solves the problem of malleability.

BTC SegWit reorganizes the data, eliminating double-spending. Activation of the update was done in several stages due to the difficulties encountered. Some developers never accepted SegWit. This led to the creation of bitcoin hardforks. One of the most popular ones is Bitcoin Cash.

5020 $
Bonus til nye brugere!

9.8

ByBit giver bekvemme og sikre betingelser for handel med kryptovaluta, tilbyder lave provisioner, højt likviditetsniveau og moderne værktøjer til markedsanalyse. Den understøtter spot- og gearet handel og hjælper begyndere og professionelle handlere med en intuitiv grænseflade og vejledninger.

Optjen en 100 $-bonus

for nye brugere!

9.5

Den største kryptobørs, hvor du hurtigt og sikkert kan starte din rejse i kryptovalutaernes verden. Platformen tilbyder hundredvis af populære aktiver, lave provisioner og avancerede værktøjer til handel og investering. Nem registrering, høj transaktionshastighed og pålidelig beskyttelse af midler gør Binance til et godt valg for handlere på alle niveauer!

How the technology works

The Bitcoin blockchain does not have a list of wallets with account balances. Instead, the system is a set of incoming and outgoing transactions for an individual address. Before softfork, the transaction record included a mandatory part – an identifier. If the slightest adjustments were made to the cryptographic signature (e.g., changing the format or adding optional service characters), the TXID was changed.

The modified transaction belonged to the same wallet as the original transaction. These transactions could compete for validation. If miners processed the copy before the master record, the original was rejected.

In the SegWit update, developers proposed to move the identifier data outside the blockchain. Therefore, an accidental or intentional change in the digital signature no longer affects the transaction hash.

The scriptSig field is now left empty. Information about the signature is in a separate structure Witness data. This innovation solves the problem of plasticity and saves space in the block. The fact is that a digital signature takes up to 65% of the transaction volume.

By eliminating the plasticity of transactions, developers began to create layer 2 blockchains built on top of the main network. Bitcoin has such a protocol, the Lightning Network (an offchain micropayment network). The algorithm collects and stores many small identical transfers outside the main chain. Once the payment gateway is closed, they are combined into a single transaction and fed into the underlying protocol. This increases the speed of transaction processing.

Once SegWit is activated, an additional structure must be loaded by the node to validate transactions. The signature block is linked to the underlying blockchain through a hash tree in the header.

How Bitcoin's SegWit protocol works
The technology reorganizes the data in the blockchain

SegWit vs Legacy

Several types of addresses operate in the BTC protocol:

  • Legacy (P2pKH). This format was proposed by Satoshi Nakamoto in 2010. The public key starts with the number 1. It includes 25-34 characters. There are exceptions. Capital letters O, I, lowercase l and the number 0 are not used to prevent visual ambiguity. The disadvantages of the address are case sensitivity, high fees, greater weight in QR codes, and inconvenient writing.
  • P2SH. Format created in 2012 to address blockchain issues and introduce more complex features. The structure of the public key is identical to Legacy, but starts with the number 3. A hash-compatible script is needed to receive payment. The technology reduces network fees. It transfers payment for transactions to the recipient and allows for multi-signature public key generation. P2SH wallets support softfork, but are not a native solution to it. You can transfer BTC from the P2SH vault to P2PKH and Bench32. The address as a QR code takes up less space compared to Legacy.
  • Bench32 (SegWit, P2WPKH). The solution was proposed by Peter Wille and Greg Maxwell in the BIP-0173 update at the 2016 conference. The protocol is designed to increase the efficiency of the blockchain. The solution reduces commissions even further. Only lowercase letters are used in the format. The address starts with bc1 and can contain up to 90 characters (more often 42). In 2023, not all services support sending coins to wallets of this type. To avoid errors, it is recommended to use P2SH storage. If up to 4 inaccuracies are made when writing the address, the checksum will be incorrect. Thanks to the applied Bowes-Chowdhury-Hockingham (BCH) code, the system will automatically correct the errors.

The main advantages of the protocol

Bitcoin SegWit technology has improved the network significantly. The main advantages of softfork:

  • Solving the problem of malleability. According to statistics, it affected more than 50% of transactions in the BTC blockchain.
  • Scalability. By removing signatures from the blockchain and storing them separately, it was possible to increase network throughput from 3 to 7 transactions per second and reduce fees from $20-30 to $5-10.
  • Backward Compatibility. Transfers can be made to old and new addresses. Participants who supported the upgrade work with lower commissions.
  • Innovation implementation. Thanks to softfork, developers have started building layer 2 blockchains.
  • Support by most nodes. In 2023, over 90% of transfers in the BTC network go through SegWit address.
  • High reliability of multi-signature wallets. If attackers become aware of at least 1 P2SH transaction key, the number of solutions can be reduced to 280. For SegWit addresses this value is 2126.

Disadvantages of the technology

One of the main arguments of softfork opponents is the impossibility of undoing it. When activating an update, you need to roll back the program code to the latest version. But this will lead to the fact that all SegWit codes will be freely available.

The update has disadvantages:

  • A short-term solution to the scalability problem. The number of transactions on the blockchain is constantly growing. Need more significant changes to the block size and the way transfers are processed.
  • Disagreements in the community. Several hardforks in the Bitcoin network (BCH, BTG, BCD) have occurred due to the inability to reach a compromise.
  • Complex transaction validation. Nodes require more resources due to the additional structure being loaded.

History of SegWit creation in the Bitcoin network

Since 2012, participants of profile forums and conferences raised the issue of the plasticity problem. The solution was proposed in 2015 by Blockstream co-founder Peter Wille. Unlike other ways to modernize Bitcoin SegWit did not require a hardfork, so it was received positively by the community.

Hardfork is an update of program code that is not compatible with the previous software. This is how 2 or more cryptocurrencies with a similar name (Bitcoin and Bitcoin Cash) arise.

How Bitcoin's SegWit protocol works
Scheme of Bitcoin Cash hardfork

Preparation

The adoption of new rules required the approval of 95% of miners. However, not everyone supported the idea. Therefore, the protocol update was carried out in several stages.

DateEvent
January 2016BIP141 test network was launched
March 2016More developers, companies and miners joined the test network
June 2016Conferences with the participation of influential people in the cryptocommunity took place. One of them approved the widespread adoption of the technology.
September 2016The code is finalized. A new version of Bitcoin Core 0.13.1 was released.
October 2016Developers presented the protocol. The condition for activation is the participation of 95% of miners.
November 2016BTC users updated blockchains en masse. Some continued to express dissatisfaction with the implementation of the technology.
January-April 2017The majority of miners supported softfork
May 2017An agreement to increase the block size to 2MB (SegWit2x) was signed at a conference in New York. The new version was never implemented. But thanks to the conference, most miners embraced softfork.
August 2017The protocol is activated on the Bitcoin network

Controversy

Despite the pros of the new technology, not everyone supported the proposal. Some developers felt that softfork would not solve scalability and malleability problems or eliminate them temporarily. Others argued that the source code proposed by Satoshi Nakamoto did not need to be optimized and refined.

Opponents of softfork argued that the update would centralize the system. Because of the increase in the number of transactions, the number of unconfirmed transfers per block will increase. This would make the network vulnerable to hacker attacks.

The founders of Bitcoin Core (renamed Blockstream) were in favor of activating the update. Opponents linked the company’s support to the development of Lightning Network. Its implementation required the elimination of the plasticity problem. However, SegWit was supported by other projects:

  • BitGo.
  • Xapo.
  • Bitmain.
  • Bloq.
  • Shapeshift.

Activation implications

By eliminating the problem of malleability, developers were able to create the Lightning Network layer 2 blockchain. The main purpose of the protocol is to increase network bandwidth and reduce commissions. The add-on allows for transfers without recording transactions on the blockchain.

The Lightning Network is separate from the Bitcoin blockchain, has its own software and validators. At the same time, it exchanges data with the main chain.

To enter the Level 2 blockchain, a special transaction (a type of smart contract) must be created. This forms a payment gateway where users can exchange cryptocurrency without confirmation in the main chain.

These transactions are not visible in the BTC blockchain. At any time, a member of the channel can close it and publish the state of the wallets. At this point, all micropayments will be combined into a single transaction and written to the nearest blockchain. The algorithm will distribute the balances on each side of the channel to the addresses.

How Bitcoin's SegWit protocol works
SegWit launch plan

SegWit and other cryptocurrencies

Opponents of the introduction of the technology began to conduct hardforks and create new coins. This is how the Bitcoin Cash cryptocurrency with a block size of 8 MB appeared. Due to the increased speed of transactions and low commissions, developers suggested using BCH for daily settlements, and BTC – for investments.

In 2023, SegWit is popular. Many developers implement the technology in projects. The most famous coins with support for the update are:

  • Litecoin.
  • Groestlcoin.
  • Vertcoin.
  • Syscoin.
  • Digibyte.

Which wallets support the technology

In 2023, most major exchanges are working with new address formats (Binance, Bybit, BitMex). The number of cryptocurrency vaults compatible with SegWit is gradually increasing. Among them:

  • Armory.
  • Electrum.
  • Wasabi Wallet.
  • BRD.
  • Trezor.
  • Ledger.
  • Coinomi.
  • Coinb.

Development Prospects

In May 2017, more than 50 companies signed the New York agreement to activate Segwit2x. Once the technology was implemented, the block size could increase up to 2MB. The new version solved the scalability problem, but Bitcoin would split into 2 networks.

On the scheduled date, one of the organizers of the hardfork, Mile Belsh, announced that the update was being postponed indefinitely due to unresolvable disagreements. The developer and his allies said they would activate version 2 at some point. Proponents of the update believe that Bitcoin Cash’s growing popularity may lead to majority approval of the Segwit2x hardfork in the future.

Summary

Segregated Witness is an update to the Bitcoin protocol proposed in 2015 by Peter Wille to improve the security and speed of transactions. The activation was accompanied by controversy in the community. Not all users supported the innovation. This led to hardforks. New coins were created. However, the technology was recognized. In 2023, major digital networks and platforms support bitcoin addresses of the new format.

Frequently Asked Questions

❗ Which cryptocurrency exchanges support Bitcoin’s SegWit?

Softfork makes transactions safer. That’s why most major exchanges – Binance, Bybit, BitMex and others – work with Bench32 format addresses.

💲 Can I transfer coins from Bench32 to a regular BTC address?

SegWit is a softfork that is backwards compatible with previous versions.

🔧 How can I determine if a bitcoin address supports multi-signature?

The technology is implemented in Bench32 and P2SH wallets. The address must start with the digit 3 or bc1.

📌 What is Segwit2x?

In the hardfork, the developers proposed to increase the block size to 2MB. This would increase network bandwidth. The launch was planned for 2017. However, the update was canceled due to lack of support.

❓ Does the new protocol work only in the Bitcoin network?

Many other networks have also activated softfork (e.g. Litecoin, Groestlcoin, Vertcoin).

Is there an error in the text? Highlight it with your mouse and press Ctrl + Enter

Author: Saifedean Ammous, an expert in cryptocurrency economics.

Skriv et svar

Din e-mailadresse vil ikke blive publiceret. Krævede felter er markeret med *

da_DKDanish

Spelling error report

The following text will be sent to our editors: