What is Bitcoin SegWit and how does it work?

What is Bitcoin SegWit and how does it work?

Bitcoin scalability is an ongoing problem for the world’s most popular crypto and one that Bitcoin developers have struggled to solve. One solution that was introduced was the SegWit soft fork, which changed the number of Bitcoin transactions that could be processed simultaneously.


Although increasing the number of transactions per Bitcoin block sounds like a sure win, SegWit also had problems.

How do Bitcoin transactions work?

Bitcoin transactions use the Unspent Transaction Output (UTXO) model, where each transaction uses the previous transaction’s output on the blockchain and generates a new output that can be used in the following transaction.

By design, you do not own a Bitcoin token. You instead own the unused production of a certain number of previous transactions. You can prove ownership of this outlet through the required address, digital key and digital signature.

See also  What happens to bitcoin after a bitcoin holder expires?

Let’s assume you want to send bitcoin to your best friend. You will first use a private key to sign a message containing input, output, and amount. The transaction is sent to the entire Bitcoin network and all users can see it.

When a node receives the transaction, it checks whether:

  • Your private key matches the public key you claim to own
  • The sum of its inputs is greater than the sum of its outputs
  • The output is unused.

If the transaction meets these three rules, it is verified and forwarded to other nodes, which repeat the verification process. This process involves complex mathematical puzzles, which the miners with the highest crypto hash rate have the best chance of solving first.

bitcoin transaction from one smartphone to another

Miner nodes compete to solve the puzzles and, if successful, break the block template into an immutable block in the blockchain. The block is sent to the entire network and it is clear that your best friend owns the new unused production.

What is the transaction malleability error?

Scalability and speed are not the only issues plaguing the bitcoin blockchain. Unfortunately, there is also the “transaction malleability flaw”, a defect that allows the digital signature of a transaction to be changed before it is confirmed on the blockchain.

This modification is done in such a way that the transaction retains its mathematical logic, but gives a different result when run through a hashing algorithm.

For example, take the signature value of your transaction with your best friend, which was (5). If it is changed to (5-10+10), the mathematical value is still 5, but if we hash these different versions, we get different results.

Since the hash is how the transaction is identified in the blockchain, this change causes some problems.

  • Bad actors can create another conflicting transaction before the first one is confirmed, causing confusion, delays and network congestion.
  • That makes it problematic for blockchain developers to build second-layer solutions meant to improve the speed and scalability of the mainnet.

So this is a flaw with the potential to turn blockchain ledger into a nightmare, and several workarounds have been implemented to address it. And this is where bitcoin SegWit comes in.

What is Bitcoin SegWit?

Segregated Witness (SegWit) is a Bitcoin blockchain protocol upgrade primarily designed to protect against transaction malleability.

SegWit was first proposed in 2015 as a blockchain fork to improve scalability. SegWit would achieve this by separating digital signatures from transaction data, allowing more transactions to be stored in a single block and reducing the time required to process a single block.

The SegWit soft fork was finally implemented in 2017, introducing many improvements to the Bitcoin blockchain, in addition to solving the malleability bug and improving transaction efficiency.

What is SegWit2x?

Before SegWit was implemented, there was some controversy in the Bitcoin community over a proposed hard fork upgrade aimed at increasing the block size limit from 1MB to 2MB to improve transaction processing speed, hence the term “SegWit2x.”

While many stakeholders supported the idea, disagreements arose within the community, and a lack of consensus led to divisions. The breakaway faction formed Bitcoin Cash (BCH), while the parent group continued to implement SegWit.

How does Bitcoin SegWit work?

SegWit works by separating some data from the block, making it inaccessible to modifications. This separation creates two sections. The first part of the block contains the sender’s and recipient’s wallet addresses, while the second part contains the digital signatures, also known as “witness data”.

Because witness data is separated from the main block, more space is freed up in the block for more transaction data to be recorded. This in turn increases the capacity of the block and directly affects the performance of the Bitcoin network, significantly improving scalability.

On the other hand, the segregated data, i.e. the digital signature, is encrypted and stored on a side chain. This additional layer of security on top of the separation from the main network makes it impossible to change the transaction’s digital signature, thus solving the malleability flaw.

Advantages of Bitcoin SegWit

SegWit brings several benefits to the Bitcoin network.

  • Solves transaction malleability: As mentioned earlier, SegWit fixes the transaction malleability bug that caused a lot of confusion and congestion in the bitcoin blockchain. This enabled more reliable and secure transactions.
  • Improved security: By solving transaction malleability, SegWit made the bitcoin network more secure and less vulnerable to attack. It also made it easier to implement new security features in the future.
  • Improved scalability: Scalability is the increase in the performance of a system. That’s what happened to Bitcoin after the SegWit soft fork. More transactions can be included in blocks due to freed up space, resulting in reduced transaction fees and faster transaction confirmation times.
  • Lower transaction fees: As more transactions could fit into one Bitcoin block, competition for block space was reduced, which in turn reduced transaction fees. This was particularly beneficial for small transactions.
  • Improved compatibility: By virtue of being a soft fork, SegWit enabled the extensibility of the blockchain while opening the door for future upgrades (such as the Taproot upgrade) to the Bitcoin network. This flexibility gives the blockchain the ability to implement new features and improvements.
  • Inspired creation of the Lightning Network (LN): As SegWit improved scalability, the code inspired the development of a Layer-2 solution: the Lightning Network. LN’s code makes it possible to create an off-chain payment channel between two transaction partners, improving mainnet speed and lowering transaction costs.

SegWit was a crucial upgrade to the Bitcoin network because it offered solutions that improved performance and made the experience better for bitcoin users. However, it did not come without a good number of new challenges.

Disadvantages of SegWit

The SegWit soft fork introduced a couple of potential drawbacks.

For example, while many exchanges and wallets have adopted SegWit, not all nodes support the new protocol. Since SegWit reduces transaction fees while requiring support for the witness data sidechain, profit-oriented miners dislike it and may be reluctant to use it.

Furthermore, due to the size of the Bitcoin network, SegWit is not enough to solve the scalability problem. A significant adjustment of the blockchain is needed to reduce its size and increase its scalability to a level similar to alternative blockchains.

Although SegWit has these drawbacks, it is clear that the security and scalability benefits far outweigh the problems.

Was Bitcoin SegWit a Good Idea?

SegWit prevented a bug from causing so much backlog in the Bitcoin blockchain at a time when its adoption was becoming more popular. It was actually a long time coming before the development was implemented. While some miners experienced a negative impact on their wallets, the soft fork improved the blockchain’s security and reliability, positively impacting the Bitcoin network.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *