diff --git a/bip-0391.mediawiki b/bip-0391.mediawiki new file mode 100644 index 0000000000..7af8ed14f7 --- /dev/null +++ b/bip-0391.mediawiki @@ -0,0 +1,76 @@ +
+ BIP: ??? + Layer: Applications + Title: raw() as subscript in Output Script Descriptors + Author: Matias Furszyfer mfurszy@protonmail.com + Comments-Summary: No comments yet. + Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-??? + Status: Draft + Type: Informational + Created: 2024-12-16 + License: BSD-2-Clause ++ +==Abstract== + +This document specifies raw() as subscript for output script descriptors. +raw() encapsulates a raw hex script. This BIP allows raw() to be used in +the context of other descriptors. + +==Copyright== + +This BIP is licensed under the BSD 2-clause license. + +==Motivation== + +To ensure no information is lost during conversion to descriptors, it’s useful to wrap +arbitrary hex data in a sh(), wsh(), or even within the TREE argument of a tr(KEY, TREE) +descriptor. + +The absence of this feature creates a challenge in representing non-standard redeem and +witness scripts within the descriptor language. Currently, they can only be represented +as top-level raw(HEX) descriptors, which retain only the output script information and +lack the ability to preserve the actual script. + +Additionally, as noted [here](https://github.com/bitcoin/bitcoin/issues/24114#issuecomment-1127978154), +there are other useful scenarios for this feature. For example, it allows representing +in a descriptor that we lack full knowledge of all solvability paths but can still solve +the output, such as a taproot tree where we know only one of its paths, or even also +participating in signing a script without knowing all participants' keys, relying solely +on the script structure. + +==Specification== + +Allow raw(HEX) to be accepted within the context of sh(), wsh() and tr() descriptors. +The output script produced by this descriptor must represent the arbitrary data within +the provided context. For example, a P2SH output script (OP_HASH160