Skip to content

Miniscript support for decodescript #25606

Closed

Description

@Sjors

Current behavior:

src/bitcoin-cli -signet decodescript 2103d3b9c8cc852f3b4a06bad1711fd1a1761a592bf1475edc0a5f97b31759eba330ac736476a914b6e87320e876a740fc1365aeb1f4b6ab2fe4210b88ad53b268
{
  "asm": "03d3b9c8cc852f3b4a06bad1711fd1a1761a592bf1475edc0a5f97b31759eba330 OP_CHECKSIG OP_IFDUP OP_NOTIF OP_DUP OP_HASH160 b6e87320e876a740fc1365aeb1f4b6ab2fe4210b OP_EQUALVERIFY OP_CHECKSIGVERIFY 3 OP_CHECKSEQUENCEVERIFY OP_ENDIF",
  "desc": "raw(2103d3b9c8cc852f3b4a06bad1711fd1a1761a592bf1475edc0a5f97b31759eba330ac736476a914b6e87320e876a740fc1365aeb1f4b6ab2fe4210b88ad53b268)#uul8nd2t",
  "type": "nonstandard",
  "p2sh": "2N62ryy2gBC2QBSdsm832Tv6qCW5py53wJn",
  "segwit": {
    "asm": "0 43c1d0387e91045591f19ff6d60af2bc0d91473b79dc3238aa9d0430f89741bc",
    "desc": "addr(tb1qg0qaqwr7jyz9ty03nlmdvzhjhsxez3em08wryw92n5zrp7yhgx7qj56vra)#ugngfnm5",
    "hex": "002043c1d0387e91045591f19ff6d60af2bc0d91473b79dc3238aa9d0430f89741bc",
    "address": "tb1qg0qaqwr7jyz9ty03nlmdvzhjhsxez3em08wryw92n5zrp7yhgx7qj56vra",
    "type": "witness_v0_scripthash",
    "p2sh-segwit": "2N9diLEHbASsz1oAeDQJPg5mb4LaAju9175"
  }
}

It would be nice if this (also) returned miniscript.

Perhaps getaddressinfo could do this as well (after #24148).

cc @sipa, @darosior

Activity

  1. darosior commented on Jul 13, 2022

    @darosior
    Member

    After #24148 i think it should be the default behaviour to show a Miniscript descriptor (for the "desc" field) if one could be parsed: InferDescriptor would try parsing a Miniscript under P2WSH context (as in your example). EDIT: InferDescriptor is using a dummy sig provider so it wouldn't work, see #27007 (comment).

    However, note your Script here would not be parsed because the Miniscript parser is not passed the preimage to the key hash for OP_DUP OP_HASH160 b6e87320e876a740fc1365aeb1f4b6ab2fe4210b OP_EQUALVERIFY OP_CHECKSIGVERIFY. So i'd say it's the best we can reasonably do.

  2. instagibbs commented on Jan 31, 2023

    @instagibbs
    Member

    hmm seems I opened up a mostly similar issue in #27007

  3. locked and limited conversation to collaborators on Feb 3, 2024
  4. added a commit that references this issue on Mar 4, 2024
  5. added a commit that references this issue on Jun 28, 2026
  6. added a commit that references this issue on Jun 30, 2026
  7. added a commit that references this issue on Aug 19, 2026
  8. added a commit that references this issue on Sep 18, 2026
  9. added a commit that references this issue on Oct 4, 2026
  10. added a commit that references this issue on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions