Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: colinistheman on February 04, 2015, 08:05:00 PM



Title: What is a Bitcoin soft fork? (in laymen's terms)
Post by: colinistheman on February 04, 2015, 08:05:00 PM
Hi, I was wondering if anyone can describe what a soft fork is and how it is implemented, in a very easy-to-understand way?

I know what a hard fork is. That's where you modify the source code and get more than 50% of the nodes to adopt it. Usually the code is set to begin running at a particular block number.

How does this differ from a soft fork?

I found the wikipedia entry (https://en.bitcoin.it/wiki/Softfork) but didn't quite grasp it.

Adam Back and Gregory Maxwell (gmaxwell) are talking about it in this fairly technical video about side chains (https://www.youtube.com/watch?v=jE_elgnIw3M) and I want to understand what he's talking about.

http://pickmarksbrain.com/wp-content/uploads/2012/12/bent-fork-napkin-holder-3.jpg


Title: Re: What is a Bitcoin soft fork? (in laymen's terms)
Post by: unamis76 on February 04, 2015, 09:13:44 PM
Soft forks are used to restrict block rules, so to speak... :) This is better explained here https://en.bitcoin.it/wiki/Softfork and here http://bitcoin.stackexchange.com/questions/30817/what-is-a-soft-fork :)


Title: Re: What is a Bitcoin soft fork? (in laymen's terms)
Post by: gmaxwell on February 04, 2015, 11:00:00 PM
Hi, I was wondering if anyone can describe what a soft fork is and how it is implemented, in a very easy-to-understand way?
I know what a hard fork is. That's where you modify the source code and get more than 50% of the nodes to adopt it.
This is incorrect in that a hard fork with just 50% is a system failure, the network would split... and coins could be spent twice (on each new network). A working hardfork needs an overwhelming support of ~all the participants, and everyone else just isn't a participant anymore.

Quote
How does this differ from a soft fork? Does a soft fork require modifying the bitcoin source code, or only the clients?
I'm not sure what you think is the difference between "the bitcoin source code, or only the clients". Bitcoin clients are the network, and they're all software.


A soft fork is a change to the rules enforced in the blockchain which is a strict narrowing. Nothing previously invalid becomes permitted, but blocks/transactions which were previously valid may be denied. This is more powerful than you might guess at first blush because Bitcoin was designed to be forward extendable and there are many conditions where you can create transactions which say "do nothing, anyone can spend" but a later soft-fork can carve a new feature out of that. E.g. a whole new script system can be introduced in this way (and we more or less did with BIP16), it just has to look like "anyone can spend" to old nodes.

Think those 'anyone can spend' parts as blocks of marble where new features can be chiseled out of them.


Title: Re: What is a Bitcoin soft fork? (in laymen's terms)
Post by: jl2012 on February 05, 2015, 04:25:23 AM
Some comparisons:

Hardfork is making some invalid transactions valid

Softfork is making some valid transactions invalid

Hardfork requires the consensus of vast majority of miners, users, and merchants

Softfork requires the consensus of vast majority of miners, but not necessarily non-mining users and merchants

Hardfork can change any rules in the protocol or implement any new rules

Softfork is usually less powerful (with a trick which I call "Aux block", a softfork could also be very powerful: https://bitcointalk.org/index.php?topic=283746.0)



Title: Re: What is a Bitcoin soft fork? (in laymen's terms)
Post by: colinistheman on February 05, 2015, 05:24:56 AM
Hi, I was wondering if anyone can describe what a soft fork is and how it is implemented, in a very easy-to-understand way?
I know what a hard fork is. That's where you modify the source code and get more than 50% of the nodes to adopt it.
This is incorrect in that a hard fork with just 50% is a system failure, the network would split... and coins could be spent twice (on each new network). A working hardfork needs an overwhelming support of ~all the participants, and everyone else just isn't a participant anymore.
Yes, of course. I did say "more than 50%", not "just 50%". And yes, considerably more than 50% is best/important.


Quote
How does this differ from a soft fork? Does a soft fork require modifying the bitcoin source code, or only the clients?
I'm not sure what you think is the difference between "the bitcoin source code, or only the clients". Bitcoin clients are the network, and they're all software.
A soft fork is a change to the rules enforced in the blockchain which is a strict narrowing. Nothing previously invalid becomes permitted, but blocks/transactions which were previously valid may be denied. This is more powerful than you might guess at first blush because Bitcoin was designed to be forward extendable and there are many conditions where you can create transactions which say "do nothing, anyone can spend" but a later soft-fork can carve a new feature out of that. E.g. a whole new script system can be introduced in this way (and we more or less did with BIP16), it just has to look like "anyone can spend" to old nodes.

Think those 'anyone can spend' parts as blocks of marble where new features can be chiseled out of them.

Thanks. A soft fork is quite a concept to grasp for a new person.


Title: Re: What is a Bitcoin soft fork? (in laymen's terms)
Post by: colinistheman on February 05, 2015, 05:27:04 AM
Some comparisons:

Hardfork is making some invalid transactions valid

Softfork is making some valid transactions invalid

Hardfork requires the consensus of vast majority of miners, users, and merchants

Softfork requires the consensus of vast majority of miners, but not necessarily non-mining users and merchants

Hardfork can change any rules in the protocol or implement any new rules

Softfork is usually less powerful (with a trick which I call "Aux block", a softfork could also be very powerful: https://bitcointalk.org/index.php?topic=283746.0)


Thank you for the comparison! This was very helpful.

Are a hard fork and soft fork implemented in different ways? Like are you editing the same code in both fork types?


Title: Re: What is a Bitcoin soft fork? (in laymen's terms)
Post by: Rannasha on February 05, 2015, 06:24:04 AM
Some comparisons:

Hardfork is making some invalid transactions valid

Softfork is making some valid transactions invalid

Hardfork requires the consensus of vast majority of miners, users, and merchants

Softfork requires the consensus of vast majority of miners, but not necessarily non-mining users and merchants

Hardfork can change any rules in the protocol or implement any new rules

Softfork is usually less powerful (with a trick which I call "Aux block", a softfork could also be very powerful: https://bitcointalk.org/index.php?topic=283746.0)


Thank you for the comparison! This was very helpful.

Are a hard fork and soft fork implemented in different ways? Like are you editing the same code in both fork types?

Every change requires editing the code. What you change to the code will determine whether the new version will force a soft fork, a hard fork or no fork at all.

You could edit the maximum allowed block size in the code. Change it to 100 KB and it'll be a soft fork, change it to 100 MB and it'll be a hard fork.


Title: Re: What is a Bitcoin soft fork? (in laymen's terms)
Post by: jl2012 on February 05, 2015, 06:28:42 AM

You could edit the maximum allowed block size in the code. Change it to 100 KB and it'll be a soft fork, change it to 100 MB and it'll be a hard fork.

Good example.

Changing the max block size from 1MB to 0.1MB is a softfork, because it makes previously valid blocks (0.1MB-1MB) invalid.

Changing the max block size from 1MB to 10MB is a hardfork, because it makes previously invalid blocks (1MB-10MB) valid.


Title: Re: What is a Bitcoin soft fork? (in laymen's terms)
Post by: readerbtc on February 05, 2015, 06:11:19 PM

You could edit the maximum allowed block size in the code. Change it to 100 KB and it'll be a soft fork, change it to 100 MB and it'll be a hard fork.

Good example.

Changing the max block size from 1MB to 0.1MB is a softfork, because it makes previously valid blocks (0.1MB-1MB) invalid.

I think changing the max block size from 1MB to 0.1MB is a hard fork, actually. Miners that don't upgrade will generate one 1MB and those won't be accepted but the upgraded clients, forking the blockchain.

A soft fork would be changing the max block size one produces from 1MB to 0.1MB, while leaving the max block size one accepts unchanged.

Or am I wrong? #sincerequestion


Title: Re: What is a Bitcoin soft fork? (in laymen's terms)
Post by: swapcoiner on February 05, 2015, 06:28:06 PM
Soft fork is just a bypass. Such fork is needed but doesn't harm the network.


Title: Re: What is a Bitcoin soft fork? (in laymen's terms)
Post by: johoe on February 05, 2015, 10:23:19 PM
Changing the max block size from 1MB to 0.1MB is a softfork, because it makes previously valid blocks (0.1MB-1MB) invalid.

I think changing the max block size from 1MB to 0.1MB is a hard fork, actually. Miners that don't upgrade will generate one 1MB and those won't be accepted but the upgraded clients, forking the blockchain.

A soft fork would be changing the max block size one produces from 1MB to 0.1MB, while leaving the max block size one accepts unchanged.

Or am I wrong? #sincerequestion

Sorry, but you are wrong.  Changing max block size to 0.1MB is a soft fork.  A soft fork only works if the majority of miners agree, in which case all miners accept the shorter blocks and the minority that produces larger blocks will be ignored.  If you do a soft fork only yourself, you are on a short chain and the longest chain will still contain large blocks.  It is similar to a hard fork where you are the only one who hasn't upgraded.

Changing the max block size you produce from 1MB to 0.1MB is not a fork at all.  You still accept the large blocks of other miners and other miners will accept your block.


Title: Re: What is a Bitcoin soft fork? (in laymen's terms)
Post by: jl2012 on February 06, 2015, 04:19:17 AM

You could edit the maximum allowed block size in the code. Change it to 100 KB and it'll be a soft fork, change it to 100 MB and it'll be a hard fork.

Good example.

Changing the max block size from 1MB to 0.1MB is a softfork, because it makes previously valid blocks (0.1MB-1MB) invalid.

I think changing the max block size from 1MB to 0.1MB is a hard fork, actually. Miners that don't upgrade will generate one 1MB and those won't be accepted but the upgraded clients, forking the blockchain.

A soft fork would be changing the max block size one produces from 1MB to 0.1MB, while leaving the max block size one accepts unchanged.

Or am I wrong? #sincerequestion

People are ALREADY doing this and as johoe explains this is not a fork. A fork, soft or hard, must involve a rule change in the validity of transactions/blocks.


Title: Re: What is a Bitcoin soft fork? (in laymen's terms)
Post by: readerbtc on February 06, 2015, 12:11:07 PM
Thanks.


Title: Re: What is a Bitcoin soft fork? (in laymen's terms)
Post by: instagibbs on February 06, 2015, 02:06:50 PM
https://bitcoin.org/en/developer-guide#consensus-rule-changes 

bitcoin.org documentation explains it quite nicely.

I am also writing up a blog post Soon^TM to rephrase and give some history.