Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: Kazu on September 01, 2013, 07:06:18 PM



Title: PYWallet Help - Dumping encrypted private key
Post by: Kazu on September 01, 2013, 07:06:18 PM
Sorry if this is a dumb question which makes me look like an idiot, but I have been unable to extract the private keys from the wallet.dat file. I've been trying to use pywallet.py, but each time I do, I get the following:

        {
            "addr": "1ktfy4LrHRQ2bmLauCdstbgGJEpPa8Qm6",
            "n": 101,
            "nTime": 1378059316,
            "nVersion": 80300,
            "public_key_hex": "03e9795fcadcba658da6550517bc239c8bcd86d00741c527533ffb22ac4474eb2c"
        }

There is no privkey section. When I try to go through the web interface to do keydump, I get "File not written". In fact all I can get to work is wallet dump. All of the other commands cause errors.

Any idea what might be causing this?


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: jackjack on September 01, 2013, 07:08:48 PM
This chunk comes from the "pool" part of the dump
There must be another occurence of "1ktfy4LrHRQ2bmLauCdstbgGJEpPa8Qm6" in the dump

Do you use the correct syntax for the keydump?


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: Kazu on September 01, 2013, 07:38:36 PM
Figured out problem, I was specifying a different wallet file, but for some reason (???) it was failing to open that file, so (I think?) it defaulted back to the normal wallet.dat file, and since my own wallet.dat file is significantly weird I managed to confuse myself. It appears to have just been a fancy permissions problem. Fixed now, sorry to waste your time.


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: Kazu on September 01, 2013, 07:53:22 PM
EDIT: No, not a permissions problem. For some reason it refuses to use any wallet but my own. Can that error also happen because of a corrupted wallet or something? Here's what i'm getting, now that I've made the target file the wallet.dat file:

Quote
> pywallet.py --walletdump
WARNING:root:pycropto or libssl not found decryption may be slow
`ecdsa` package is not installed, pywallet won't be able to sign verify messages.

ERROR:root:Couldn't open wallet.dat/main. Try quitting Bitcoin and running this again.

Bitcoin isn't running. I have full 777 permissions in that directory. If I rename wallet.dat to otherwallet.dat, and then run Bitcoin (to generate new wallet.dat file), then stop Bitcoin, then execute the exact same command, then it will work. Does this indicate a corrupted wallet.dat file?

Also, you may want to tell the user something before changing his wallet selection. When I went pywallet.py --walletdump --wallet=otherwallet.dat (the file I then renamed to wallet.dat) it just walletdumped wallet.dat because it couldn't read otherwallet.dat or something. That managed to confuse me a bit.


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: jackjack on September 01, 2013, 08:06:54 PM
Bitcoin isn't running. I have full 777 permissions in that directory. If I rename wallet.dat to otherwallet.dat, and then run Bitcoin (to generate new wallet.dat file), then stop Bitcoin, then execute the exact same command, then it will work. Does this indicate a corrupted wallet.dat file?
Likely, try the wallet recovery feature on this corrupted file

Also, you may want to tell the user something before changing his wallet selection. When I went pywallet.py --walletdump --wallet=otherwallet.dat (the file I then renamed to wallet.dat) it just walletdumped wallet.dat because it couldn't read otherwallet.dat or something. That managed to confuse me a bit.
This is REALLY odd
This is not an expected behavior, nor something I ever heard...
Are you sure this is what is happening?
No symlinks?


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: Kazu on September 01, 2013, 08:46:51 PM
Bitcoin isn't running. I have full 777 permissions in that directory. If I rename wallet.dat to otherwallet.dat, and then run Bitcoin (to generate new wallet.dat file), then stop Bitcoin, then execute the exact same command, then it will work. Does this indicate a corrupted wallet.dat file?
Likely, try the wallet recovery feature on this corrupted file
would it also be possible that the file isn't matching something else contained in my Bitcoin data directory? I noticed that your program is reading the DB files and you should probably know that the wallet.dat file is not my own, its someone else's that I just plopped down into my data directory.

Quote
Also, you may want to tell the user something before changing his wallet selection. When I went pywallet.py --walletdump --wallet=otherwallet.dat (the file I then renamed to wallet.dat) it just walletdumped wallet.dat because it couldn't read otherwallet.dat or something. That managed to confuse me a bit.
This is REALLY odd
This is not an expected behavior, nor something I ever heard...
Are you sure this is what is happening?
No symlinks?

[/quote]
I have no idea. There is a symlink, so I didn't have to put in the datadir param. But if I do the same thing setting datadir to go "around" the symlink, same thing is happening.


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: jackjack on September 01, 2013, 09:02:09 PM
Bitcoin isn't running. I have full 777 permissions in that directory. If I rename wallet.dat to otherwallet.dat, and then run Bitcoin (to generate new wallet.dat file), then stop Bitcoin, then execute the exact same command, then it will work. Does this indicate a corrupted wallet.dat file?
Likely, try the wallet recovery feature on this corrupted file
would it also be possible that the file isn't matching something else contained in my Bitcoin data directory? I noticed that your program is reading the DB files and you should probably know that the wallet.dat file is not my own, its someone else's that I just plopped down into my data directory.
What DB files are you talking about? It should only read wallet.dat

Quote
Also, you may want to tell the user something before changing his wallet selection. When I went pywallet.py --walletdump --wallet=otherwallet.dat (the file I then renamed to wallet.dat) it just walletdumped wallet.dat because it couldn't read otherwallet.dat or something. That managed to confuse me a bit.
This is REALLY odd
This is not an expected behavior, nor something I ever heard...
Are you sure this is what is happening?
No symlinks?

I have no idea. There is a symlink, so I didn't have to put in the datadir param. But if I do the same thing setting datadir to go "around" the symlink, same thing is happening.
Ok... I don't see what can happen here
Would you mind sending me the corrupt wallet.dat (it's encrypted, right?) so that I can see what I can do on my side?


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: simpic on September 03, 2013, 02:38:21 PM
Hello,
I can't dump keys. I installed pywallet but when I click on "Dump Keys" (on web page) i get "File not written" error.
Maybe it happens because .bitcoin directory is a symlink. So i tried to enter the right path, but the same error occurs.
How can i solve this?

Thank you.


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: jackjack on September 03, 2013, 02:46:00 PM
Hello,
I can't dump keys. I installed pywallet but when I click on "Dump Keys" (on web page) i get "File not written" error.
Maybe it happens because .bitcoin directory is a symlink. So i tried to enter the right path, but the same error occurs.
How can i solve this?

Thank you.

What is written in the console?


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: simpic on September 03, 2013, 03:03:46 PM
What is written in the console?

2013-09-03 17:02:43+0200 [HTTPChannel,0,127.0.0.1] Wallet Dir: /home/simpic/.bitcoin
2013-09-03 17:02:43+0200 [HTTPChannel,0,127.0.0.1] Wallet Name: wallet.dat
2013-09-03 17:02:44+0200 [HTTPChannel,0,127.0.0.1] Wallet data not recognized: {'__type__': 'orderposnext', '__value__': '\x0b\x01\x00\x00\x00\x00\x00\x00', '__key__': '\x0corderposnext'}
2013-09-03 17:02:44+0200 [HTTPChannel,0,127.0.0.1] The wallet is not encrypted


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: jackjack on September 03, 2013, 03:36:11 PM
Oh I see, I misread your post
You are trying to dump keys to a CSV, is it what you really want to do?
If not (or if in doubt), use "Dump your wallet"
If you really want to use CSV export, tell me and I'll tell you what to do


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: simpic on September 03, 2013, 06:36:41 PM
Oh I see, I misread your post
You are trying to dump keys to a CSV, is it what you really want to do?
If not (or if in doubt), use "Dump your wallet"
If you really want to use CSV export, tell me and I'll tell you what to do

I need all private keys, including those of hidden change address, for importing my balance, addresses and history to Electrum.
As i'm trying to do here (https://bitcointalk.org/index.php?topic=260621.msg3066575#msg3066575).


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: jackjack on September 03, 2013, 06:39:41 PM
"Dump your wallet" does this and returns the result in JSON, "Dump you keys" returns a CSV file
Don't bother, just answer the following question and I'll tell you what to do:

How do you import private keys into Electrum? ie do you type the "fac86293d82838..." private key by hand?


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: simpic on September 03, 2013, 06:52:14 PM
"Dump your wallet" does this and returns the result in JSON, "Dump you keys" returns a CSV file
Don't bother, just answer the following question and I'll tell you what to do:

How do you import private keys into Electrum? ie do you type the "fac86293d82838..." private key by hand?

I just click on Import -> Private Keys. Am i wrong?


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: jackjack on September 03, 2013, 07:08:18 PM
"Dump your wallet" does this and returns the result in JSON, "Dump you keys" returns a CSV file
Don't bother, just answer the following question and I'll tell you what to do:

How do you import private keys into Electrum? ie do you type the "fac86293d82838..." private key by hand?

I just click on Import -> Private Keys. Am i wrong?
I don't know Electrum at all, that's why I'm asking

We'll do something different actually: close the pywallet you're currently running
Then run this:
Code:
python pywallet.py --dumpwallet --dumpwithbalance --datadir=/path/to/wallet --wallet=wallet.dat
(change /path/to/wallet and wallet.dat to the correct values of course)

This will take a few minutes, but after this it will print all the keys that were in your wallet along with their balance
Thanks to this you'll be able to check which addresses have funds


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: simpic on September 03, 2013, 07:19:03 PM
I get a huge amount of string like this:

                    "scriptPubKey": "76a91474add11bbac1a5818aa3f64dc3f7bc8cc931a09f88ac",
                    "value": 6.4e-05

So now? Why i can't use the web utility as that user explained in the other topic?


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: jackjack on September 03, 2013, 07:58:39 PM
I get a huge amount of string like this:

                    "scriptPubKey": "76a91474add11bbac1a5818aa3f64dc3f7bc8cc931a09f88ac",
                    "value": 6.4e-05

So now? Why i can't use the web utility as that user explained in the other topic?
It's normal, they are all the transactions that your wallet stores

For it to be more practical, do this:
Code:
python pywallet.py --dumpwallet --dumpwithbalance --datadir=/path/to/wallet --wallet=wallet.dat > keys.txt
This put all the text in the file keys.txt
Then open keys.txt
In the beginning of the file you'll see the keys but now each one will have a "balance" parameter
Most of them will have "Never used", you can avoid to import them in Electrum
On the other hand, all the addresses that have something else than "Never used" must be imported

Example of what you'll get:
Code:
        {
            "addr": "1EuK1VCzdyGzXgk1AnJswC1Y46dCyyqyXW",
            "balance": "Never used",
            "compressed": true,
            "encrypted_privkey": "43e93c600c4e76eecbdc1311d09713234dc1c8c3e37067383f74e910afd6321f989c9a49dd73f018e76d2e0f1d759f1d",
            "pubkey": "03feb65c4b3a2f163e991803e47b28231c2b62366814c08ed816b1aa150e856fc0",
            "reserve": 1
        },
        {
            "addr": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
            "balance": "64.19778513",
            "compressed": false,
            "encrypted_privkey": "36e537b86cf0c55966ffbd776edd4e1b4922187d12b3f3bb39833d2776c97bd6cde814750e8e785d7f75a666e52234b8",
            "pubkey": "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f",
            "reserve": 0
        },


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: simpic on September 03, 2013, 11:51:10 PM
I tried to avoit "Never used" blocks but it is a very huge file.
Any parameter to avoid to write these address to the output?
In addition, why the web version doesn't work?

Anyway at the begin of the file i have this:

Quote
Wallet data not recognized: {'__type__': 'orderposnext', '__value__': '\x0b\x01\x00\x00\x00\x00\x00\x00', '__key__': '\x0corderposnext'}
The wallet is not encrypted

Does it mean anything wrong?


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: jackjack on September 04, 2013, 07:50:10 AM
I tried to avoit "Never used" blocks but it is a very huge file.
Any parameter to avoid to write these address to the output?
In addition, why the web version doesn't work?

Anyway at the begin of the file i have this:

Quote
Wallet data not recognized: {'__type__': 'orderposnext', '__value__': '\x0b\x01\x00\x00\x00\x00\x00\x00', '__key__': '\x0corderposnext'}
The wallet is not encrypted

Does it mean anything wrong?
Nope... You'll have to read them all. I'm working on changing this but don't expect it soon.
Because I didn't put the "include balance" option in the web version. I'm not sure browsers are ok to wait a page for minutes. I could try though.
No, nothing wrong.


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: simpic on September 04, 2013, 08:09:16 AM
Ok, thank you very much for your support.
Anyway in the web version even saving without balance, why it doesn't work?


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: jackjack on September 04, 2013, 08:23:09 AM
In the web version, "dump your wallet" should work without special configuration.
On the other hand, "dump your keys" (to a file) needs the format you want. For instance, if you put "addr", the output file will contain all your addresses. If you put "addr,sec", it will contain all your (address, private key) pairs.


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: simpic on September 04, 2013, 08:48:28 AM
I solved my problem with pywallet, now even the web version works, it was my fault.
In the output format i didn't insert the file name, i filled it just with the dir. Sorry...

Unfortunately i din't solve my early problem (missing transactions after importation).
In "Data to print" field i write only "sec"... so can you tell me what exactly are all the rows that i get in the output file?
Are they all private keys used by my old client? If they are, do they include even private keys of the (hidden) change addresses?

Thank you so much for the great support!


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: jackjack on September 04, 2013, 09:01:08 AM
Unfortunately i din't solve my early problem (missing transactions after importation).
In "Data to print" field i write only "sec"... so can you tell me what exactly are all the rows that i get in the output file?
Are they all private keys used by my old client? If they are, do they include even private keys of the (hidden) change addresses?
Yes and yes
That's strange that there are missing funds

I'll modify pywallet a bit to allow printing balance in the web version it will be far easier for you

Thank you so much for the great support!
No problem, I hope we'll figure that out


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: jackjack on September 04, 2013, 09:27:06 AM
Download the last version of pywallet
Dump your keys in the web version, with "Dump your balance" checked and "data to print"="addr,balance"
Then print the result here (no private keys written so it's safe)


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: simpic on September 04, 2013, 06:16:59 PM
Quote
addr;balance
1HmTexGimLGyqSkot3BE2zYecDNq3h1ENS;Never used
1DRu7YHrNxJRHo1BZgdUSc18QrWbzgLwbq;Never used
1A79YRx94bGfrhYY2nuD4tnyX5vCr7SgnG;Never used
17YpxLBusYckFcddEahfMStTTN8kVmsc2W;Never used
1HPSELd8jTSFSn15hW2KySabfiXpqz7gvq;Never used
1JSa5Hh7TV76PGPziehnMVh9y5jN7zDbVh;Never used
1FRfvh6B9mJyKTNqbY15grNMFGRd881DWk;Never used
1jWpS8oXyBPgQBRGj39Lwfq2Mi7orJ3st;Never used
14xwxsFeXYpqLy3YbFMnjHacHuV2RJRxpx;Never used
1raZJDP3KRRKK59ptGbyhfkdDLXQ1XV9V;0
14NsHsLSaEhXwxeF9Rz2TKZ5BxyjeXE7zE;Never used
15WNogAoTLqSo8kfUc3Bge2HKT3VBEKCpn;Never used
17ee4PnSsaimQcU9bYNAqiy7PFCa4snJW4;Never used
1EtDVkzj4rrYNUBxSxNHpeMdFcdXSF625a;Never used
1PxKqg5RXkhgu94kfTwpjEe4qzGj6jq7HE;Never used
1GsJsRQPaJeL46XAcqDKFHGj6REWvBBjQm;Never used
1Hoq5KyoutSfQ6tJFZEX2W8Q3mgt8Qy1mW;Never used
1PtFzD9H7aS7vtpgk6J8KXtW42SPy1tk5s;Never used
1NcBHDmCUmTAECGrwyo1Cbh7x4PKCgQsDF;Never used
1KSmFRyWbrAcxM9xD8CHKsFc81azpy36cG;Never used
14gqb6nfBXRyHA43cb4JJxkVg9i19yeutc;Never used
1HDnDZQbGaFnVAuUVDssoKm1fXYYFXs1DU;Never used
1Hpkx7nPTFJbhagkkMV2rYnsM59PtexPQP;Never used
1FX2NDMcX1hz8CNi5gvUhsKbSzWZwRqgXM;0
1PraxTCowsApMsgGCGVrDFLPF3wcPLcNJo;Never used
13BKTFVzLD7BR16yD5gUHVmeW5idvzQvvx;0.0001
1MX4w2MG7f5uYWsBfvn2WT1JbxC3cBJoo2;Never used
1A1daWdoPdGQQk5LXh1cCtXCaNeDhquVqW;Never used
1KwF7Fnh16D9bFF9NvGi8mSjSmF9vNp3sp;Never used
18HuVHgcRr6HYo4G2pooemiQv6rXyoHDam;Never used
1Nm3dT9Tfa8qWNudmHN2fBpw1AqRPdicP7;Never used
1mxtgiseTgXnWQBAgmGZKFewkDBp9ENyS;Never used
1JRvWfSffTFbR4qVaWQT664DrKZWZzdXZa;Never used
14wkHAEKXfj4kQWQprnB54Wv9BzMDXgi8D;Never used
1C6GSu7b8vbJUwksRQp1W4fVnGPZCfAUSn;Never used
13z3JdDi7NQWLYi5vNK2Bm4d8XGziCTzWz;Never used
1B2dnC4aQkpEwc6ZmGyemaNcAsfmpXpyBi;Never used
1J2Xg5wPhpMQxJydVZqyaEdwVjyssUzUGY;Never used
15viacAw39NePFevLJP5rRXxx5Rbp4KKkm;Never used
19bmYMtEcmgg47zmrUYNDh2yqfcJdRPyxR;Never used
1B3L5xD1T9ERwDLDqYhc4vcvtFfJFv3UUa;Never used
1KcNAwXCxixeLyrYigNeaGxcbqJ5B2cmEU;Never used
1D1H9hMjeXVY16hsikhXJunQSqEQH5kdkF;Never used
1GkumigTiWubGiq2hqB31TUPHg1NsU8Kko;Never used
13Ta6emmJuPcb4hg3geJsMvBT2PPr5Skmq;Never used
1BA3zGu5HvXpnZt4W2CoRSfw5kxZLgun3A;Never used
146FEsndeCDHHapkaMLJXQmkXid1R3b62i;Never used
1MAm1dnn6Nv33JmuGR9zJe8LZj1Z5HG9Ur;Never used
1EnTEy5D13HbSBsNNzMoh58toyMBn2P1yA;Never used
13K6KxDPXiKijKRDU9eyv3jF7CagFabKTD;Never used
18PppdeQNhrtvLW6Ut4PGmmJGmvR7UovG4;Never used
1APN8tALWLjo43DxFMSfg2j36jJvSVshui;Never used
1J3VmjcjD6JHizt9PRML6dF9ZtRoQxsBrr;0
1MJKAaWyaDffM6GMxm8RW7UsMGTLDa6hoj;Never used
15sXxfCuF3g9MxWMwLVqGuC4Ez6N6hLacK;Never used
17TyXSLDRso8cnv18JhWnt39Yu4zfXwT32;Never used
1Ztt1QKBCucciV3dsVpGmGRoUsDJ8VtcN;0
1DGLVi8xyoVFf3omqcH49tubqs7cfBRLBt;Never used
1pwrc552LbQJ35P6LhYi2FppomPD2zzNo;Never used
13tvCKpM4TJeYdhh5xAfvTwiDU6KHzjPEy;Never used
1JAwLyhaxjCh7XEB57bVbevZ2AMJoK48Vv;Never used
1DQUYATvVrGSVaLPFUL7rqi7Xb5rZ4m7zt;Never used
16ffjJhLUq8MPjK8VVTeut9NsvoewSUUjB;Never used
1Q9eqJBuTM8xbKrEvs4aaLfeuaAP25PwzE;Never used
1BSB4ddJ7xDk8znM2EJg7yHwwXemwvYjWu;Never used
1hmwZhEBYEjvVox2hoNMZNqz3RwqnuXqX;Never used
15p6TDKgyWFGLtPwNi6Vu7stXNPyuWK5dZ;Never used
1PF9TwLitgQAYpZsQoRgWQXUi97H3jCfUk;Never used
14nwc44xd2aGcD8eUxz27cPMCjzxVwoaaD;Never used
1BiPcCR9KdJHgwVm2nh1qWEhnQVSsZ2qbU;Never used
1Dyd8ovhuGdkKdYDEUVdmasi6ZSt1kFbwf;Never used
12mkEKXKDDgfrek3bMhpH8wmQ6dYEDD6xW;Never used
1F8ZhpfoZEG2PzjZTHAwXFoHgcmvmRUVUT;Never used
161LuWRVnitjynZuMEdyqYrTEqZE3k1L6V;Never used
1GBCQouzNWWy8NYHMDT1uX2uLRiGmrDiRC;Never used
1HBc9ayEc2kxgyCU2eJ1iWGKLgSwxcg7Wn;Never used
17cwjsGPGHk7Jq7psfP6v197zVHRUfhigH;Never used
1CbX83a11ruetS14oM2m8a5aEH8U2JdVXV;Never used
1D9tUvWc6D3ftGHfUszFmA9oGA8h4pFQJJ;Never used
1L5M7JgCdcuwDwr9nDKhnqF8dg2gqSMHZz;Never used
1MM6zHxFKbxhDgzw3MUm3U3vMqsUM8cjXN;Never used
12BCXXPVanfj4AgTdfC4HKqbkNYMFoMUzd;Never used
17pQAMDEx6FSjb8da91AX4YJwzoDiC35N5;Never used
1MEVscYAFp5LmkTDExcGhwdJnLXAbVaQjF;Never used
12jw2Cc6XP14pUgJAospHKiQVNkEqRuKm7;Never used
1PfUg3HKpa8F2gP2rmaQmrTabaZ4fap6KG;Never used
1PqGKt3SGFHRhefp5xEVGfGwikH3s2vgLv;Never used
12TC9zDEfQM59T7ftvkWTUr6JVtrCLXMtZ;Never used
1cb38A8y586T4agywy2pRqzyoQbTmzQ52;0
1cE7LHKsqp2oCcbAX6NoUw3tdq2bgRpt2;Never used
1MvbHgK1Et7gBpvWWvmhgkWX5EQzpp7iRy;Never used
1C4AJREHR1iiJTDjk2M7dEM8cw1mbyWt3s;Never used
1GcvagNfmASafNLohTMVQnaE7sytso9AEW;Never used
1PhBy8dZJTMN6zguVyWKPxxGvo5xDPQg6r;Never used
1Lwa9rMYbhRUuRhSqxPdhFxEP7BviW62Kt;Never used
1rxFAAhq8UMV8Rtk5Kza2yrE2vVB3pyAF;Never used
1B5g955Eagtm24rqqMN4WjmBD1f7BLMAt2;Never used
1L5KEiWUUeG4c6ewBBqUnje45VUyuriT55;0
1N54DUiYr81ewzRAQKgnbkDTatYKastbvC;Never used
1QKFDy3ssKXkUjmSVK1Sjyti4Q2VV2gpXP;Never used
1fWZDCdtVmx1NqcrkqMvp1P8TWqYk5RRy;Never used
1JgdkPd2Vjx7PSGCSS9X1fgrUcH4x7Hrjf;Never used
1G6PLZD1reXSFBy9epEDy8pJudidKGGEf7;Never used
198m6BGyTWTtd6fNWc61Fd4voN1kh2F5ZL;Never used
16AspaHy7z3QCF55wZR9ZeZDdWRuaou19J;Never used
1A8PEkNrNYjXjsfTuxKoH5cXwRJcFbv6XG;Never used
1ByPNJw7NsTDbJdTE6TqgW74sNBAgFcwAH;Never used
1LBb4PWHbHJsFHHH6cWCd9915NcnxttzCC;Never used
18FurAexC6XpexPzmQYWKvBnLdHdwyUT5d;Never used
19WQXFVLrwPuKd8VebfoLyQC1yaboLQiww;Never used

You could add a feature to exclude "Never used" addresses.


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: jackjack on September 04, 2013, 06:35:14 PM
Indeed, I will
Once cleaned:
Quote
addr;balance
1raZJDP3KRRKK59ptGbyhfkdDLXQ1XV9V;0
1FX2NDMcX1hz8CNi5gvUhsKbSzWZwRqgXM;0
13BKTFVzLD7BR16yD5gUHVmeW5idvzQvvx;0.0001
1J3VmjcjD6JHizt9PRML6dF9ZtRoQxsBrr;0
1Ztt1QKBCucciV3dsVpGmGRoUsDJ8VtcN;0
1cb38A8y586T4agywy2pRqzyoQbTmzQ52;0
1L5KEiWUUeG4c6ewBBqUnje45VUyuriT55;0

I'm sorry but that's all I can do for you as I don't know Electrum
That tells you that importing those 7 addresses into Electrum should be enough to get all your coins


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: simpic on September 04, 2013, 07:21:33 PM
Unfortunately it doesn't work with Electrum, in fact i have this situation (https://bitcointalk.org/index.php?topic=260621.msg3076173#msg3076173).

Anyway, this output is the same that i get with "listaddressgroupings" command in Bitcoin-Qt?

Quote
21:19:19

[
[
[
"1L5KEiWUUeG4c6ewBBqUnje45VUyuriT55",
0.00000000
]
],
[
[
"13BKTFVzLD7BR16yD5gUHVmeW5idvzQvvx",
0.00010000,
"Desktop1"
],
[
"1J3VmjcjD6JHizt9PRML6dF9ZtRoQxsBrr",
0.00000000
],
[
"1FX2NDMcX1hz8CNi5gvUhsKbSzWZwRqgXM",
0.00000000,
"Desktop2"
],
[
"1Ztt1QKBCucciV3dsVpGmGRoUsDJ8VtcN",
0.00000000
],
[
"1raZJDP3KRRKK59ptGbyhfkdDLXQ1XV9V",
0.00000000
],
[
"1cb38A8y586T4agywy2pRqzyoQbTmzQ52",
0.00000000
]
],
[
[
"1J2Xg5wPhpMQxJydVZqyaEdwVjyssUzUGY",
0.00000000
]
]
]

If yes, why here there are 8 addresses?


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: simpic on September 05, 2013, 04:51:49 PM
The output of "listaddressgroupings" on Bitcoin Qt client is the same of "dump keys" function (without "never use" addresses) of your program?


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: jackjack on September 05, 2013, 05:00:37 PM
I don't know what listaddressgrouping does so I don't know


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: simpic on September 05, 2013, 05:58:58 PM
Ok, thank you anyway for your greeeeeat support ;D
Keep up the good work!


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: jackjack on September 05, 2013, 07:25:40 PM
All I can say is that addresses without "never used" had a non-zero balance at least once

And np :)
Contact me if you ever need help again


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: magnux on May 27, 2014, 06:28:48 AM
Check the solution I posted in this thread:
https://bitcointalk.org/index.php?topic=398155.msg6964230#msg6964230

Give it a try, it was really hard to do it.


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: BTC-C9 on November 10, 2020, 12:11:14 PM
I get a huge amount of string like this:

                    "scriptPubKey": "76a91474add11bbac1a5818aa3f64dc3f7bc8cc931a09f88ac",
                    "value": 6.4e-05

So now? Why i can't use the web utility as that user explained in the other topic?
It's normal, they are all the transactions that your wallet stores

For it to be more practical, do this:
Code:
python pywallet.py --dumpwallet --dumpwithbalance --datadir=/path/to/wallet --wallet=wallet.dat > keys.txt
This put all the text in the file keys.txt
Then open keys.txt
In the beginning of the file you'll see the keys but now each one will have a "balance" parameter
Most of them will have "Never used", you can avoid to import them in Electrum
On the other hand, all the addresses that have something else than "Never used" must be imported

Example of what you'll get:
Code:
        {
            "addr": "1EuK1VCzdyGzXgk1AnJswC1Y46dCyyqyXW",
            "balance": "Never used",
            "compressed": true,
            "encrypted_privkey": "43e93c600c4e76eecbdc1311d09713234dc1c8c3e37067383f74e910afd6321f989c9a49dd73f018e76d2e0f1d759f1d",
            "pubkey": "03feb65c4b3a2f163e991803e47b28231c2b62366814c08ed816b1aa150e856fc0",
            "reserve": 1
        },
        {
            "addr": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
            "balance": "64.19778513",
            "compressed": false,
            "encrypted_privkey": "36e537b86cf0c55966ffbd776edd4e1b4922187d12b3f3bb39833d2776c97bd6cde814750e8e785d7f75a666e52234b8",
            "pubkey": "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f",
            "reserve": 0
        },

How do you decrypt the encrypted private key?
which shows encrypted_privatekey:


Title: Re: PYWallet Help - Dumping encrypted private key
Post by: HCP on November 10, 2020, 11:53:10 PM
How do you decrypt the encrypted private key?
which shows encrypted_privatekey:
If the wallet file is encrypted, you need to use the --passphrase parameter and supply the "walletpassphrase" when you use the --dumpwallet command. In that case it will output the decrypted private key data in the output text and you should see fields labelled "sec" and "secret":

Code:
python pywallet.py --dumpwallet --dumpwithbalance --passphrase=PUT_YOUR_WALLETPASSPHRASE_HERE --datadir=/path/to/wallet --wallet=wallet.dat > keys.txt


"sec" is the decrypted private key in "WIF" format
"secret" is the decrypted private key in HEX
Code:
{
            "addr": "1EuK1VCzdyGzXgk1AnJswC1Y46dCyyqyXW",
            "balance": "Never used",
            "compressed": true,
            "encrypted_privkey": "43e93c600c4e76eecbdc1311d09713234dc1c8c3e37067383f74e910afd6321f989c9a49dd73f018e76d2e0f1d759f1d",
            "pubkey": "03feb65c4b3a2f163e991803e47b28231c2b62366814c08ed816b1aa150e856fc0",
            "reserve": 1,
            "sec": "WIF_PRIVATE_KEY_WOULD_BE_HERE",
            "secret": "HEX_PRIVATE_KEY_WOULD_BE_HERE"
        },