From a45c7b655c96ef27f9a9abb10721a42f39003e41 Mon Sep 17 00:00:00 2001 From: Antoni Spaanderman <56turtle56@gmail.com> Date: Tue, 10 May 2022 20:58:24 +0200 Subject: [PATCH 1/2] update taproot-updates.md - Save bytes in some scripts - Fix a script - Set sequence to 1 in second stage HTLC - Remove trailing whitespace --- taproot-updates.md | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/taproot-updates.md b/taproot-updates.md index 8424c22..ed261a1 100644 --- a/taproot-updates.md +++ b/taproot-updates.md @@ -96,8 +96,8 @@ The commitment transaction will then become: "tapleaf": " # funds go back to the other channel participant after 1 block - OP_CHECKSIGVERIFY - 1 OP_CHECKSEQUENCEVERIFY + OP_CHECKSIG + OP_CHECKSEQUENCEVERIFY " } }, @@ -137,14 +137,13 @@ The commitment transaction will then become: # funds go back to us via a second-stage HTLC-timeout transaction (which contains an absolute delay) # NB: we also need the remote signature, which prevents us from unilaterally changing the HTLC-timeout transaction OP_CHECKSIGVERIFY OP_CHECKSIG - 1 OP_CHECKSEQUENCEVERIFY ", "tapleaf_2": " # funds go to the remote node if it has the payment preimage. OP_HASH160 OP_EQUALVERIFY - OP_CHECKSIGVERIFY - 1 OP_CHECKSEQUENCEVERIFY + OP_CHECKSIG + OP_CHECKSEQUENCEVERIFY " } }, @@ -161,15 +160,15 @@ The commitment transaction will then become: # NB: we also need the remote signature, which prevents us from unilaterally changing the HTLC-success transaction OP_HASH160 OP_EQUALVERIFY OP_CHECKSIGVERIFY OP_CHECKSIG - 1 OP_CHECKSEQUENCEVERIFY ", "tapleaf_2": " # funds go to the remote node after an absolute delay (timeout) - OP_CHECKSIGVERIFY + OP_CHECKSIG + OP_CHECKSEQUENCEVERIFY OP_CHECKLOCKTIMEVERIFY - 1 OP_CHECKSEQUENCEVERIFY + OP_DROP " } }, @@ -195,7 +194,7 @@ A taproot HTLC-success transaction looks like: "txid": "...", "vout": 42, "scriptSig": " ", - "sequence": 0 + "sequence": 1 } ], "vout": [ @@ -230,7 +229,7 @@ A taproot HTLC-timeout transaction looks like: "txid": "...", "vout": 42, "scriptSig": " ", - "sequence": 0 + "sequence": 1 } ], "vout": [ @@ -284,13 +283,11 @@ structure (or something similar) to our commitment transaction: # funds go back to us via a second-stage PTLC-timeout transaction (which contains an absolute delay) # NB: we need the remote signature, which prevents us from unilaterally changing the PTLC-timeout transaction OP_CHECKSIGVERIFY OP_CHECKSIG - 1 OP_CHECKSEQUENCEVERIFY ", "tapleaf_2": " # funds go to the remote node via a second-stage Claim-PTLC-success transaction by completing an adaptor sig, revealing the payment secret # NB: we don't use musig2 here because it would force local and remote signatures to use the same sighash flags OP_CHECKSIGVERIFY OP_CHECKSIG - 1 OP_CHECKSEQUENCEVERIFY " } ``` @@ -333,7 +330,7 @@ We simply add two new types of outputs to the commit tx (PTLC offered / PTLC rec | +------------------------+ +------->| commit tx B | +------------------------+ - | | | | | | | | + | | | | | | | | | | | | | | | | A's main output | | | | | | | +-----------------> to A after a 1-block relative delay | | | | | | | @@ -388,7 +385,7 @@ We simply add two new types of outputs to the commit tx (PTLC offered / PTLC rec | +---> to A with revocation key | | (B's RBF inputs) ---+ - | | +---> to B after relative delay + | | +---> to B after relative delay | +---->+-----------------+ | | +---------->| PTLC-success tx |----------------+ | PTLC received by B | +-----------------+ | From 0294da600be9a3f0c7a8f8789b481adde98a4640 Mon Sep 17 00:00:00 2001 From: Antoni Spaanderman <56turtle56@gmail.com> Date: Wed, 11 May 2022 21:47:01 +0200 Subject: [PATCH 2/2] remove script optimizations for readability --- taproot-updates.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/taproot-updates.md b/taproot-updates.md index ed261a1..d55d69c 100644 --- a/taproot-updates.md +++ b/taproot-updates.md @@ -96,8 +96,8 @@ The commitment transaction will then become: "tapleaf": " # funds go back to the other channel participant after 1 block - OP_CHECKSIG - OP_CHECKSEQUENCEVERIFY + OP_CHECKSIGVERIFY + 1 OP_CHECKSEQUENCEVERIFY " } }, @@ -136,14 +136,15 @@ The commitment transaction will then become: "tapleaf_1": " # funds go back to us via a second-stage HTLC-timeout transaction (which contains an absolute delay) # NB: we also need the remote signature, which prevents us from unilaterally changing the HTLC-timeout transaction - OP_CHECKSIGVERIFY OP_CHECKSIG + OP_CHECKSIGVERIFY OP_CHECKSIGVERIFY + 1 OP_CHECKSEQUENCEVERIFY ", "tapleaf_2": " # funds go to the remote node if it has the payment preimage. OP_HASH160 OP_EQUALVERIFY - OP_CHECKSIG - OP_CHECKSEQUENCEVERIFY + OP_CHECKSIGVERIFY + 1 OP_CHECKSEQUENCEVERIFY " } }, @@ -159,13 +160,14 @@ The commitment transaction will then become: # funds go to us via a second-stage HTLC-success transaction once we have the payment preimage # NB: we also need the remote signature, which prevents us from unilaterally changing the HTLC-success transaction OP_HASH160 OP_EQUALVERIFY - OP_CHECKSIGVERIFY OP_CHECKSIG + OP_CHECKSIGVERIFY OP_CHECKSIGVERIFY + 1 OP_CHECKSEQUENCEVERIFY ", "tapleaf_2": " # funds go to the remote node after an absolute delay (timeout) - OP_CHECKSIG - OP_CHECKSEQUENCEVERIFY + OP_CHECKSIGVERIFY + 1 OP_CHECKSEQUENCEVERIFY OP_CHECKLOCKTIMEVERIFY OP_DROP @@ -282,12 +284,14 @@ structure (or something similar) to our commitment transaction: "tapleaf_1": " # funds go back to us via a second-stage PTLC-timeout transaction (which contains an absolute delay) # NB: we need the remote signature, which prevents us from unilaterally changing the PTLC-timeout transaction - OP_CHECKSIGVERIFY OP_CHECKSIG + OP_CHECKSIGVERIFY OP_CHECKSIGVERIFY + 1 OP_CHECKSEQUENCEVERIFY ", "tapleaf_2": " # funds go to the remote node via a second-stage Claim-PTLC-success transaction by completing an adaptor sig, revealing the payment secret # NB: we don't use musig2 here because it would force local and remote signatures to use the same sighash flags - OP_CHECKSIGVERIFY OP_CHECKSIG + OP_CHECKSIGVERIFY OP_CHECKSIGVERIFY + 1 OP_CHECKSEQUENCEVERIFY " } ```