Bitcoin Forum
May 22, 2024, 09:40:12 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Confused about addresses  (Read 997 times)
erl (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 0



View Profile
November 22, 2012, 05:36:23 AM
 #1

I'm trying to dump addresses from the wallet.dat using pywallet but the results confuse me. I expect to see all addresses visible via bitcoin-qt interface but when grepping the output from pywallet none of them are found.

Am I missing something?

-- Erl Cash
Stephen Gornick
Legendary
*
Offline Offline

Activity: 2506
Merit: 1010


View Profile
November 22, 2012, 12:16:22 PM
 #2

I'm trying to dump addresses from the wallet.dat using pywallet but the results confuse me. I expect to see all addresses visible via bitcoin-qt interface but when grepping the output from pywallet none of them are found.

Not sure why that is.

You could also try Gavin's bitcoin tools, which has a dumpwallet.



Unichange.me

            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █


erl (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 0



View Profile
November 22, 2012, 07:07:54 PM
 #3

I'm trying to dump addresses from the wallet.dat using pywallet but the results confuse me. I expect to see all addresses visible via bitcoin-qt interface but when grepping the output from pywallet none of them are found.

Not sure why that is.

You could also try Gavin's bitcoin tools, which has a dumpwallet.

According to the README (https://github.com/gavinandresen/bitcointools):

Quote
These tools are becoming obsolete as we move away from using Berkeley DB in
Bitcoin-Qt/bitcoind.

If you are looking for a tool to manipulate the wallet.dat file, you might
want to try https://github.com/joric/pywallet

Again I'm running in the circles. Thanks to your reply I got the idea I'm doing something wrong with pywallet so I'll try to fiddle with it a little more.

Here's how i call pywallet:

Code:
[earl@b2x2:~/.bitcoin]$ pwd
/home/earl/.bitcoin
[earl@b2x2:~/.bitcoin]$ pywallet.py --datadir=./ --wallet=wallet.dat --dumpwallet | grep "$ADDRESS_VISIBLE_IN_BITCOIN_QT"
# empty result
Stephen Gornick
Legendary
*
Offline Offline

Activity: 2506
Merit: 1010


View Profile
November 22, 2012, 07:27:45 PM
Last edit: November 23, 2012, 06:27:18 AM by Stephen Gornick
 #4

Code:
[earl@b2x2:~/.bitcoin]$ pywallet.py --datadir=./ --wallet=wallet.dat --dumpwallet | grep "$ADDRESS_VISIBLE_IN_BITCOIN_QT"

You probably are not seeing the error message.

Try just this.

 $ pywallet.py --dumpwallet

And if the wallet is encrypted, you'll need to add --password=PASSWORD

Unichange.me

            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █


erl (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 0



View Profile
November 22, 2012, 09:50:37 PM
 #5

[earl@b2x2:~/.bitcoin]$ pywallet.py --datadir=./ --wallet=wallet.dat --dumpwallet | grep "$ADDRESS_VISIBLE_IN_BITCOIN_QT"

You probably are missing the error message.

Try just this.

 $ pywallet.py --dumpwallet

And if the wallet is encrypted, you'll need to add --password=PASSWORD


Well that was strange. I deleted the old wallet and let the bitcoin-qt generate a new one, then created a few new addresses, re-run pywallet and finally got what i need. :-)

And yes, there's a message about 'ecdsa' but I dont think I need that feature:

Quote
'ecdsa' package is not installed, pywallet won't be able to sign/verify messages
erl (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 0



View Profile
November 23, 2012, 06:05:40 AM
 #6

Guess i got what i need.

Generating addresses

Code:
./vanitygen -k -o keys.txt ""

Mass import

Code:
#!/bin/bash

p=$(basename $0)
pywallet_bin="./pywallet.py"


if [ $# -lt 2 ];then echo "Usage: $p <VANITYGEN_FILE> <WALLET>"; exit 1; fi

file=$1
wallet=$2

if [ ! -f "$file" ];then echo "$p: file '$file' not found."; exit 1; fi
if [ ! -f "$wallet" ];then echo "$p: wallet '$wallet' not found."; exit 1; fi
if [ ! -f "$pywallet_bin" ];then echo "$p: pywallet '$pywallet_bin' executable not found"; exit 1; fi

private_keys=($(grep "Privkey: " "$file" | awk -F " " '{ print $2; }'))

echo "Private keys found: ${#private_keys[*]}"

for key in "${private_keys[@]}";
do
#echo $key
$pywallet_bin --datadir=$(dirname "$wallet") --wallet=$(basename "$wallet") --importprivkey=$key --dont_check_walletversion
done

exit 0
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!