To update Segregated Witness issue via soft-fork is quite contentious both for SegWit and for soft fork (some people think hard-fork is needed for SegWit’s update). Now let’s see the issue from technology angle to make a judgement on which one is right.

Hard/soft fork issue concerns decentralized nodes software, protocol and application update. It is an important issue deserving deep discussion.

At first, all the nodes run the same software, follow the same protocol, and maintain the same chain. If at this point some nodes are updated to software of new version and is governed by new protocol, there will four scenarios as following that will happen:

1.New nodes thinks the blocks and trade broadcast by old nodes are legal.

2.New nodes thinks the blocks and trade broadcast by old nodes are illegal.

3.Old nodes think the blocks and trade broadcast by new nodes are legal. (changes undetected)

4.Old nodes think the blocks and trade broadcast by new nodes are illegal.(changes detected)

Note: illegal trades can be further divided into full illegality and partial illegality. To make the discussion simpler, illegal blocks and trade here all refer to full illegality.

Another factor that should be taken into account is: the hash power comparison between new nodes and old nodes, while lead to two scenarios.

1.Harsh power of new nodes > 50%

2.Harsh power of new nodes <50%

It should be noted that most on-going discussions are on the premise that new nodes’hash power will exceed 50% of the network. This article also discuss the issue on such presumption, though things can be quite different if harsh power of new nodes is less than 50% of network.

Let’s first see what is hard fork, which exists before the advent of soft-fork.

Hard-fork

It refers: two chains appear owing to the fact that old nodes are unable to accept fully or partially, at a time when software (protocol) of new version occurs and is incompatible with current version, the blocks generated by new nodes. Though new nodes have greater hash power, the old nodes will still maintain the original chain even in the case where old nodes only have 1% of hash power.

A hard fork requires simultaneous update of all nodes and nodes that are not updated can not work normally. If there are barely enough nodes unwilling to update, they will work on a different chain.( That is ETC)

Soft fork

It refers: new nodes cannot fully or partial accept old nodes (believe they are illegal) at a time when software (protocol) of new version occurs and is incompatible with current version. As new nodes have larger hash power, blocks generated by old nodes do not have chance to be accepted. The result is that new nodes and old nodes will still work on the same chain. We call this a soft-fork.

Advantages and disadvantages of soft-fork and hard-fork

Advantages of softfork

1.Soft-fork always has only one chain without any risk of being forked into two chains.

2.Soft-fork allows gradual update of nodes instead of updating all nodes at the same time, which will not influence the stability and efficiency of the network,

Disadvantages of soft-fork

1.Soft-fork is on the premise that old nodes can always accept blocks of new nodes. This requires the system forward compatible

2.Soft-fork runs based on the deception of old nodes as old nodes will not detect the changes. To some extent, the rule that single node can fully verify the network is violated.

Forward compatible

Different from backward compatible mechanism, a forward compatible mechanism requires a pre-judgement on newly-emerging blocks and consensus mechanism and leave leeway for old nodes. When new nodes are set, old nodes can accept the blocks generated by new nodes.

Then how forward compatible mechanism is achieved in Bitcoin system?

The answer is non-standard transaction

Bitcoin has set some rules

1.All transactions are categorized into standard, non-standard and invalid transactions.

2.Bitcoin network deny invalid transaction and blocks that contain such invalid transaction.

3.For non-standard transaction, Bitcoin network

a.will not forward

b.will not accept

c.will not pack

SegWit update based on soft-fork

SegWit, mainly contained in BIP141-144, update Bitcoin system via software to make Bitcoin system support multiple functions of SegWit.

As discussed, old nodes of soft-fork will treat new transaction as non-standard and legal. How can SegWit do that?

The answer is “anyone-can-spend” output.

Here is an example for anyone-can-spend

scriptPubKey: (empty)

Signature script needed for output like this:

scriptSig: OP_TRUE

In SegWit, there will be a perfect combination of script versioning and anyone-can-spend. Here is a standard P2WPKH output:

scriptPubKey: 0 <20-byte-key-hash> (0x0014{20-byte-key-hash})

The 0 at the beginning will be the script version number in the new node while will be an anyone-can-spend output in old output

When nodes supporting Segwit are activated and hash power of new nodes are greater than 50% of the network(Segwit requires greater than 95%), the network will be in a state as following:

1.Old nodes treat SegWit transactions forwarded to them as non-standard will not accept, pack or forward them.

2.Old nodes accept and verify and pass SegWit transactions broadcast to them (as they are anyone-can-spend)

3.Old nodes will try to spend SegWit transaction as anyone can spend them. However, new nodes will not accept transactions broadcast by old nodes as they treat these transactions as illegal. New nodes will even reject transactions already packed by old node. As new nodes control the majority of hash power, these transactions will never be valid.

4.The system only maintains one chain.

1MB blocksize issue:

Blocks bigger than 1MB for old nodes are illegal transactions instead of non-standard transaction. To solve the issue, SegWit will deceive old nodes to the greatest extent: the transaction it will witness will independent from the full block. For old nodes, they know nothing about that a SegWit structure exists behind the network.

Conclusion

It will be a challenge to update the distribued and decentralized system in the future. Soft-fork and hard-fork both will play important roles in the future. Soft-fork can prevent fork of Blockchain and it relies on forward compatibility and deception of old nodes.

Sometimes functions that are otherwise simple will become complicated in order to implement soft-fork, increasing risks of bug and other losses.

However, soft-fork can indeed decrease the risk of a split of the community as it allows for gradual update. This is its biggest advantage.