Bitcoin Forum
April 26, 2024, 06:55:07 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [ANN] wallet_tool: A simple address & privkey dumper/importer  (Read 1415 times)
SRoulette (OP)
Sr. Member
****
Offline Offline

Activity: 364
Merit: 252



View Profile WWW
April 20, 2013, 01:47:06 PM
Merited by ABCbits (2)
 #1

Greetings,
I was having trouble importing and exporting bulk keys from old wallets into new. pywallet did look promising but I could not get it to work 100%.
I asked my sites coder (codemonkey) who already had a tool he was using. After separating it from our casino engines libraries he packaged it up for me to use on windows and added some short documentation Cheesy
The bonus for me is it just works, no installing extra libraries or perl etc.

It works for bitcoin, ppcoin (the currency I needed it for), teracoin, litecoin and novacoin. In theory it will work for every bitcoin clone that supports bitcoins dumpprivkey and importprivkey rpc commands.


Install:
Extract the files somewhere easy, ie c:\

Configure your %appdata%/bitcoin/bitcoin.conf like so:

Code:
server=1
rpcuser=ppuser
rpcpass=pppasss
rpcpassword=pppasss


Help:

Code:
C:\wallet_tool>wallet_tool.exe --help

===============================================================================
wallet_tool.pl 1.0-RC1
===============================================================================

A free tool provided by satoshiroulette.com
written by codemonkey@satoshiroulette.com

This tool does 2 things very well.
* Dumping private keys from a local or remote wallet
* Importing private keys to a local or remote wallet

Options can be set via command line arguments or a config file.

Options names are compatible with bitcoin.conf's names.
For local dumps and imports you can use your bitcoins bitcoin.conf file as
the wallet tool's config file.

Tested on BTC, LTC, TRC, PPC & NVC

===============================================================================
Command Line Options
===============================================================================
--ip=IP ADDRESS         Defaults to 127.0.0.1
--rpcport=RPC PORT      Defaults to: 8339 (bitcoins default), also

Dumping Private Keys:

  wallet_tool.pl --dump=/path/to/dump/file.txt --config=/path/to/bitcoin.conf
  wallet_tool.pl --dump=/dump.txt --rpcpassword=PASS --rpcuser=USER

Importing Private Keys:

  wallet_tool.pl --import=/path/to/dump/file.txt --config=/path/to/bitcoin.conf

===============================================================================
Config File Options
===============================================================================

The following options are read from the config file

rpcport=PORT
rpcuser=USER
rpcpassword=PASSWORD

===============================================================================

Usage:

Dumping Private Keys
note the addresses are empty, I made them for the demonstration Tongue

Code:
C:\wallet_tool>wallet_tool.exe --dump=c:\wallet_tool\dump.txt --config="c:\Documents and Settings\Administrator\Application Data\PPcoin\PPcoin.conf" --rpcport=9902
[STATUS] Reading Command Line Arguments:
[INFO] out file = c:\wallet_tool\dump.txt
[INFO] config file = c:\Documents and Settings\Administrator\Application Data\PPcoin\PPcoin.conf
[INFO] RPC Port = 9902
[STATUS] Reading Config File:
[INFO] rpcuser = 'ppuser'
[INFO] rpcpassword = 'pppasss'
PAEA4AVioDLxksqCaqs7PzJU4qd1ynCKqG - UC8b3sc79V3rdFAmg7osjn5sGZVGqXL9e3JKy8eFmKHTo7LrFHpq
PM2bttDPnBDM4bWnav6aQ1JN56f4UFZKqQ - U7WXcusbAxL64WGJNxBxqWrQDQoL8rqyGS2drTFSdHee6DrfnqaH
PPRzm8AtSmFBP6nVniSMiFNacxuCimjmAA - UCpHekcFFxeYFmXdkEHqJeJ2UHyiKugN337GqYhgKSZtrVnqvGYe
PUupg6LbGFR5j29SeuhS7ZYn3sScHjcb3W - U9CMemQerueAdH21v3vmiTAyczKzuUfoLWWkxpi9aU3dHKgM9AH7
PWTLu2z5bFpaiwsMZFiw1RXRPAwJjGxTdi - U7viX4FWkYnyTLLiETP4VyuqEeojsBw1n1Yk6Sg1TNKS6AbtPrMG

Attempting to import the same keys that already exist:
eg on the same wallet produces the following warnings.
Code:
C:\wallet_tool>wallet_tool.exe --import=c:\wallet_tool\dump.txt --config="c:\Documents and Settings\Administrator\Application Data\PPcoin\PPcoin.conf" --rpcport=9902
[STATUS] Reading Command Line Arguments:
[INFO] in file = c:\wallet_tool\dump.txt
[INFO] config file = c:\Documents and Settings\Administrator\Application Data\PPcoin\PPcoin.conf
[INFO] RPC Port = 9902
[STATUS] Reading Config File:
[INFO] rpcuser = 'ppuser'
[INFO] rpcpassword = 'pppasss'
[STATUS] Importing privkey for address PAEA4AVioDLxksqCaqs7PzJU4qd1ynCKqG, 1 of 5
[INFO] Wallet Already owns address PAEA4AVioDLxksqCaqs7PzJU4qd1ynCKqG, not importing privkey
[WARN] do you already have PAEA4AVioDLxksqCaqs7PzJU4qd1ynCKqG in this wallet
[STATUS] Importing privkey for address PM2bttDPnBDM4bWnav6aQ1JN56f4UFZKqQ, 2 of 5
[INFO] Wallet Already owns address PM2bttDPnBDM4bWnav6aQ1JN56f4UFZKqQ, not importing privkey
[WARN] do you already have PM2bttDPnBDM4bWnav6aQ1JN56f4UFZKqQ in this wallet
[STATUS] Importing privkey for address PPRzm8AtSmFBP6nVniSMiFNacxuCimjmAA, 3 of 5
[INFO] Wallet Already owns address PPRzm8AtSmFBP6nVniSMiFNacxuCimjmAA, not importing privkey
[WARN] do you already have PPRzm8AtSmFBP6nVniSMiFNacxuCimjmAA in this wallet
[STATUS] Importing privkey for address PUupg6LbGFR5j29SeuhS7ZYn3sScHjcb3W, 4 of 5
[INFO] Wallet Already owns address PUupg6LbGFR5j29SeuhS7ZYn3sScHjcb3W, not importing privkey
[WARN] do you already have PUupg6LbGFR5j29SeuhS7ZYn3sScHjcb3W in this wallet
[STATUS] Importing privkey for address PWTLu2z5bFpaiwsMZFiw1RXRPAwJjGxTdi, 5 of 5
[INFO] Wallet Already owns address PWTLu2z5bFpaiwsMZFiw1RXRPAwJjGxTdi, not importing privkey
[WARN] do you already have PWTLu2z5bFpaiwsMZFiw1RXRPAwJjGxTdi in this wallet

Importing the above private keys to a new wallet:

Code:
C:\wallet_tool>wallet_tool.exe --import=c:\wallet_tool\dump.txt --config="c:\Documents and Settings\Administrator\Application Data\PPcoin\PPcoin.conf" --rpcport=9902
[STATUS] Reading Command Line Arguments:
[INFO] in file = c:\wallet_tool\dump.txt
[INFO] config file = c:\Documents and Settings\Administrator\Application Data\PPcoin\PPcoin.conf
[INFO] RPC Port = 9902
[STATUS] Reading Config File:
[INFO] rpcuser = 'ppuser'
[INFO] rpcpassword = 'pppasss'
[STATUS] Importing privkey for address PAEA4AVioDLxksqCaqs7PzJU4qd1ynCKqG, 1 of 5
importprivkey OK
[STATUS] Importing privkey for address PM2bttDPnBDM4bWnav6aQ1JN56f4UFZKqQ, 2 of 5
importprivkey OK
[STATUS] Importing privkey for address PPRzm8AtSmFBP6nVniSMiFNacxuCimjmAA, 3 of 5
importprivkey OK
[STATUS] Importing privkey for address PUupg6LbGFR5j29SeuhS7ZYn3sScHjcb3W, 4 of 5
importprivkey OK
[STATUS] Importing privkey for address PWTLu2z5bFpaiwsMZFiw1RXRPAwJjGxTdi, 5 of 5
importprivkey OK

Download:

1.0-RC1
CRC32: 999E67A9
MD5: C644D23E00C4061A9ECF2CAAF57CCA21
SHA-1: 182BDA546F66D936B7528FC3AF2DD22F34AEA13F

1714157707
Hero Member
*
Offline Offline

Posts: 1714157707

View Profile Personal Message (Offline)

Ignore
1714157707
Reply with quote  #2

1714157707
Report to moderator
1714157707
Hero Member
*
Offline Offline

Posts: 1714157707

View Profile Personal Message (Offline)

Ignore
1714157707
Reply with quote  #2

1714157707
Report to moderator
Even if you use Bitcoin through Tor, the way transactions are handled by the network makes anonymity difficult to achieve. Do not expect your transactions to be anonymous unless you really know what you're doing.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714157707
Hero Member
*
Offline Offline

Posts: 1714157707

View Profile Personal Message (Offline)

Ignore
1714157707
Reply with quote  #2

1714157707
Report to moderator
1714157707
Hero Member
*
Offline Offline

Posts: 1714157707

View Profile Personal Message (Offline)

Ignore
1714157707
Reply with quote  #2

1714157707
Report to moderator
1714157707
Hero Member
*
Offline Offline

Posts: 1714157707

View Profile Personal Message (Offline)

Ignore
1714157707
Reply with quote  #2

1714157707
Report to moderator
dserrano5
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
April 20, 2013, 04:50:50 PM
 #2

That Perl code is from the 90s…

  • You should use some Getopt::* module for command-line arguments parsing. I'm fond of Getopt::Long, which is in the core Perl distribution these days.
  • Check out Pod::Usage too (a core module as well).
  • And some module for reading the INI file, there are tons of them.
  • You shouldn't call methods with the '&' prefix unless you know what you're doing.
  • The syntax 'new Object' is deprecated, use 'Object->new'.
  • You should use lexically-scoped file descriptors (ie 'open my $file' instead of 'open FILE').
  • You should use 3-arg open.
  • And some other minor nits.
Feel free to send me a PM Wink.
SRoulette (OP)
Sr. Member
****
Offline Offline

Activity: 364
Merit: 252



View Profile WWW
April 21, 2013, 04:25:06 AM
 #3

Everyone is a critic Tongue

Monkeys Response:
Quote
timtowtdi !!!

That Perl code is from the 90s…
- Well its about when I started Smiley excuse me for showing my age.

Use Pod::Usage
- what for ? its a single file script thats being aimed at NON perl users hence the binary.

You shouldn't call methods with the '&' prefix unless you know what you're doing.
- Im pretty sure I know what Im doing, but if you care to give a specific example from my code and highlight the dangers you are claiming It would be appreciated.

The syntax 'new Object' is deprecated, use 'Object->new'.
- orly ?

You should use lexically-scoped file descriptors (ie 'open my $file' instead of 'open FILE').
- http://perldoc.perl.org/functions/open.html disagrees and FILE is easier for readability.

You should use 3-arg open.
- Why ? how is the current method impeding my application ?

And some other minor nits
- That being yourself you nit Tongue

Feel free to send me a PM .
- Pass, the application works perfectly Im not about to reformat it to suite one person.
I do however welcome any improvements in the form of a patch you can provide Smiley

So thats the monkeys response, I thank you for your feed back Smiley

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!