Segwit tackles short term Bitcoin blocksize problems, and helps long term scaling solution

The Bitcoin blockchain has long been touted as an alternative to legacy financial systems. Among a range of technological achievements, the peer to peer electronic cash system offers low fees and near instant transactions. However, the number of transactions processed by the network has been an ongoing source of contention.

Bitcoin can process around three to seven transactions per second. This number has often been compared to the VISA networks ability to process hundreds of thousands of transactions per second.

One way to provide more space for transactions and a higher maximum number of transactions per second is to increase the size of the blocks. The downside is a possible decrease in network security, as miners would earn lower fees. What to do, and how to do it has been a topic of discussion in the industry since blocks started approaching their maximum capacity.

The debate has inspired a range of solutions, some highly contentious and others widely accepted. Segregated Witnesses, better known as segwit, appears to be one of the few proposals with support from both sides.

- Bitcoin Core

Segwit improves Bitcoin’s underlying protocol in many ways. It fixes transaction malleability, the large transaction signature verification Denial of Service attack, and provides a better way to upgrade the scripting system in the future.

It works by rearranging the individual transaction's format inside of each new Bitcoin block. After segwit is upgraded, they'll store the proof-of-work signatures (the witnesses) at the end of each bitcoin transaction's line, (segregating them) making them easier to ignore, and therefore allowing the file to be read faster. The signatures aren't needed for proof-of-work functions, and were basically slowing down the transactions per second that the network could do. Now they'll exist but not be in the way.

With this restructuring of bitcoin’s core framework, transaction malleability becomes impossible, and the maximum transaction speed can be up to four times faster. The process does add a new cost limit to ensure blocks remain balanced in their resource use, resulting in an effective limit closer to 1.6 to 2 MB.

The code was finished in April and a new version of Bitcoin Core with the segwit code is currently being finalized. Blockstream developer Greg Maxwell told Reddit readers on Tuesday that “It's pretty much ready.” The upgrade must be implemented by 95 percent of the bitcoin mining network for two consecutive weeks before it’s considered complete.

While this might offer temporary respite from fuller blocks, segwit also prevents a problem known as transaction malleability, where third-parties can currently modify the transaction slightly.

- Bitcoin Core

Bitcoin developer Marco Falke told BNC that the malleability fix helps various platforms building on top of Bitcoin, known as Layer Two, or L2, solutions. “While segwit is not strictly required for them,” Falke explained, it makes the development and deployment “significantly easier.”

Developer Nicolas Dorier told us that every layer two user would need to be running their own highly available full node without segwit. “This would hurt adoption quite a lot and increase cost.” Luke Dashjr was much more pointed. “Without segwit, any multi-transaction smart contracts for Bitcoin carry a risk of a counter-party holding your money hostage, so it's necessary for any decentralised L2 solutions, but not necessarily for centralised or trusted solutions.”

However, all four of the developers BNC talked to are looking forward to seeing the same layer two solution implemented. The Lightning Network is a scaling solution for Bitcoin that leverages segwit, and may end the blocksize debate all together.

- Lightning Network

Lightning implementations create a secure network of participants that can transact at high volume and high speed. The networks are, in essence, made up of numerous two party Bitcoin transactions known as payment channels.

Both parties contribute to the initial balance of the channel, and can create multiple transactions which alter the final payments, but they’re not individually broadcast across the bitcoin network. Only the most recent version can be broadcast to the blockchain, at any time and by either party.

By creating a network of these two-party ledger entries, it is possible to find various paths between participants. As a result, it’s possible to conduct limitless transactions that never have to be recorded in a block. “When you have truly scalable technology, there is no limit to how many transactions per second you can do,” Bitcoin developer Peter Todd explained. “It's like asking ‘With Windows 10, how many webpage documents can the whole world visit per second?’."

While the concept is yet to be proven outside of a test environment, and there are critics, enough developers are excited about the plan to have started several complementary projects. The Thunder network is a way to send smart contracts across Lightning Networks. Several reference networks for Lightning and builds in other programming languages exist too, such as Lightning and Eclair. All of which require segwit to be deployed first before they can work.

- Bitcoin Core

The most famous project is also the most developed. A successful test of Blockstream's C lightning prototype was recently announced. “This is the first end-to-end test of a lightning micropayment network,”  Blockstream engineer Rusty Russell said. Russell demonstrated the full path of the transaction on bitcoin’s testnet, including invoicing, multi-hop payment, and item delivery.

Mining hardware and infrastructure giant BitFury, a competitor to Blockstream, recently tested its’ own Lightning Network, called Flare. “After implementation of Flare, we expect to achieve performance of at least 400 tps per single payment channel, and more than 100,000 tps for network overall in our test environment by the end of July,” reads the company statement.

ACINQ conducted the testing, and the company CEO Pierre-Marie Padiou said that “Bitfury’s Flare is so far the most advanced proposal on routing, which is one of the major remaining challenges for the Lightning Network.”

However, Russell quickly responded with, “Their work shows how, by way of simple analogy, one can create a streetmap to get from A to B in an efficient way, while the test we've demonstrated here with v0.5 of the C lightning prototype has us actually walking that path on the street.”

Meanwhile, development of a smaller, open-source Lightning Network called Amiko Pay is also underway on Github, offering a “lightweight” alternative solution to BitFury and Blockstream’s lightning networks. The site says that, “All people could use Amiko Pay for all their daily transactions,” calling itself, “A scalable, de-centralized network for performing fast, secure, cheap and privacy-friendly electronic transactions.”

Joining the fray, and the bitcoin development world at the same time, internet entrepreneur Kim Dotcom recently announced his own version of the Lightning Network, called BitCache. While details remain scarce, the entrepreneur is attempting to raise $5 million in crowdfunding, where he described it as a “fix” for the bitcoin network that will take Bitcoin to the mainstream.

- Kim Dotcom

Segwit “brings huge benefits” to another Layer two project called JoinMarket, Falke added. He’s excited about the 2-year old project that acts as privacy app for bitcoin, and, in theory, doubles as a way to reduce the number of transactions that get stored to the blockchain. Dorier told us that he’s looking forward to Ethan Heilman’s TumbleBit, which processes bitcoin payments off-blockchain, similar to a lightning network, and keeps their origins completely anonymous.

Some other creative layer two projects follow behind segwit’s adoption as well, including Sidechains implementations from Blockstream and Rootstock, Paul Sztorc’s Bitcoin Hive Mind, and Peter Todd's OpenTimestamps