dumpprivkey incorrect for compressed keys #920

issue coretechs opened this issue on March 8, 2012
  1. coretechs commented at 4:17 AM on March 8, 2012: none

    bitcoind 0.6rc2 x86_64 / Mint 11

    I tried using dumpprivkey a few times with a fresh wallet. It doesn't look like the output is in SIPA format and it doesn't appear to be valid. I tried using bitaddress.org and strongcoin.com to check the keys without success.

    ./bitcoind getnewaddress 1A3w7WXZZJM6NnxjeYvDzs1ALGPKw9vRfJ

    ./bitcoind validateaddress 1A3w7WXZZJM6NnxjeYvDzs1ALGPKw9vRfJ { "isvalid" : true, "address" : "1A3w7WXZZJM6NnxjeYvDzs1ALGPKw9vRfJ", "ismine" : true, "pubkey" : "02c1667101bc8cfe77a65abd7111a48ab12df1f6b98bc484ad8c7ff9fed7ba8a5b", "iscompressed" : true, "account" : "" }

    ./bitcoind dumpprivkey 1A3w7WXZZJM6NnxjeYvDzs1ALGPKw9vRfJ L3ckYBFd7SbajDQjzB85UELZ1ume3pL67izJ5bTiXqSV4nSHJr7G

    However, if I first try to import a key, the address is correct and the dumpprivkey appears to work properly:

    ./bitcoind importprivkey 5JfaKXtKwjPDGwL2FiT9DjjU11Mswu4mFNjYch3WzEDkfC9EoCL "test"

    ./bitcoind getaddressesbyaccount "test" [ "1EH2ySiTkv82LPDL2KckwVAhtiALyJBHQx" ]

    ./bitcoind validateaddress 1EH2ySiTkv82LPDL2KckwVAhtiALyJBHQx { "isvalid" : true, "address" : "1EH2ySiTkv82LPDL2KckwVAhtiALyJBHQx", "ismine" : true, "pubkey" : "04cbc2b092bedcebe164b7c0915e95d54f6689449466d4dcd24bf600895bc99378167edbdd3a8f3de40625aa4cf91a093bbb2b4a9a0703d2885ee9a7c91762e31e", "iscompressed" : false, "account" : "test" }

    ./bitcoind dumpprivkey 1EH2ySiTkv82LPDL2KckwVAhtiALyJBHQx 5JfaKXtKwjPDGwL2FiT9DjjU11Mswu4mFNjYch3WzEDkfC9EoCL

    This suggests the problem is related to the compressed key format.

  2. sipa commented at 4:43 AM on March 8, 2012: member

    The 'sipa' format (what an honor...), was extended (by me) to support compressed public keys. I wrote about it here: http://sourceforge.net/mailarchive/forum.php?thread_name=CAPg%2BsBhDFCjAn1tRRQhaudtqwsh4vcVbxzm%2BAA2OuFxN71fwUA%40mail.gmail.com&forum_name=bitcoin-development

  3. coretechs closed this on Mar 8, 2012

  4. suprnurd referenced this in commit a4d012069a on Dec 5, 2017
  5. suprnurd referenced this in commit 36c28fad1b on Dec 5, 2017
  6. lateminer referenced this in commit a56cc2948d on Oct 30, 2019
  7. bitcoin 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-05-20 06:56 UTC