Bitcoin Forum
November 09, 2024, 04:05:53 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: (bug?) addresses in wallet for which the private keys are not known.  (Read 1358 times)
gurcani (OP)
Full Member
***
Offline Offline

Activity: 167
Merit: 100


View Profile
April 17, 2013, 07:46:18 AM
 #1

I was using bitcoind 0.8.1, on a wallet.dat that was generated long time ago (probably version 0.3.22).

here is what happens:

Code:
./bitcoin-0.8.1-linux/bin/64/bitcoind getaddressesbyaccount ""
[
    "1Ev4hNhx7XKNyEi9oavr2KGYyd5QJZEpNX",
    "19CCQtViGYfBBhG8v7KcjWHu1McdgNRVhg",
    "16TkF8gpEdbt3vJufBJ6mRoThiaxnVRPvM",
    "1GSanrUFN84tDre3RZepZ3r5PU4JLirE6a",
....
]

Code:
./bitcoin-0.8.1-linux/bin/64/bitcoind dumpprivkey 1Ev4hNhx7XKNyEi9oavr2KGYyd5QJZEpNX
error: {"code":-4,"message":"Private key for address 1Ev4hNhx7XKNyEi9oavr2KGYyd5QJZEpNX is not known"}

however if I try the second address:

Code:
./bitcoin-0.8.1-linux/bin/64/bitcoind dumpprivkey 19CCQtViGYfBBhG8v7KcjWHu1McdgNRVhg
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

it spits out a private key. Similarly the 3rd address works, but the 4th one gives the same error above.

So in other words, in my wallet.dat there are some addresses to which I do not have the private keys. I noticed this when I sent 10 btcs to the address that starts with 1Ev, and could not see the transaction. Well basically, if I understand this right I do not own this address, right?

So why in the hell "getaddressesbyaccount" tells me that I do? Is this a bug? a feature that I misunderstand?

would appreciate any help.
jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
April 17, 2013, 08:37:01 AM
 #2

You can try pywallet to see what is inside your wallet

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
memvola
Hero Member
*****
Offline Offline

Activity: 938
Merit: 1002


View Profile
April 17, 2013, 08:58:04 AM
 #3

Yep, if you can't access the keys in the old file with pywallet --dumpwallet then it's more likely that the wallet is damaged.

If the keys are there but 0.8.1 is causing the problem, you could try bitcoind -upgradewallet and maybe bitcoind -salvagewallet.

(I also wonder whether bdb incompatibility could be the culprit there.)
jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
April 17, 2013, 10:01:47 AM
Last edit: April 17, 2013, 11:08:22 PM by jackjack
 #4

I don't think so, I had a 0.3.24 wallet that worked fine once upgraded to 0.8.1

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
gurcani (OP)
Full Member
***
Offline Offline

Activity: 167
Merit: 100


View Profile
April 17, 2013, 10:44:42 PM
 #5


thanks for your help guys,

Unfortunately my wallet was apparently messed up even though I didn't do anything strange apart from using an old wallet file.

Here is what happened to my understanding:

I apparently sent 0.03419 to the address 1Ev4hNhx7XKNyEi9oavr2KGYyd5QJZEpNX from my wallet in 1 nov 2011. Here is the transaction:

http://blockexplorer.com/tx/738d4bb8031d71dd37bd13277f52bd92cdcd94932277294f9ad38685d812978b

I have the private keys for both of the other addresses involved in this transaction. The destination address 1Ev.. may actually belong to bitcointorrentz (looking at the amount and my usage at the time).

Since the database format is changed several times (0.4->0.6->0.8 ), some of the addresses to which I sent btcs are mixed with my own addresses and "getaddressesbyaccount" somehow reports these as if they were mine. But of course I don't have the private keys for them.

I have a back up of this wallet.dat. I will open the backup using 0.7.1 to see if getaddressesbyaccount still lists those addresses. Because if it doesn't, it means that it is somehow the 0.6->0.8 step that has corrupted my wallet. I can hopefully reduce it to an empty wallet with just the addresses involved in this transaction and run it on 0.8.1 again and see if I can reproduce the corruption.

I'll post my progress.
gurcani (OP)
Full Member
***
Offline Offline

Activity: 167
Merit: 100


View Profile
April 17, 2013, 11:13:36 PM
 #6

the same behaviour with 0.7.1 with the backup wallet (which was never opened on 0.8.1). So the wallet was already messed up.
memvola
Hero Member
*****
Offline Offline

Activity: 938
Merit: 1002


View Profile
April 18, 2013, 09:18:34 AM
 #7

the wallet was already messed up.

Not so sure. Assuming pywallet dump listed the keys correctly (only in "names"), then this can still be a bug in bitcoind.

Also, when were "watch only" addresses introduced in Satoshi client? If there isn't a way to distinguish foreign addresses in a simple getaddressesbyaccount, I would consider that a bug too.
gurcani (OP)
Full Member
***
Offline Offline

Activity: 167
Merit: 100


View Profile
April 18, 2013, 09:09:35 PM
 #8


in the end, if bitcoind accepts to use a possibly corrupted wallet without warning, I think it would make a lot of sense that "getaddressesbyaccount" list only the addresses for which the wallet contains a private key (i.e. by explicitly checking for that before listing the addresses).

I am not sure if the opposite behaviour would ever be desirable.

then this can still be a bug in bitcoind.

It is a feature, in the M$ sense.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!