5

I'm trying to play around with miniscript and import them into Bitcoin Core v24.0.1. I created the following descriptor in https://miniscript.fun and tried to validate it in Bitcoin Core

bitcoin-cli getdescriptorinfo "wsh(thresh(2,nl:older(12960),s:pk(038b4059419fe3b95acdee6aff2f9afdca87231d14bd2cbcd3367b11d9d819a71d),s:pk([c893176c/48'/0'/0'/2']xpub6EpqBFyJW2qiEmgcYZqwEGCRuQh3y9fY72RWeAG7pNvKJWgnx7mkviWtfsF7VNQhWPx43zzNfkWhoF8RcnP2KKsXbNHrFNdzx8MFy83N5Sq/0/*)))#925wgae2"

However, I get the following error:

A function is needed within P2WSH

Where did I go wrong?

Thanks!

Murch
  • 71,155
  • 33
  • 180
  • 600
francois
  • 103
  • 5

1 Answers1

5

Your descriptor (including the Miniscript) is valid. I think you are getting this error because you used an xpub (mainnet encoding of an extended public key) on a testnet node.

On a mainnet node:

$ bitcoin-cli getdescriptorinfo "wsh(thresh(2,nl:older(12960),s:pk(038b4059419fe3b95acdee6aff2f9afdca87231d14bd2cbcd3367b11d9d819a71d),s:pk([c893176c/48'/0'/0'/2']xpub6EpqBFyJW2qiEmgcYZqwEGCRuQh3y9fY72RWeAG7pNvKJWgnx7mkviWtfsF7VNQhWPx43zzNfkWhoF8RcnP2KKsXbNHrFNdzx8MFy83N5Sq/0/*)))#925wgae2"
{
  "descriptor": "wsh(thresh(2,nl:older(12960),s:pk(038b4059419fe3b95acdee6aff2f9afdca87231d14bd2cbcd3367b11d9d819a71d),s:pk([c893176c/48'/0'/0'/2']xpub6EpqBFyJW2qiEmgcYZqwEGCRuQh3y9fY72RWeAG7pNvKJWgnx7mkviWtfsF7VNQhWPx43zzNfkWhoF8RcnP2KKsXbNHrFNdzx8MFy83N5Sq/0/*)))#925wgae2",
  "checksum": "925wgae2",
  "isrange": true,
  "issolvable": false,
  "hasprivatekeys": false
}

On a regtest node (converting the xpub to a tpub):

$ bitcoin-cli -regtest getdescriptorinfo "wsh(thresh(2,nl:older(12960),s:pk(038b4059419fe3b95acdee6aff2f9afdca87231d14bd2cbcd3367b11d9d819a71d),s:pk([c893176c/48'/0'/0'/2']tpubDFCThVnzDJoAWZsTzkq2SBXoEXnhxYAbef1oziKGAHgD3oMW2Lcr5ABiuuKu1sMwJJUxfaWFCrLkVRd31eEGCmKpey39vuJEY5wfj84sNhm/0/*)))#qxjqansp"
{
  "descriptor": "wsh(thresh(2,nl:older(12960),s:pk(038b4059419fe3b95acdee6aff2f9afdca87231d14bd2cbcd3367b11d9d819a71d),s:pk([c893176c/48'/0'/0'/2']tpubDFCThVnzDJoAWZsTzkq2SBXoEXnhxYAbef1oziKGAHgD3oMW2Lcr5ABiuuKu1sMwJJUxfaWFCrLkVRd31eEGCmKpey39vuJEY5wfj84sNhm/0/*)))#qxjqansp",
  "checksum": "qxjqansp",
  "isrange": true,
  "issolvable": false,
  "hasprivatekeys": false
}
Antoine Poinsot
  • 5,881
  • 2
  • 11
  • 28