From 75351f2587ebdf220a92ac9c89119343f4cf8584 Mon Sep 17 00:00:00 2001 From: Brandon Black Date: Wed, 24 Apr 2024 14:34:29 -0700 Subject: [PATCH 1/5] Add bip-internalkey --- README.mediawiki | 7 +++++ bip-internalkey.md | 70 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 bip-internalkey.md diff --git a/README.mediawiki b/README.mediawiki index ebe1c14c..476a963b 100644 --- a/README.mediawiki +++ b/README.mediawiki @@ -1121,6 +1121,13 @@ Those proposing changes should consider that ultimately consent may rest with th | Standard | Draft |- style="background-color: #cfffcf" +| [[bip-internalkey.md|internalkey]] +| Consensus (soft fork) +| OP_INTERNALKEY +| Brandon Black, Jeremy Rubin +| Standard +| Draft +|- style="background-color: #cfffcf" | [[bip-0350.mediawiki|350]] | Applications | Bech32m format for v1+ witness addresses diff --git a/bip-internalkey.md b/bip-internalkey.md new file mode 100644 index 00000000..38cb59ec --- /dev/null +++ b/bip-internalkey.md @@ -0,0 +1,70 @@ +``` +BIP: XXX +Layer: Consensus (soft fork) +Title: OP_INTERNALKEY +Author: Brandon Black , Jeremy Rubin +Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-XXXX +Status: Draft +Type: Standards Track +Created: 2023-12-22 +License: BSD-3-Clause +``` + +## Abstract + +This BIP describes a new tapscript opcode (`OP_INTERNALKEY`) which +pushes the taproot internal key to the stack. + +## Specification + +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. + +## Motivation + +### Key spend with additional conditions + +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. + +### Mitigated control block overhead for scripts using hash locks + +In cases where script path spending is not desired, the internal key may be set +to a NUMS point whose bytes would otherwise be required in a tapscript. This +could be used with any hash locked transaction, for example, to save 8 vBytes. + +Note: The internal key must be the X coordinate of a point on the SECP256K1 +curve, so any such hash must be checked and modified until it is such an X +coordinate. This will typically take approximately 2 attempts. + +## Reference Implementation + +A reference implementation is provided here: + +https://github.com/bitcoin/bitcoin/pull/29269 + +## Backward Compatibility + +By constraining the behavior of an OP_SUCCESS opcode, deployment of the BIP +can be done in a backwards compatible, soft-fork manner. If anyone were to +rely on the OP_SUCCESS behavior of `OP_SUCCESS203`, `OP_INTERNALKEY` would +invalidate their spend. + +## Deployment + +TBD + +## Credits + +TODO + +## Copyright + +This document is licensed under the 3-clause BSD license. + +[BIP 341]: https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki + +[BIP 342]: https://github.com/bitcoin/bips/blob/master/bip-0342.mediawiki From b35383b68f514c93e0e99e4d47472a79217348a0 Mon Sep 17 00:00:00 2001 From: moonsettler Date: Tue, 12 Nov 2024 23:46:22 +0100 Subject: [PATCH 2/5] Fixes and clarifications to address PR comments --- bip-internalkey.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bip-internalkey.md b/bip-internalkey.md index 38cb59ec..74e0f701 100644 --- a/bip-internalkey.md +++ b/bip-internalkey.md @@ -13,13 +13,14 @@ License: BSD-3-Clause ## Abstract This BIP describes a new tapscript opcode (`OP_INTERNALKEY`) which -pushes the taproot internal key to the stack. +pushes the _taproot internal key_ to the stack. ## Specification -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. +When verifying taproot script path spends having leaf version `0xc0` (as +defined in [BIP 342]), `OP_INTERNALKEY` replaces `OP_SUCCESS203` (0xcb). +`OP_INTERNALKEY` pushes the _taproot internal key_, denoted as _P_ in +[BIP 341], to the stack. ## Motivation @@ -27,14 +28,14 @@ pushes the taproot internal key, as defined in [BIP 341], to the stack. 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 +signing with the _taproot internal key_, but only with additional script restrictions. In this case, `OP_INTERNALKEY` saves 8 vBytes. ### Mitigated control block overhead for scripts using hash locks -In cases where script path spending is not desired, the internal key may be set -to a NUMS point whose bytes would otherwise be required in a tapscript. This -could be used with any hash locked transaction, for example, to save 8 vBytes. +In cases where key path spending is not desired, the internal key may be set to +a NUMS point whose bytes would otherwise be required in a tapscript. This could +be used with any hash locked transaction, for example, to save 8 vBytes. Note: The internal key must be the X coordinate of a point on the SECP256K1 curve, so any such hash must be checked and modified until it is such an X From 329b0d3db50dea3b348f7322cb5af4ec37064013 Mon Sep 17 00:00:00 2001 From: moonsettler Date: Thu, 14 Nov 2024 18:10:42 +0100 Subject: [PATCH 3/5] BIP-349 --- README.mediawiki | 2 +- bip-internalkey.md => bip-0349.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) rename bip-internalkey.md => bip-0349.md (92%) diff --git a/README.mediawiki b/README.mediawiki index 476a963b..957a5a52 100644 --- a/README.mediawiki +++ b/README.mediawiki @@ -1121,7 +1121,7 @@ Those proposing changes should consider that ultimately consent may rest with th | Standard | Draft |- style="background-color: #cfffcf" -| [[bip-internalkey.md|internalkey]] +| [[bip-0349.md|349]] | Consensus (soft fork) | OP_INTERNALKEY | Brandon Black, Jeremy Rubin diff --git a/bip-internalkey.md b/bip-0349.md similarity index 92% rename from bip-internalkey.md rename to bip-0349.md index 74e0f701..56592590 100644 --- a/bip-internalkey.md +++ b/bip-0349.md @@ -1,9 +1,9 @@ ``` -BIP: XXX +BIP: 349 Layer: Consensus (soft fork) Title: OP_INTERNALKEY Author: Brandon Black , Jeremy Rubin -Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-XXXX +Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0349 Status: Draft Type: Standards Track Created: 2023-12-22 @@ -19,8 +19,8 @@ pushes the _taproot internal key_ to the stack. When verifying taproot script path spends having leaf version `0xc0` (as defined in [BIP 342]), `OP_INTERNALKEY` replaces `OP_SUCCESS203` (0xcb). -`OP_INTERNALKEY` pushes the _taproot internal key_, denoted as _P_ in -[BIP 341], to the stack. +`OP_INTERNALKEY` pushes the 32-byte x-only representation of the _taproot +internal key_ (referred to as _p_), as defined in [BIP 341], to the stack. ## Motivation From 669d3b3570adad74febcb054f21c4d56b3ee4106 Mon Sep 17 00:00:00 2001 From: Murch Date: Thu, 14 Nov 2024 16:26:55 -0500 Subject: [PATCH 4/5] BIP349: Fix preamble for CI issues --- README.mediawiki | 2 +- bip-0349.md | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.mediawiki b/README.mediawiki index 957a5a52..2ead8530 100644 --- a/README.mediawiki +++ b/README.mediawiki @@ -1120,7 +1120,7 @@ Those proposing changes should consider that ultimately consent may rest with th | Ethan Heilman, Armin Sabouri | Standard | Draft -|- style="background-color: #cfffcf" +|- | [[bip-0349.md|349]] | Consensus (soft fork) | OP_INTERNALKEY diff --git a/bip-0349.md b/bip-0349.md index 56592590..ade62051 100644 --- a/bip-0349.md +++ b/bip-0349.md @@ -1,14 +1,15 @@ -``` -BIP: 349 -Layer: Consensus (soft fork) -Title: OP_INTERNALKEY -Author: Brandon Black , Jeremy Rubin -Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0349 -Status: Draft -Type: Standards Track -Created: 2023-12-22 -License: BSD-3-Clause -``` +
+  BIP: 349
+  Layer: Consensus (soft fork)
+  Title: OP_INTERNALKEY
+  Author: Brandon Black 
+          Jeremy Rubin 
+  Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0349
+  Status: Draft
+  Type: Standards Track
+  Created: 2023-12-22
+  License: BSD-3-Clause
+
## Abstract From 217ae0dfa8c51a16a5d1e1b66f20c6bfb2d64147 Mon Sep 17 00:00:00 2001 From: Murch Date: Thu, 14 Nov 2024 16:28:11 -0500 Subject: [PATCH 5/5] BIP349: Set Created header to number assignment --- bip-0349.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bip-0349.md b/bip-0349.md index ade62051..acbf50ec 100644 --- a/bip-0349.md +++ b/bip-0349.md @@ -7,7 +7,7 @@ Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0349 Status: Draft Type: Standards Track - Created: 2023-12-22 + Created: 2024-11-14 License: BSD-3-Clause