BIP draft: Raw() as subscript for descriptors #1721

pull furszy wants to merge 1 commits into bitcoin:master from furszy:2024_descriptors_raw_as_subscript changing 1 files +101 −0
  1. furszy commented at 9:19 pm on December 17, 2024: member

    Allowing arbitrary hex data to be wrapped in sh(), wsh(), or even within the TREE argument of a tr(KEY, TREE) descriptor enables the representation of currently inexpressible information.

    Specifically, the absence of this feature limits the representation of non-standard redeem and witness scripts. This occurs because they can currently 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.

    This work stemmed from discussions with @sipa and @achow101 about the legacy wallet migration path, particularly while investigating migrated descriptors that lacked information about the script they were supposedly migrated from.

    Additionally, issue #24114, specifically https://github.com/bitcoin/bitcoin/issues/24114#issuecomment-1127978154, provides historical context and highlights other valid use cases enabled by this behavior change.

  2. jonatack added the label New BIP on Dec 17, 2024
  3. jonatack renamed this:
    Raw() as subscript for descriptors
    BIP draft: Raw() as subscript for descriptors
    on Dec 17, 2024
  4. furszy force-pushed on Dec 18, 2024
  5. furszy force-pushed on Dec 18, 2024
  6. in bip-0391.mediawiki:26 in 47fed6d9f0 outdated
    21+
    22+This BIP is licensed under the BSD 2-clause license.
    23+
    24+==Motivation==
    25+
    26+To ensure no information is lost during conversion to descriptors, it’s useful to wrap
    


    sipa commented at 7:36 pm on December 18, 2024:
    This seems to appear somewhat out of the blue; the reader isn’t familiar with the fact that Bitcoin Core is working on migration from pre-descriptor wallets to descriptor wallet, and I don’t think it matters if you phrase it as being able to express information that’s currently inexpressible.

    furszy commented at 10:19 pm on December 18, 2024:
    absolutely, thanks!
  7. furszy force-pushed on Dec 18, 2024
  8. furszy force-pushed on Dec 20, 2024
  9. in bip-0391.mediawiki:44 in a67af04615 outdated
    39+participating in signing a script without knowing all participants' keys, relying solely
    40+on the script structure.
    41+
    42+==Specification==
    43+
    44+Allow raw(HEX) to be accepted within the context of `sh()`, `wsh()` and `tr()` descriptors.
    


    murchandamus commented at 7:31 pm on December 20, 2024:

    I think you’re mixing up MediaWiki and Markdown. If you want to use mediawiki, you would use <tt>sh()</tt>. It’s been permitted to submit BIPs in Markdown for a while though, if you prefer that.

    0Allow raw(HEX) to be accepted within the context of <tt>sh()</tt>, <tt>wsh()</tt> and <tt>tr()</tt> descriptors.
    

    furszy commented at 10:17 pm on December 23, 2024:

    It’s been permitted to submit BIPs in Markdown for a while though, if you prefer that.

    Ok yes, that’s better. Will inline the doc to use the `` markdown syntax.

  10. furszy force-pushed on Dec 24, 2024
  11. in bip-0391.mediawiki:41 in 9c5985184f outdated
    36+Additionally, as noted [https://github.com/bitcoin/bitcoin/issues/24114#issuecomment-1127978154 here],
    37+there are other useful scenarios for this feature. For example, it allows representing
    38+in a descriptor that we lack full knowledge of all solvability paths but can still solve
    39+the output, such as a taproot tree where we know only one of its paths, or even also
    40+participating in signing a script without knowing all participants' keys, relying solely
    41+on the script structure.
    


    murchandamus commented at 6:29 pm on December 27, 2024:
    This paragraph is hard to parse, perhaps you could split the second sentence into multiple sentences.
  12. in bip-0391.mediawiki:50 in 9c5985184f outdated
    45+### For `sh()` and `wsh()` descriptors:
    46+`raw(HEX)` must represent the arbitrary script data within the provided context.
    47+This for example means that a P2SH output script (OP_HASH160 <hash160(HEX_script)> OP_EQUAL)
    48+must be created from the provided hex data when a `sh(raw(HEX))` descriptor is provided.
    49+
    50+Parallely, a P2WSH output script (OP_0 <hash160(HEX_script)>) must be created from the provided
    


    murchandamus commented at 6:30 pm on December 27, 2024:
    0Parallelly, a P2WSH output script (OP_0 <hash160(HEX_script)>) must be created from the provided
    
  13. in bip-0391.mediawiki:93 in 9c5985184f outdated
    88+* Non-hex in `rawnode`: `tr(a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd, rawnode(<complete me with a 32-bit non-hex hash>))`
    89+* `raw` in the key path `tr`: `tr(raw(asdf), pk(key))`
    90+
    91+==Backwards Compatibility==
    92+
    93+`raw()` as a subscript descriptors use the format and general operation specified in [[bip-0380.mediawiki|380]].
    


    murchandamus commented at 6:32 pm on December 27, 2024:
    0`raw()` as subscript descriptors use the format and general operation specified in [[bip-0380.mediawiki|380]].
    
  14. in bip-0391.mediawiki:10 in 9c5985184f outdated
     5+  Author: Pieter Wuille pieter@wuille.net
     6+          Matias Furszyfer mfurszy@protonmail.com
     7+  Comments-Summary: No comments yet.
     8+  Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-???
     9+  Status: Draft
    10+  Type: Informational
    


    murchandamus commented at 6:33 pm on December 27, 2024:
    0  Type: Standards Track
    
  15. in bip-0391.mediawiki:11 in 9c5985184f outdated
     6+          Matias Furszyfer mfurszy@protonmail.com
     7+  Comments-Summary: No comments yet.
     8+  Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-???
     9+  Status: Draft
    10+  Type: Informational
    11+  Created: 2024-12-16
    


    murchandamus commented at 6:35 pm on December 27, 2024:

    The Created Header stores the date a BIP was assigned a number:

    0  Created: ?
    
  16. in bip-0391.mediawiki:6 in 9c5985184f outdated
    0@@ -0,0 +1,98 @@
    1+<pre>
    2+  BIP: ???
    3+  Layer: Applications
    4+  Title: raw() as subscript in Output Script Descriptors
    5+  Author: Pieter Wuille pieter@wuille.net
    6+          Matias Furszyfer mfurszy@protonmail.com
    


    murchandamus commented at 6:36 pm on December 27, 2024:
    0  Author: Pieter Wuille <pieter@wuille.net>
    1          Matias Furszyfer <mfurszy@protonmail.com>
    
  17. murchandamus commented at 6:37 pm on December 27, 2024: contributor
    Could maybe use a bit more rationale. Has this already been submitted to the mailing list?
  18. furszy force-pushed on Dec 27, 2024
  19. furszy force-pushed on Dec 27, 2024
  20. Raw() as subscript for descriptors 3197eb9b27
  21. furszy force-pushed on Dec 27, 2024
  22. furszy commented at 8:51 pm on December 27, 2024: member

    Has this already been submitted to the mailing list?

    Not yet. Will do next year.

  23. in bip-raw-as-subscript.md:38 in 3197eb9b27
    33+to preserve the actual script.
    34+
    35+Additionally, as noted [here](https://github.com/bitcoin/bitcoin/issues/24114#issuecomment-1127978154),
    36+there are other useful scenarios for this feature. For example, it allows representing
    37+in a descriptor that we lack complete knowledge of all solvability paths but can still
    38+solve the output. This includes cases like a taproot tree where we know only one of its
    


    ismaelsadeeq commented at 8:02 pm on January 22, 2025:
    This is a bit unclear for me, can you clarify what do you mean by can still solve the output?
  24. in bip-raw-as-subscript.md:64 in 3197eb9b27
    59+#### `raw(HEX)`:
    60+Defines a tree leaf containing the specified script in hex.
    61+Note: The leaf version must be internally fixed at the existing `0xC0` to prevent introducing
    62+unsupported or undefined functionality.
    63+If a different version is required for any use case, a new BIP could introduce `raw(HEX, VERSION)`
    64+in the future.
    


    ismaelsadeeq commented at 8:13 pm on January 22, 2025:
    I think we should just support raw(HEX, VERSION) and be forward compatible which goes in line with what was suggested in the https://github.com/bitcoin/bitcoin/issues/24114
  25. murchandamus added the label PR Author action required on Feb 6, 2025
  26. achow101 commented at 5:06 pm on February 28, 2025: member
    Concept ACK I guess
  27. murchandamus commented at 10:06 pm on June 20, 2025: contributor
    Hey @furszy, has this been presented to the mailing list? Did you see @ismaelsadeeq’s review?
  28. jonatack commented at 10:59 pm on July 23, 2025: member
    Hi @furszy, are you still working on this BIP draft?
  29. furszy commented at 1:23 am on July 24, 2025: member
    Sorry for the delay. I started writing some updates a while ago but haven’t had enough time to finish them. Unfortunately, I won’t have time over the next two months either. The idea was also to check https://github.com/bitcoin/bitcoin/pull/30243 so we could align some concepts, but that’s still buried in my work queue as well. No problem at all if you want to close it so someone else can take over. I can always pick it up again later.
  30. murchandamus commented at 5:13 pm on July 24, 2025: contributor
    Given that there hasn’t been too much activity in this PR so far, I’m gonna close it for now. Please feel free to ask to have it reopened in the future or to open another PR after it has been discussed on the mailing list and is gaining a bit of momentum.
  31. murchandamus closed this on Jul 24, 2025


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-09-13 11:10 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me