Skip to content
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

Add bip-internalkey #1534

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

reardencode
Copy link

OP_INTERNALKEY is a new BIP342 tapscript only opcode (upgraded using OP_SUCCESS semantics) that takes bytes 1-32 (0-index, inclusive) from the BIP341 taproot control block and places them on the stack. This BIP describes that behavior.


When building taproot outputs, especially those secured by an aggregate key
representing more than 1 signer; the parties may wish to collaborate on signing
with the taproot internal key, but only with additional script restrictions. In
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you give an example where using the key path with an aggregate key and having every participant enforce the additional restrictions themselves (i.e. only signing if they're met) wouldn't suffice?

Copy link
Author

Choose a reason for hiding this comment

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

The most obvious case would be lightning symmetry where the parties want to pre-sign with CTV+CSFS to create a rebindable update transaction.

bip-internalkey.mediawiki Outdated Show resolved Hide resolved
@reardencode reardencode force-pushed the internalkey branch 2 times, most recently from c9842c4 to 729276c Compare April 24, 2024 21:34
@reardencode
Copy link
Author

Updated to match the BIN.

Copy link
Contributor

@murchandamus murchandamus left a comment

Choose a reason for hiding this comment

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

Has this proposal been discussed on the mailing list?

bip-internalkey.md Outdated Show resolved Hide resolved
@murchandamus murchandamus added the PR Author action required Needs updates, has unaddressed review comments, or is otherwise waiting for PR author label May 8, 2024
[BIP 342]), `OP_INTERNALKEY` replaces `OP_SUCCESS203` (0xcb). `OP_INTERNALKEY`
pushes the taproot internal key, as defined in [BIP 341], to the stack.

## Motivation
Copy link

Choose a reason for hiding this comment

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

Additional useful feature: ability to inspect the tweak to a key (in combination with some OP_TWEAKVERIFY).

Copy link
Author

Choose a reason for hiding this comment

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

That would require additional introspection beyond just INTERNALKEY too, wouldn't it?

Copy link

Choose a reason for hiding this comment

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

Yes, something like TWEAKADD or TWEAKVERIFY.


When verifying taproot script spends having leaf version `0xc0` (as defined in
[BIP 342]), `OP_INTERNALKEY` replaces `OP_SUCCESS203` (0xcb). `OP_INTERNALKEY`
pushes the taproot internal key, as defined in [BIP 341], to the stack.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: might be nice to mark "taproot internal key" as a formal term, either by italicizing, backticks or the like. I find that marking terms that invoke a suite of definitions and properties is really helpful. We do it a lot in the BOLTs and I'd recommend doing it in the BIPs as much as we can.

Copy link
Contributor

@murchandamus murchandamus left a comment

Choose a reason for hiding this comment

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

This seems close to ready for a merge, although I am wondering whether it has gotten enough review from the community. I noticed that both this PR and the mailing list thread were not that active.


## Specification

When verifying taproot script spends having leaf version `0xc0` (as defined in
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
When verifying taproot script spends having leaf version `0xc0` (as defined in
When verifying taproot script path spends having leaf version `0xc0` (as defined in

When building taproot outputs, especially those secured by an aggregate key
representing more than one signer, the parties may wish to collaborate on
signing with the taproot internal key, but only with additional script
restrictions. In this case, `OP_INTERNALKEY` saves 8 vBytes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps you could elaborate how OP_INTERNALKEY would save 8 vB, for example in a footnote. (I assume it’s an x-only key of 32 bytes, and otherwise you’d need a PUSH and the 32 bytes, but with OP_INTERNALKEY you only need only that one byte instead. But if I had to think about that, maybe others would also appreciate an explanation.


### Mitigated control block overhead for scripts using hash locks

In cases where script path spending is not desired, the internal key may be set
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean:

Suggested change
In cases where script path spending is not desired, the internal key may be set
In cases where key path spending is not desired, the internal key may be set


When verifying taproot script spends having leaf version `0xc0` (as defined in
[BIP 342]), `OP_INTERNALKEY` replaces `OP_SUCCESS203` (0xcb). `OP_INTERNALKEY`
pushes the taproot internal key, as defined in [BIP 341], to the stack.
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems to me that this should be perhaps a bit more specific what exactly is being pushed to the stack. I assume this is referring to

Let p = c[1:33] and let P = lift_x(int(p)) where lift_x and [:] are defined as in BIP340. Fail if this point is not on the curve. […] q is referred to as taproot output key and p as taproot internal key.

but it would not hurt to clarify.

Choose a reason for hiding this comment

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

"the taproot internal key denoted as P in [BIP 341]"?

@moonsettler
Copy link

So what exactly needs to be done to get this BIP unstuck?

@murchandamus
Copy link
Contributor

There do seem to be several unaddressed review comments. Happy to review again when the open review comments have been addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs number assignment New BIP PR Author action required Needs updates, has unaddressed review comments, or is otherwise waiting for PR author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants