Nicolas Dorier [ARCHIVE] on Nostr: 📅 Original date posted:2016-03-07 📝 Original message: I'm amazed as I found a ...
📅 Original date posted:2016-03-07
📝 Original message:
I'm amazed as I found a useful case for OP_CODESEPARATOR.
I think the script can be improved to take less byte for removing the
duplication of <KeyA>, will take a look later.
Let's change escape redeem:
OP_HASH160 <RHashA> OP_EQUAL
OP_IF
<KeyB>
OP_ELSE
<Delay> OP_CSV OP_DROP
<KeyA>
OP_ENDIF
OP_CHECKSIG
To
<KeyA> OP_CHECKSIG
OP_IF
<KeyB>
OP_ELSE
<Delay> OP_CSV OP_DROP
OP_CODESEPARATOR <KeyA>
OP_ENDIF
OP_CHECKSIG
The Escape output would be
<SIG-B> <SIGA-Revocation> {<ESCAPE-REDEEM>}
Where SIGA-Revocation is the signature of KeyA computed with the
ScriptCode=<ESCAPE-REDEEM>
The second escape would be
<SIG-A> 0 {<ESCAPE-REDEEMSCRIPT>}
where <SIG-A> script equals to
<KeyA>
OP_ENDIF
OP_CHECKSIG
You would revoke a commitment by revealing <SIGA-Revocation>
Btw, you can play with http://n.bitcoin.ninja/checkscript to test such
script (I'm checking it myself)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20160307/20fd0605/attachment.html>
📝 Original message:
I'm amazed as I found a useful case for OP_CODESEPARATOR.
I think the script can be improved to take less byte for removing the
duplication of <KeyA>, will take a look later.
Let's change escape redeem:
OP_HASH160 <RHashA> OP_EQUAL
OP_IF
<KeyB>
OP_ELSE
<Delay> OP_CSV OP_DROP
<KeyA>
OP_ENDIF
OP_CHECKSIG
To
<KeyA> OP_CHECKSIG
OP_IF
<KeyB>
OP_ELSE
<Delay> OP_CSV OP_DROP
OP_CODESEPARATOR <KeyA>
OP_ENDIF
OP_CHECKSIG
The Escape output would be
<SIG-B> <SIGA-Revocation> {<ESCAPE-REDEEM>}
Where SIGA-Revocation is the signature of KeyA computed with the
ScriptCode=<ESCAPE-REDEEM>
The second escape would be
<SIG-A> 0 {<ESCAPE-REDEEMSCRIPT>}
where <SIG-A> script equals to
<KeyA>
OP_ENDIF
OP_CHECKSIG
You would revoke a commitment by revealing <SIGA-Revocation>
Btw, you can play with http://n.bitcoin.ninja/checkscript to test such
script (I'm checking it myself)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20160307/20fd0605/attachment.html>