Pages:
Author

Topic: [PULL] private key and wallet export/import - page 5. (Read 39497 times)

member
Activity: 92
Merit: 10
Yes, it looks like that. Smiley
legendary
Activity: 1176
Merit: 1233
May Bitcoin be touched by his Noodly Appendage
Ok I think I see the problem
Run '.\pywallet.py --dumpwallet --datadir m:\bitcoin\old\'
Does it looks like that: (don't post it)
Code:
        {
            "addr": "1lqksjiqsidj",
            "hexsec": "kkjqsdsd",
            "reserve": 1,
            "sec": "5vkkqsjdnqs"
        }
    ],
    "tx": "unsupported",
    "version": 32500
}

If not, run 'python pywallet.py --dumpwallet --datadir m:\bitcoin\old\'
member
Activity: 92
Merit: 10
I also tried it with that option.

Code:
--pwpath=.\


Same error.  I also tried it with the long form of the path.

Code:
--pwpath=c:\progra~1\bitcoin\pywallet\


Same error.
legendary
Activity: 1176
Merit: 1233
May Bitcoin be touched by his Noodly Appendage
You forgot the --pwpath argument Wink
Should be .\ on Windows I guess
member
Activity: 92
Merit: 10
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
    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
member
Activity: 92
Merit: 10
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.
legendary
Activity: 1176
Merit: 1233
May Bitcoin be touched by his Noodly Appendage
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
member
Activity: 92
Merit: 10
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
legendary
Activity: 1176
Merit: 1233
May Bitcoin be touched by his Noodly Appendage
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
legendary
Activity: 1974
Merit: 1029
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.
legendary
Activity: 1400
Merit: 1005
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.
member
Activity: 73
Merit: 10
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?
legendary
Activity: 1072
Merit: 1174
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
sr. member
Activity: 404
Merit: 250
I want to say that I will be really excited when this makes its way into the client!
member
Activity: 73
Merit: 10
Private keys always start with 5 though, right?

Yes, in the 'real' net. I was trying on testnet.
legendary
Activity: 1400
Merit: 1005
Private keys always start with 5 though, right?
member
Activity: 73
Merit: 10
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?
donator
Activity: 2772
Merit: 1019
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
legendary
Activity: 1072
Merit: 1174
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).
legendary
Activity: 1400
Merit: 1005
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
Pages:
Jump to: