bitcoin/bitcoin — Issue #920: dumpprivkey incorrect for compressed keys
Author: coretechs
Created: 2012-03-08 04:17:25+00:00
State: open

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 import 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.