walletdump generates WIF strings that contradict documentation #12660

issue GSPP opened this issue on March 10, 2018
  1. GSPP commented at 11:07 AM on March 10, 2018: none

    walletdump generated the following slightly redacted line:

    KwntAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 2000-01-01T00:00:00Z label= # addr=1L...

    This base58check string results in 34 bytes (checkable using http://gobittest.appspot.com/PrivateKey). The first byte is documented to be 0x80 so the rest is 33 bytes long. Private keys are always 32 bytes.

    What does this mean? How to obtain the private key?

  2. fanquake added the label RPC/REST/ZMQ on Mar 10, 2018
  3. meshcollider commented at 7:35 AM on March 11, 2018: contributor

    Notice that the private key begins with a K. That means it is a key for a compressed public key, and as per the wiki documentation you linked, the key should have 0x80 prepended to it and 0x01 appended to it. That's an extra 2 bytes, not just 1. Please see here for how to convert between the WIF format and the private key, and in future please use bitcoin.stackexchange.com for support/usage questions rather than GitHub

  4. meshcollider closed this on Mar 11, 2018

  5. GSPP commented at 1:05 PM on March 11, 2018: none

    I missed that 0x01 statement in the documentation. Thanks for clarifying. I was under the impression that this was a bug (at least a documentation but) which is why I filed it here.

  6. DrahtBot locked this on Sep 8, 2021
Contributors

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: 2026-04-13 15:15 UTC

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