<div dir="auto"><div dir="auto">Totally agree something like this required..</div><div dir="auto"><br></div><div dir="auto">I&#39;ve been burned.</div><div dir="auto"><br></div><div dir="auto">But I like the &#39;old&#39; idea of putting the hash of a block that MUST be on the chain that this txn can eventually be added to. If the hash is not a valid block on the chain, the txn can&#39;t be added.<br></div><div dir="auto"><br></div><div dir="auto">It means you can choose exactly which forks you want to allow your txn on, pre-fork for both, post-fork for only one, and gets round the issue of who gets to decide the nForkid value.. since you don&#39;t need one. Also, all the old outputs work fine, and LN not an issue.</div><div dir="auto"><br></div><div dir="auto">I&#39;m missing why this scheme would be better ?<br></div><div dir="auto"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Nov 13, 2017 15:35, &quot;Jacob Eliosoff via bitcoin-dev&quot; &lt;<a href="mailto:bitcoin-dev@lists.linuxfoundation.org">bitcoin-dev@lists.linuxfoundation.org</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div>This is actually incorrect. There are two transactions involved in LN. The funding transaction, which opens a payment channel, and a commitment transaction, which closes the channel when broadcasted to the network (the cooperative closing transaction can be considered a commitment transaction in a loose sense). </div><div><br></div><div>Now you want to protect the funding transaction, as otherwise you would be subject to a replay-attack on all *past* forks. So you will set `nForkId&gt;=1` for the funding transaction, making this payment channel non-existent on any *past* forks. However, if during the lifetime of the payment channel another fork happens, the payment channel exists for both tokens. So for the commitment transaction, you will have `nForkId=0`, making it valid on both of these chains. While this `nForkId` is valid on all chains, the parent transaction it tries to spend (the funding transaction) does only exist on two chains, the original one you created the channel for and the one that forked away. </div></div></blockquote></div><div><br></div>Thanks for the clarification.  How would a tx specify a constraint like &quot;nForkId&gt;=1&quot;?  I was thinking of it just as a number set on the tx.<div><br></div><div>Also note that since forks form a partial order, but IDs (numbers) form a total order, &quot;&gt;=&quot; will miss some cases.  Eg, suppose BCH had forked with nForkId 2, and then you set up a LN funding tx on BCH with nForkId&gt;=2, and then Segwit2x forked (from BTC!) with nForkId 3.  The BCH funding tx would be valid on Segwit2x.  This is more of a fundamental problem than a bug - to avoid it you&#39;d have to get into stuff like making each fork reference its parent-fork&#39;s first block or something, someone has written about this...<br><div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 13, 2017 at 5:03 AM, Mats Jerratsch <span dir="ltr">&lt;<a href="mailto:mats@blockchain.com" target="_blank">mats@blockchain.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><span class="m_8209364487259859034gmail-"><br><blockquote type="cite"><div><div dir="ltr">OK, so nForkId 0 is exactly the &quot;valid on all chains&quot; specifier I was asking about, cool.  And your LN example (and nLockTime txs in general) illustrate why it&#39;s preferable to implement a generic replay protection scheme like yours <i>in advance</i>, rather than before each fork: all ad hoc RP schemes I know of break old txs on one of the chains, even when that&#39;s not desirable - ie, they offer no wildcard like nForkId 0.</div></div></blockquote><div><br></div></span><div>Exactly!</div><span class="m_8209364487259859034gmail-"><div><br></div><blockquote type="cite"><div><div dir="ltr"><div>One comment on your LN example: users would have to take note that nForkId 0 txs would be valid not only on future forks, but on <i>past</i> forks too.  Eg, if BCH had been deployed with nForkId 2, then a user setting up BTC LN txs now with nForkId 0 would have to be aware that those txs would be valid for BCH too.  Of course the user could avoid this by funding from a BTC-only address, but it is a potential minor pitfall of nForkId 0.  (Which I don&#39;t see any clean way around.)</div></div>
</div></blockquote></span></div><br><div>This is actually incorrect. There are two transactions involved in LN. The funding transaction, which opens a payment channel, and a commitment transaction, which closes the channel when broadcasted to the network (the cooperative closing transaction can be considered a commitment transaction in a loose sense). </div><div><br></div><div>Now you want to protect the funding transaction, as otherwise you would be subject to a replay-attack on all *past* forks. So you will set `nForkId&gt;=1` for the funding transaction, making this payment channel non-existent on any *past* forks. However, if during the lifetime of the payment channel another fork happens, the payment channel exists for both tokens. So for the commitment transaction, you will have `nForkId=0`, making it valid on both of these chains. While this `nForkId` is valid on all chains, the parent transaction it tries to spend (the funding transaction) does only exist on two chains, the original one you created the channel for and the one that forked away. </div></div></blockquote></div><br></div></div></div></div></div>
<br>______________________________<wbr>_________________<br>
bitcoin-dev mailing list<br>
<a href="mailto:bitcoin-dev@lists.linuxfoundation.org">bitcoin-dev@lists.<wbr>linuxfoundation.org</a><br>
<a href="https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev" rel="noreferrer" target="_blank">https://lists.linuxfoundation.<wbr>org/mailman/listinfo/bitcoin-<wbr>dev</a><br>
<br></blockquote></div></div>