Research/Bitcoin Dev Archive / SegWit2x list
2-way replay protection w/o changes to 1x chain
1 message, Aug 25, 2017. Started by Jacob Eliosoff.
Jacob Eliosoff
I'd like to highlight another replay approach raised by people like Sjors [1]: opt-in 2-way protection via changes to *clients and 2x nodes only, leaving 1x nodes unchanged.* The approach boils down to two questions:
1. What's the cleanest (minimal code change, data bloat, etc) tweak to a valid old tx that *keeps it valid, but would never be sent by an old client?*
2. What's the cleanest tweak to a valid old tx that *makes it invalid (on old nodes)?*
Then we make 2x nodes reject #1 (a 1x-only tx); accept #2 (a 2x-only tx), along with normal legacy txs; patch clients to support sending these tx types; and we're done.
BCH's SIGHASH_FORKID is a good candidate for #2. A special OP_RETURN [2] is a candidate for #1, but dicey: as Erik said, "better than nothing", but many 1x clients may be unwilling to send a nonstandard tx, even to avoid replay. Maybe Andrew's "magic sequence number" [3] is a better #1? We could even reserve, eg, just the highest bit of the sequence number as a "1x-only" (ie "2x-invalid") flag.
This 1x-unchanged approach is not as clean as more symmetric approaches like Sergio's version bits [4], however, which still seem to me more likely to win the necessary support. So by all means consider that too...
Apologies to anyone who already knew all about this approach - I didn't.
[1] https://github.com/btc1/bitcoin/issues/34#issuecomment-324712394 [2] https://github.com/btc1/bitcoin/pull/117 [3] https://bitcoin.org/en/developer-guide#locktime-and-sequence-number [4] https://twitter.com/JaEsf/status/900440066446823424
On Aug 24, 2017 3:03 PM, "Jacob Eliosoff" <jacob.eliosoff at gmail.com> wrote:
I mostly agree with Will, but I disagree that replay protection should be left to the "weaker version", especially since 3 months out we can't be sure which version that will be. I'd like to make another plug for simple, voluntary replay protection on both chains, *at least* on an opt-in basis: that is, making it easy for wallet/sending software to prevent *in advance* accidental sends on the wrong chain. Sergio has sketched a simple version bits implementation: see eg https://twitter.com/JaEsf/ status/900440066446823424 and https://lists.linuxfoundation.org/pipermail/ bitcoin-segwit2x/2017-August/000264.html.
This seems to me an approach that harms no one, would protect the majority of users on both chains in advance, and - unlike most other replay proposals - would have good prospects of actually getting adopted.
On Aug 24, 2017 2:42 PM, "Will M via Bitcoin-segwit2x" < bitcoin-segwit2x at lists.linuxfoundation.org> wrote:
I may be confused, but I don’t think that’s correct. Had the EDA not triggered today, the very *first* block of BCC may have confused lite clients; however, the first BCC block would still confirm with different transactions than “sister" block on the BTC chain. Because the block header contains the merkle root of the hash of all transactions in the block, and also contains the block header hash of the *previous* block, the second block of BCC would have a different block header hash even without the EDA difficulty adjustment change. I’m rusty, but I think that’s how it would go.
Correct or not, what a fascinating conversation! My view is that Bitcoin Cash had no chance of attaining a majority hash power on the day of the fork, and because replay protection is not technically very hard or particularly dangerous to implement, there was every reason to include it. There was no chance BCC would be compatible 1:1 with existing wallets/infrastructure, so why not?
That is *not* the case between Segwit2x and Segwit1x. Building in replay protection will break much of the infrastructure built on top of Bitcoin for the version that implements it. This puts the implementing version at a disadvantage by creating more work/cost/risk for the community to support their project. Since Segwit2x is intentionally designed to become “Bitcoin” and replace Segwit1x, why would they implement replay protection? Why break existing infrastructure for itself in order to benefit the version it aims to replace?
If the weaker version feels threatened, they should implement replay protection and build contingency plans to mitigate excessively long block confirmation times. We should all be civil, but it’s OK to not be on the same “team”, and I think our energy would be better spent if we got back to focusing on how to make each project more valuable. I’ll just leave it there. Fascinating read.
On Aug 24, 2017, 11:43 AM -0600, Peter Todd via Bitcoin-segwit2x < bitcoin-segwit2x at lists.linuxfoundation.org>, wrote:
On Thu, Aug 24, 2017 at 07:31:34PM +0200, Gianluigi Crimi wrote:
The main problem in that statement is not if EDA was triggered or not. The problem is that it is not and cannot be a soft-fork. With soft-forks you can increase the difficulty but you cannot decrease it. If you increase the difficulty with new rules there will not be backward compatibility issues, but if the difficulty decreases old clients will mark blocks mined with low POW as invalid.
That's a good point too - using the term "soft-fork" isn't correct. What I should have said is simply that that BCH's header chain is compatible with BTC, until the emergency difficulty adjustment activates. I definitely replied there too quickly. :)
Of course, that's still a potential problem, albeit one averted by the EDA: in different circumstances where the EDA had not activated, I was correct in saying that we'd still have a problem for lite clients. Given that the EDA definitely required lite clients to upgrade anyway it would have been better if BCH had also made their block header *always* incompatible with BTC. Making the nVersion incompatible would have been a simple and effective way to do that.