Skip to content

Add scripts for taproot channels #3016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 27, 2025
Merged

Add scripts for taproot channels #3016

merged 3 commits into from
Feb 27, 2025

Conversation

sstone
Copy link
Member

@sstone sstone commented Feb 25, 2025

There are no functional changes, this PR just adds low-level methods to create taproot lightning transactions.

The scripts used in this PR are slightly different from the ones included in the "simple taproot channels" proposal at ttps://github.com/lightning/bolts/pull/995/commits/e25132d8de0164224578964fcd3f7328ddfc3281, because they have been generated with miniscript (the "miniscript code" is included in the comment). We expect the the taproot channels PR will also be modified to become "miniscript compatible".

These scripts have been generated with miniscript and are different from the ones included in the "simple taproot channels" proposal
at lightning/bolts@e25132d.
@sstone sstone requested a review from t-bast February 25, 2025 16:11
This original script is: <local_delayedpubkey> OP_DROP <revocation_pubkey> OP_CHECKSIG
It includes a NOOP push of the local delayed payment pubkey, which is needed to spend the anchor output once the 16-blocks CSV delay has passed.
Copy link
Member

@t-bast t-bast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me quite a while to figure out how we will then use those scripts. I think that after merging this, we need a follow-up PR that adds helpers around producing witnesses and makes the changes to Transactions.scala to support signing all transaction types: it's not obvious how we will make that work without relying on error-prone assumptions around the ScriptTree in the TaprootInput...

This follow-up PR should update the existing test to use typed transactions and the exposed sign and addSigs methods instead of having the logic directly inside the test.

@t-bast
Copy link
Member

t-bast commented Feb 26, 2025

We expect the the taproot channels PR will also be modified to become "miniscript compatible".

Can you add comments to the BOLTs PR with the scripts we are using? This needs to be recorded somewhere to ensure other implementations ACK on those scripts before we start using them.

@sstone
Copy link
Member Author

sstone commented Feb 26, 2025

I took nearly all the changes you proposed in #3018, thanks!

Copy link
Member

@t-bast t-bast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@sstone sstone merged commit cae22d7 into master Feb 27, 2025
1 check passed
@sstone sstone deleted the taproot-scripts branch February 27, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants