2

I am using Bitcoin Core bitcoin-cli with getdescriptorinfo like so:

curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getdescriptorinfo", "params":["sh(multi(2,[3c60330a/1]03061b79f20d49790c15bdaf15ec8db6d75275f62f04a56eaac31f5c2db48736fc,[d54e4481/1]0396bd8d30f0128dcc67e143cf46efd686bf9e4dc8587facc07f81bb248d1b0209,[1e132a06/1]03c77aa842edc8af76b76f5c29a1133b45b78c8c26a170090184e500232abd15a4))#3qpdv9la"] }' -H 'content-type: text/plain;' http://bitcoin:[email protected]:18332/

But it returns Invalid descriptor (code -5)

What am I doing wrong?

1
  • 2
    If you are willing to compile Bitcoin Core from source, there is a change in the current master branch that will return more specific errors about descriptors (github.com/bitcoin/bitcoin/pull/16542). This change will be available in 0.19.
    – Andrew Chow
    Sep 28, 2019 at 16:29

1 Answer 1

1

Descriptors in Bitcoin Core can have a suffixed checksum.

sh(multi(2,
[3c60330a/1]03061b79f20d49790c15bdaf15ec8db6d75275f62f04a56eaac31f5c2db48736fc,
[d54e4481/1]0396bd8d30f0128dcc67e143cf46efd686bf9e4dc8587facc07f81bb248d1b0209,
[1e132a06/1]03c77aa842edc8af76b76f5c29a1133b45b78c8c26a170090184e500232abd15a4))
#3qpdv9la

You pass the checksum 3qpdv9la. However if I call getdescriptorinfo without the checksum (see below) a checksum of 539k404m is calculated for that descriptor.

bitcoin-cli getdescriptorinfo "sh(multi(2,[3c60330a/1]03061b79f20d49790c15bdaf15ec8db6d75275f62f04a56eaac31f5c2db48736fc,[d54e4481/1]0396bd8d30f0128dcc67e143cf46efd686bf9e4dc8587facc07f81bb248d1b0209,[1e132a06/1]03c77aa842edc8af76b76f5c29a1133b45b78c8c26a170090184e500232abd15a4))"
{
  "descriptor": "sh(multi(2,[3c60330a/1]03061b79f20d49790c15bdaf15ec8db6d75275f62f04a56eaac31f5c2db48736fc,[d54e4481/1]0396bd8d30f0128dcc67e143cf46efd686bf9e4dc8587facc07f81bb248d1b0209,[1e132a06/1]03c77aa842edc8af76b76f5c29a1133b45b78c8c26a170090184e500232abd15a4))#539k404m",
  "isrange": false,
  "issolvable": true,
  "hasprivatekeys": false
}

Invalid descriptor (code -5) is returned, because your descriptor doesn't match the checksum you provide.

Did you enter the descriptor by hand (i.e. not copy pasting)? Where did you get the descriptor from?

3
  • The descriptor came from the json result Bitcoin Core returned when calling bitcoin-cli getaddressinfo, I will try and replicate the whole process and edit the OP.
    – Fontaine
    Sep 28, 2019 at 12:50
  • would a descriptor in regtest create a different checksum then a descriptor in testnet or mainnet? Maybe that is it.
    – Fontaine
    Sep 28, 2019 at 12:59
  • 2
    The xpub/xprv and address format used inside descriptors is network dependent. Jul 21, 2021 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.