Private key import via RPC importdescriptors shouldn’t fail with the error code -5, “Missing checksum” #27075

issue GregTonoski openend this issue on February 10, 2023
  1. GregTonoski commented at 4:18 pm on February 10, 2023: none

    Expected behavior

    Descriptor is imported successfully.

    Actual behavior

    Descriptor is not imported. There is the error:

    0[
    1  {
    2    "success": false,
    3    "error": {
    4      "code": -5,
    5      "message": "Missing checksum"
    6    }
    7  }
    8]
    

    To reproduce

    1. Execute the RPC command, e.g.: importdescriptors '[{"desc": "tr(cUTFbLPUaBAPmTKwjcDs4rWHUSEUbUBfkPMogrbTmQFnJA3vgrLE)", "timestamp": "now"}]'

    System information

    Bitcoin Core 24.0.1

    Excerpt from the BIP-380 specification:

    The top level expression is a SCRIPT. This expression may be followed by #CHECKSUM, where CHECKSUM is an 8 character alphanumeric descriptor checksum.

  2. GregTonoski added the label Bug on Feb 10, 2023
  3. achow101 commented at 4:25 pm on February 10, 2023: member
    This is intended behavior. While a descriptor in general may have a checksum, descriptors being imported must have a checksum in order to ensure that the user did not make a typo or other transcription error.
  4. achow101 closed this on Feb 10, 2023

  5. kristapsk commented at 4:27 pm on February 10, 2023: contributor
    You can compute checksum and get descriptor with checksum added with bitcoin-cli getdescriptorinfo.
  6. GregTonoski commented at 4:53 pm on February 10, 2023: none

    This is intended behavior. (…) descriptors being imported must have a checksum in order to ensure that the user did not make a typo or other transcription error.

    The implemented behaviour is against the specified one. Presumably, the BIP-380 specifies the inteded behaviour.

    Besides, there already is “typo or other transcription error” prevention checksum (base58check) in the input string in the example.

  7. achow101 commented at 5:01 pm on February 10, 2023: member

    The implemented behaviour is against the specified one. Presumably, the BIP-380 specifies the inteded behaviour.

    The intended behavior is for parsers (e.g. getdescriptorinfo). importdescriptors is applying additional rules on top of the parser.

    Besides, there already is “typo or other transcription error” prevention checksum (base58check) in the input string in the example.

    Not always, and not everything. Hex pubkeys are checksumless, and the checsums for WIF keys and extended keys do not cover all parts of the descriptor. They can miss important things such as multisig thresholds. Furthermore, with miniscript, there are many parts of the descriptor that are only covered by the descriptor checksum.

  8. GregTonoski commented at 5:23 pm on February 10, 2023: none
    Disagree. I think that the issue is still open.
  9. achow101 commented at 5:57 pm on February 10, 2023: member

    Perhaps the BIP text could be updated to clarify, but this is intended behavior for the RPC, so there’s no issue here. See #15368.

    Considering that I an a co-author of BIP 380 and the original implementer of importdescriptors, I would say that I know exactly what was intended behavior for both.

  10. GregTonoski commented at 7:53 pm on February 10, 2023: none

    Perhaps the BIP text could be updated to clarify, but this is intended behavior for the RPC, so there’s no issue here. See #15368.

    Considering that I an a co-author of BIP 380 and the original implementer of importdescriptors, I would say that I know exactly what was intended behavior for both.

    Changes are not impossible. Another checksum on top of base58check seems to be redundant and degrades user expierence in the case of importing a private key, doesn’t it?

  11. achow101 commented at 8:19 pm on February 10, 2023: member

    Changes are not impossible. Another checksum on top of base58check seems to be redundant and degrades user expierence in the case of importing a private key, doesn’t it?

    No, it is not redundant. There are more to descriptors than just private keys. The checksum is also a better checksum since it is error finding too, although that is not implemented yet.

  12. GregTonoski renamed this:
    RPC importdescriptors shouldn't fail with the error code -5, "Missing checksum"
    Private key import via RPC importdescriptors shouldn't fail with the error code -5, "Missing checksum"
    on Feb 10, 2023
  13. bitcoin locked this on Feb 10, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-03 15:12 UTC

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