Bitcoin Forum
November 13, 2024, 05:04:07 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: PYWallet Help - Dumping encrypted private key  (Read 8798 times)
Kazu (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


View Profile
September 01, 2013, 07:06:18 PM
 #1

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?

CoinLenders - Bitcoin Bank Script / Demo
1v.io/kazu - 15ccW7m6RxDFWEKc3P1NdwWpX1N1pU7gZ8
jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
September 01, 2013, 07:08:48 PM
 #2

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?

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.
Kazu (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


View Profile
September 01, 2013, 07:38:36 PM
 #3

Figured out problem, I was specifying a different wallet file, but for some reason (Huh) 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.

CoinLenders - Bitcoin Bank Script / Demo
1v.io/kazu - 15ccW7m6RxDFWEKc3P1NdwWpX1N1pU7gZ8
Kazu (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


View Profile
September 01, 2013, 07:53:22 PM
 #4

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.

CoinLenders - Bitcoin Bank Script / Demo
1v.io/kazu - 15ccW7m6RxDFWEKc3P1NdwWpX1N1pU7gZ8
jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
September 01, 2013, 08:06:54 PM
 #5

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?

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.
Kazu (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


View Profile
September 01, 2013, 08:46:51 PM
 #6

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.

CoinLenders - Bitcoin Bank Script / Demo
1v.io/kazu - 15ccW7m6RxDFWEKc3P1NdwWpX1N1pU7gZ8
jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
September 01, 2013, 09:02:09 PM
 #7

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?

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.
simpic
Hero Member
*****
Offline Offline

Activity: 1255
Merit: 811


View Profile
September 03, 2013, 02:38:21 PM
 #8

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.

jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
September 03, 2013, 02:46:00 PM
 #9

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?

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.
simpic
Hero Member
*****
Offline Offline

Activity: 1255
Merit: 811


View Profile
September 03, 2013, 03:03:46 PM
 #10

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

jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
September 03, 2013, 03:36:11 PM
 #11

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

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.
simpic
Hero Member
*****
Offline Offline

Activity: 1255
Merit: 811


View Profile
September 03, 2013, 06:36:41 PM
 #12

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.

jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
September 03, 2013, 06:39:41 PM
 #13

"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?

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.
simpic
Hero Member
*****
Offline Offline

Activity: 1255
Merit: 811


View Profile
September 03, 2013, 06:52:14 PM
 #14

"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?

jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
September 03, 2013, 07:08:18 PM
 #15

"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

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.
simpic
Hero Member
*****
Offline Offline

Activity: 1255
Merit: 811


View Profile
September 03, 2013, 07:19:03 PM
 #16

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?

jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
September 03, 2013, 07:58:39 PM
Last edit: September 03, 2013, 08:11:27 PM by jackjack
 #17

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
        },

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.
simpic
Hero Member
*****
Offline Offline

Activity: 1255
Merit: 811


View Profile
September 03, 2013, 11:51:10 PM
 #18

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?

jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
September 04, 2013, 07:50:10 AM
 #19

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.

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.
simpic
Hero Member
*****
Offline Offline

Activity: 1255
Merit: 811


View Profile
September 04, 2013, 08:09:16 AM
 #20

Ok, thank you very much for your support.
Anyway in the web version even saving without balance, why it doesn't work?

Pages: [1] 2 »  All
  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!