The recent past has seen an increasing number of people joining the pack of Bitcoin traders and enthusiasts. Each Bitcoin transaction is recorded in a peer-to-peer network of systems, called the blockchain. These systems or nodes, administer all the bitcoin transactions, a copy of which are virtually sent to all the nodes in the blockchain.

Why do we need SegWit?

Analogous to every computation process, every bitcoin transaction has an input and an output.

While the information of the sender form the inputs, the outputs are the information of the recipient. This information is the public address of the sender and the recipient.

A third component of the transaction is the digital signature, or the Witness that verifies that the sender has the right amount of balance to make the transaction.

Once a transaction is verified by all the nodes, the transaction is recorded in a block and hence, added to the blockchain for public access.

In the current scenario of Bitcoin’s growing popularity, the volume of transactions is huge. The number of blocks needed to store them is extremely high.

However, these blocks are constrained to a size of 1 Megabyte (1MB) only, thus limiting the number of transactions they can hold.

Once a block is filled with records of transactions, new blocks are piled in the chain.

This increasing weight of transactions, typified by blocks, is congesting the network and slowing it down.

To solve the issue of the sluggish performance of the cryptocurrencies’ expansive network, SegWit sounded like a promising option, and was thus implemented after community consensus was achieved last year.

What is SegWit?

SegWit, a portmanteau for Segregated Witness, is a proposed update to the Bitcoin’s code protocol designed to fix a range of serious issues. Before we delve deeper into the functioning of the SegWit, we need to see how a Bitcoin transaction takes place.

In general the input, along with the signature data and the output data are added together. They are then hashed using the 32-bit SHA-256 cryptographic hashing algorithm.

The anatomy of a transaction code gives us details on what amount is being transferred, the miner transaction fee and other minute details of the sender and the recipient.

Post the advent of the scalability problem due to the heavy traffic in the Bitcoin network, the slow speed of these transactions was a major concern.

In order to address this, a solution was the introduction of Lightning Network. Conceptualized by Joseph Poon and Tadge Dryja, the Lightning Network will be an off-chain micropayment system which is designed to make transactions work faster in the blockchain. It operates on top of Bitcoin to solve the block size limit and the transaction delay issues, and is often referred to as “Layer 2”.

This layer works by creating a double-signed transaction. Simply put, there is a new check on the transmitted amount that requires both parties to sign for it to be valid. As new micro-payments are made from one party to the other, the amount on the check is changed and both parties sign the result. However, the Lightning Network would not activate in case the transaction identifier is changed.

What is SegWit’s solution design?

Proposed by the Bitcoin Core development team in 2016, SegWit suggests removal of the Digital Signature Element from the transaction and adding it to another new block — called the Extended Block. It means any transaction which gets added in the Block for confirmation, will only contain Input and Output and not the Digital signature. This will make transactions lighter. Consequently, we get additional space in each Block. A larger number of transactions can therefore be placed within a block for verification.

As more transactions get verified in the same amount of time, the network becomes faster again. Script data from the transactions is omitted and put into into an extended block. This naturally creates more room for transactions in the original block. The block size remains the same, but it can contain data more efficiently. Meanwhile, the witness segment is counted as a quarter of its original size.

This has thus, reduced the size of each Bitcoin transaction and also increased the overall capacity for transactions within a particular block. The block size limit has also been raised to 4,000,000 bytes.

The prior process to sign or to validate the signature on the transaction did not consider the amount of bitcoins spent. This is because the value of bitcoins can be extracted from the input transactions. The signing device would have to be online to calculate the amount spent and the miner transaction fee, if it were to display the information. Now, the number of bitcoins spent is included in the signature-digest algorithm. Various fields like nVersion of the transaction, nSequence of the input and even sighash type of the signature etc. are considered to calculate the hash needed for signing or validating the signature. Inclusion of the value of the Bitcoin transaction has facilitated the operation of IOUs (payment channels)

While Segwit will reduce the file size of transaction, it will also add more transactions getting in a block and ensure fast confirmation of transactions, therefore scaling the Bitcoin network up!