Bitcoin Forum
November 11, 2024, 11:58:58 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 3 4 [5] 6 7 8 9 10 »  All
  Print  
Author Topic: [PULL] private key and wallet export/import  (Read 39571 times)
bitlotto
Hero Member
*****
Offline Offline

Activity: 672
Merit: 500


BitLotto - best odds + best payouts + cheat-proof


View Profile WWW
July 13, 2011, 02:51:11 AM
 #81

pulled into upstream
GREAT! I can't wait!!

*Next Draw Feb 1*  BitLotto: monthly raffle (0.25 BTC per ticket) Completely transparent and impossible to manipulate who wins. TOR
TOR2WEB
Donations to: 1JQdiQsjhV2uJ4Y8HFtdqteJsZhv835a8J are appreciated.
Shevek
Sr. Member
****
Offline Offline

Activity: 252
Merit: 250



View Profile
July 13, 2011, 07:50:09 AM
Last edit: July 13, 2011, 08:47:35 AM by Shevek
 #82

Until its added:
check what Joric made: https://github.com/joric/pywallet
It makes exporting/importing keys easy without recompiling Bitcoin. It does it right to the wallet using a python script! Still new but pretty cool and easy!

Nice tool!

But it only works on freshly created wallet.dat files. If you try to dump, or to add a priv. key on to long-term used wallet, the program yields an error message.

Proposals for improving bitcoin are like asses: everybody has one
1SheveKuPHpzpLqSvPSavik9wnC51voBa
Pieter Wuille (OP)
Legendary
*
qt
Offline Offline

Activity: 1072
Merit: 1181


View Profile WWW
July 13, 2011, 09:40:38 AM
 #83

pulled into upstream

Eh no, not yet...

I do Bitcoin stuff.
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1100


View Profile
July 13, 2011, 06:43:59 PM
 #84

pulled into upstream

Eh no, not yet...

Sorry, cross-thread stupidity on my part.  Wallet encryption was pulled, not import/export -- though we do want to merge import/export soon!


Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
SgtSpike
Legendary
*
Offline Offline

Activity: 1400
Merit: 1005



View Profile
July 13, 2011, 07:58:42 PM
 #85

pulled into upstream

Eh no, not yet...

Sorry, cross-thread stupidity on my part.  Wallet encryption was pulled, not import/export -- though we do want to merge import/export soon!


You made my day, then killed it.  Sad
Pieter Wuille (OP)
Legendary
*
qt
Offline Offline

Activity: 1072
Merit: 1181


View Profile WWW
July 17, 2011, 09:11:04 PM
 #86

I just pushed a new version to github that contains a 'removeprivkey' that requires the *private* key to be removed to be passed.

It is untested for now, so use at your own risk. It should remove the key and irrelevant transactions from the wallet, the address from the address book, and from the key pool. It will not be removed from accounts (yet).

I do Bitcoin stuff.
molecular
Donator
Legendary
*
Offline Offline

Activity: 2772
Merit: 1019



View Profile
July 18, 2011, 07:03:43 AM
 #87

I just pushed a new version to github that contains a 'removeprivkey' that requires the *private* key to be removed to be passed.

It is untested for now, so use at your own risk. It should remove the key and irrelevant transactions from the wallet, the address from the address book, and from the key pool. It will not be removed from accounts (yet).


awesome!

I was going to test, but I'm having trouble compiling:

Quote
util.cpp: In function ‘std::string FormatFullVersion()’:
util.cpp:903: error: invalid conversion from ‘const wxChar*’ to ‘char’

Sad

PGP key molecular F9B70769 fingerprint 9CDD C0D3 20F8 279F 6BE0  3F39 FC49 2362 F9B7 0769
riush
Member
**
Offline Offline

Activity: 73
Merit: 10


View Profile
July 18, 2011, 10:13:15 PM
 #88

Nice! much better than what I tried to do Tongue

I'm just having a 'little' problem with importing keys; the import fails, and even if I didn't remove the key, it is not listed anymore; but it seems to be there somehow...

Quote
foo@bar:~/work/bitcoin/src$ ./bitcoind getaddressesbyaccount foobar
[
    "mogyeNDBngfYGdbmc49QnTmDpbwgkbn2oK"
]
foo@bar:~/work/bitcoin/src$ ./bitcoind dumpprivkey mogyeNDBngfYGdbmc49QnTmDpbwgkbn2oK
92k6iexNDbUVjKdkE5YtcukbtDK6VWg9NAXxwakvviWc4RhoWNh
( foo@bar:~/work/bitcoin/src$ ./bitcoind removeprivkey 92k6iexNDbUVjKdkE5YtcukbtDK6VWg9NAXxwakvviWc4RhoWNh )
foo@bar:~/work/bitcoin/src$ ./bitcoind importprivkey 92k6iexNDbUVjKdkE5YtcukbtDK6VWg9NAXxwakvviWc4RhoWNh
error: {"code":-4,"message":"Error adding key to wallet"}
foo@bar:~/work/bitcoin/src$ ./bitcoind getaddressesbyaccount foobar
[
]
foo@bar:~/work/bitcoin/src$ ./bitcoind getaccountaddress foobar
mogyeNDBngfYGdbmc49QnTmDpbwgkbn2oK

Behaves the same no matter if I removed the key or not; AFAIS it shouldn't be in getaccountaddress if I did, and should be in getaddressesbyaccount if i didn't.

Am I understanding or doing something wrong here?

1MKKiJhUJgqKyfCLeo7bB1bvELNEM8wUbz
SgtSpike
Legendary
*
Offline Offline

Activity: 1400
Merit: 1005



View Profile
July 18, 2011, 10:35:46 PM
 #89

Private keys always start with 5 though, right?
riush
Member
**
Offline Offline

Activity: 73
Merit: 10


View Profile
July 18, 2011, 10:41:18 PM
 #90

Private keys always start with 5 though, right?

Yes, in the 'real' net. I was trying on testnet.

1MKKiJhUJgqKyfCLeo7bB1bvELNEM8wUbz
sirky
Sr. Member
****
Offline Offline

Activity: 404
Merit: 250



View Profile
July 19, 2011, 01:09:09 AM
 #91

I want to say that I will be really excited when this makes its way into the client!
Pieter Wuille (OP)
Legendary
*
qt
Offline Offline

Activity: 1072
Merit: 1181


View Profile WWW
July 19, 2011, 02:42:15 PM
 #92

Nice! much better than what I tried to do Tongue

I'm just having a 'little' problem with importing keys; the import fails, and even if I didn't remove the key, it is not listed anymore; but it seems to be there somehow...

It seems there was a bug: keys were not removed from disk, so re-adding them failed. This should be fixed now - could you test again?

Quote
Behaves the same no matter if I removed the key or not; AFAIS it shouldn't be in getaccountaddress if I did, and should be in getaddressesbyaccount if i didn't.

Am I understanding or doing something wrong here?

Well, removing addresses from accounts is just not supported yet. It may cause inccorrect account balances, but not invalid total balances Smiley

I do Bitcoin stuff.
riush
Member
**
Offline Offline

Activity: 73
Merit: 10


View Profile
July 19, 2011, 10:40:47 PM
 #93

It seems there was a bug: keys were not removed from disk, so re-adding them failed. This should be fixed now - could you test again?
Ah, now it seems to work. Great! Smiley

Quote
Well, removing addresses from accounts is just not supported yet. It may cause inccorrect account balances, but not invalid total balances
Even getbalance for the account shows 0 after the keys are removed, even though getaccountaddress still knows it.
Are you planning on adding that? (Not that I find it important, just curious what to expect Wink)

Another question: is there a way to check the 'balance' of a single address/key?

1MKKiJhUJgqKyfCLeo7bB1bvELNEM8wUbz
SgtSpike
Legendary
*
Offline Offline

Activity: 1400
Merit: 1005



View Profile
July 19, 2011, 11:07:47 PM
 #94

It seems there was a bug: keys were not removed from disk, so re-adding them failed. This should be fixed now - could you test again?
Ah, now it seems to work. Great! Smiley

Quote
Well, removing addresses from accounts is just not supported yet. It may cause inccorrect account balances, but not invalid total balances
Even getbalance for the account shows 0 after the keys are removed, even though getaccountaddress still knows it.
Are you planning on adding that? (Not that I find it important, just curious what to expect Wink)

Another question: is there a way to check the 'balance' of a single address/key?
Blockexplorer is probably the best way to check an address balance.
dserrano5
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
July 26, 2011, 12:09:19 PM
 #95

Code:
git clone git://github.com/bitcoin/bitcoin
cd bitcoin
git remote add sipa git://github.com/sipa/bitcoin
git fetch --all
git diff master..sipa/showwallet

(Warning: I'm a subversion user and haven't worked with git at all)

I've followed these steps successfully with 0.3.23 (or maybe it was 22). In the last step I actually did 'git diff master..sipa/showwallet |patch -p1', then 'cd src' and 'make bitcoind' as usual. Funny having to patch things, but I guess that's how git does things.

Now, what should I do to update to 0.3.24 without starting from scratch? A quick google revealed 'git pull' but that failed with "Your local changes to 'contrib/gitian.yml' would be overwritten by merge.  Aborting". Must I revert those changes (the applied patch, I suppose) before doing 'git pull'?

For now I just removed everything and started over, but I'd like to be cleaner next time. Already running "0.3.25-beta" Smiley.
jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
July 26, 2011, 12:42:30 PM
 #96

Code:
git clone git://github.com/bitcoin/bitcoin
cd bitcoin
git remote add sipa git://github.com/sipa/bitcoin
git fetch --all
git diff master..sipa/showwallet

(Warning: I'm a subversion user and haven't worked with git at all)

I've followed these steps successfully with 0.3.23 (or maybe it was 22). In the last step I actually did 'git diff master..sipa/showwallet |patch -p1', then 'cd src' and 'make bitcoind' as usual. Funny having to patch things, but I guess that's how git does things.

Now, what should I do to update to 0.3.24 without starting from scratch? A quick google revealed 'git pull' but that failed with "Your local changes to 'contrib/gitian.yml' would be overwritten by merge.  Aborting". Must I revert those changes (the applied patch, I suppose) before doing 'git pull'?

For now I just removed everything and started over, but I'd like to be cleaner next time. Already running "0.3.25-beta" Smiley.
From http://help.github.com/fork-a-repo/
Code:
git remote add upstream git://github.com/bitcoin/bitcoin
git fetch upstream
git merge upstream/master

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

Activity: 92
Merit: 10


View Profile
July 28, 2011, 08:55:37 PM
Last edit: July 28, 2011, 10:03:55 PM by krepta3000
 #97

Until its added:
check what Joric made: https://github.com/joric/pywallet
It makes exporting/importing keys easy without recompiling Bitcoin. It does it right to the wallet using a python script! Still new but pretty cool and easy!

Thank you so much bitlotto, or whoever you really are! Smiley  I'm going to try out pyWallet, yay! Smiley

I've been using python for various things for a while, I'm very happy with pyTiVo for instance. Smiley

Ok, I have downloaded pywallet.py, I've run it and told it to dump my wallet in JSON format, and it dumped keys to my screen.  So, I told it to dump the output text to a file I called wallet.json.... now what?  How do I import into a new, clean and undamaged, wallet?

Quote
Usage: pywallet.py [options]

Options:
  --version            show program's version number and exit
  -h, --help           show this help message and exit
  --dumpwallet         dump wallet in json format
  --importprivkey=KEY  import private key from vanitygen
  --datadir=DATADIR    wallet directory (defaults to bitcoin default)
  --testnet            use testnet subdirectory and address type

Thank goodness for advanced text editors like Notepad++ and Textpad that have macro recording functionality.  I created macros to edit the json text file to create a batch file that would run all of the key importing quick and easy. Smiley
jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1280


May Bitcoin be touched by his Noodly Appendage


View Profile
July 28, 2011, 09:49:07 PM
Last edit: July 28, 2011, 10:08:06 PM by jackjack
 #98

Until its added:
check what Joric made: https://github.com/joric/pywallet
It makes exporting/importing keys easy without recompiling Bitcoin. It does it right to the wallet using a python script! Still new but pretty cool and easy!

Thank you so much bitlotto, or whoever you really are! Smiley  I'm going to try out pyWallet, yay! Smiley

I've been using python for various things for a while, I'm very happy with pyTiVo for instance. Smiley

Ok, I have downloaded pywallet.py, I've run it and told it to dump my wallet in JSON format, and it dumped keys to my screen.  So, I told it to dump the output text to a file I called wallet.json.... now what?  How do I import into a new, clean and undamaged, wallet?

Quote
Usage: pywallet.py [options]

Options:
  --version            show program's version number and exit
  -h, --help           show this help message and exit
  --dumpwallet         dump wallet in json format
  --importprivkey=KEY  import private key from vanitygen
  --datadir=DATADIR    wallet directory (defaults to bitcoin default)
  --testnet            use testnet subdirectory and address type

I know that these are the command line options, I just don't know what to do from here.  Do I grab each key individually from the text file I created and tell this to import it into my new wallet file?  That could take a long time.
To copy an entire wallet, I think this might help you: http://forum.bitcoin.org/index.php?topic=31418.0
It is based on my pywallet fork (for label and reserve key support) and a script I made to use it

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

Activity: 92
Merit: 10


View Profile
July 28, 2011, 10:06:02 PM
 #99

To copy an entire wallet, I think this might help you: http://forum.bitcoin.org/index.php?topic=31418.0
It is based on my pywallet fork (for label and reserve support) and a script I made to use it

Thanks jackjack. Smiley  I didn't see this message till after I'd recorded the necessary macros to convert the json text into a batch importing file.  It's now working on importing all my keys, nice and easy. Smiley  I'll go download that script and work with it, some other time.  I'll just wait till the importing is all done and see what happens.
krepta3000
Member
**
Offline Offline

Activity: 92
Merit: 10


View Profile
July 28, 2011, 10:41:04 PM
 #100

I got an error when I tried to use walletco.py, with your pywallet.py branch, JackJack. Sad
Code:
C:\Program Files\Bitcoin\pywallet>walletco.py --wpath=m:\bitcoin\old\ --nwpath=m
:\bitcoin\new\
Dumping...
Traceback (most recent call last):
  File "C:\Program Files\Bitcoin\pywallet\walletco.py", line 114, in <module>
    main()
  File "C:\Program Files\Bitcoin\pywallet\walletco.py", line 89, in main
    json_db = json.loads(a.read())
  File "C:\Python27\lib\json\__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "C:\Python27\lib\json\decoder.py", line 360, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python27\lib\json\decoder.py", line 378, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
Pages: « 1 2 3 4 [5] 6 7 8 9 10 »  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!