Bitcoin Forum
November 15, 2024, 12:10:47 AM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   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 39572 times)
dooglus
Legendary
*
Offline Offline

Activity: 2940
Merit: 1333



View Profile
June 25, 2011, 09:06:51 AM
 #21

When I try to dump my wallet, I get an error:

Code:
$ bitcoind -rpcuser='xxx' -rpcpassword='yyy' dumpwallet
error: {"code":-1,"message":"CKEy::GetPrivKeyInner(): BN_bn2bin failed"}

I can dump a newly created wallet just fine, but my real one won't dump.

Any idea why?  Is it anything to worry about?  Should I try spending all my coins to a new address?

Just-Dice                 ██             
          ██████████         
      ██████████████████     
  ██████████████████████████ 
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
    ██████████████████████   
        ██████████████       
            ██████           
   Play or Invest                 ██             
          ██████████         
      ██████████████████     
  ██████████████████████████ 
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
██████████████████████████████
    ██████████████████████   
        ██████████████       
            ██████           
   1% House Edge
Pieter Wuille (OP)
Legendary
*
qt
Offline Offline

Activity: 1072
Merit: 1181


View Profile WWW
June 25, 2011, 09:43:27 AM
 #22

When I try to dump my wallet, I get an error:

Code:
$ bitcoind -rpcuser='xxx' -rpcpassword='yyy' dumpwallet
error: {"code":-1,"message":"CKEy::GetPrivKeyInner(): BN_bn2bin failed"}

Sorry, yes, this is a known bug. It happens for 1 private key in 256. I'll fix it soon.

I do Bitcoin stuff.
AntiVigilante
Member
**
Offline Offline

Activity: 98
Merit: 10



View Profile
June 25, 2011, 11:57:17 AM
 #23

When I try to dump my wallet, I get an error:

Code:
$ bitcoind -rpcuser='xxx' -rpcpassword='yyy' dumpwallet
error: {"code":-1,"message":"CKEy::GetPrivKeyInner(): BN_bn2bin failed"}

Sorry, yes, this is a known bug. It happens for 1 private key in 256. I'll fix it soon.


How soon in the system in the main client? And how soon the default format?

Proposal: http://forum.bitcoin.org/index.php?topic=11541.msg162881#msg162881
Inception: https://github.com/bitcoin/bitcoin/issues/296
Goal: http://forum.bitcoin.org/index.php?topic=12536.0
Means: Code, donations, and brutal criticism. I've got a thick skin. 1Gc3xCHAzwvTDnyMW3evBBr5qNRDN3DRpq
Pieter Wuille (OP)
Legendary
*
qt
Offline Offline

Activity: 1072
Merit: 1181


View Profile WWW
June 25, 2011, 05:07:55 PM
 #24

Rebased against master, a few bugs fixed, and split off into separate source file.

TODO: known wrong balance cached when importing keys

I do Bitcoin stuff.
puddinpop
Member
**
Offline Offline

Activity: 103
Merit: 17


View Profile
June 26, 2011, 08:42:13 PM
 #25

There's a crash caused by accessing an array element past the last one in base58.h, in the SecretToASecret function.
Code:
vch.insert(vch.end(), &vchSecret[0], &vchSecret[vchSecret.size()]);
vchSecret.size() is one past the last element, so it crashes here.

Since vchSecret is just a vector anyway, we can use this safer alternative:
Code:
vch.insert(vch.end(), vchSecret.begin(), vchSecret.end());

nelisky
Legendary
*
Offline Offline

Activity: 1540
Merit: 1002


View Profile
June 28, 2011, 03:04:27 AM
 #26

I've cherry picked the two commits sipa mentions on the pull request onto bitcoin HEAD, compiling on a linux x64 machine (xubuntu 11.04) and while it compiles almost cleanly:

Code:
g++ -c -O2 -Wno-invalid-offsetof -Wformat -g -D__WXDEBUG__ -DNOPCH -DFOURWAYSSE2 -DUSE_SSL -o obj/nogui/rpcdump.o rpcdump.cpp
rpcdump.cpp: In function ‘void GetWalletDump(std::map<uint160, CKeyDump>&)’:
rpcdump.cpp:116:82: warning: converting ‘false’ to pointer type for argument 2 of ‘bool ExtractPubKey(const CScript&, const CKeyStore*, std::vector<unsigned char>&)’

But then calling dumpprivkey on *any* address will output
Code:
26zVKbYFG

I didn't debug the code, too tired to do that now, but maybe it's something obvious Smiley
nelisky
Legendary
*
Offline Offline

Activity: 1540
Merit: 1002


View Profile
June 28, 2011, 02:30:06 PM
 #27

There's a crash caused by accessing an array element past the last one in base58.h, in the SecretToASecret function.
Code:
vch.insert(vch.end(), &vchSecret[0], &vchSecret[vchSecret.size()]);
vchSecret.size() is one past the last element, so it crashes here.

Since vchSecret is just a vector anyway, we can use this safer alternative:
Code:
vch.insert(vch.end(), vchSecret.begin(), vchSecret.end());


So the issue I posted above is a simple typo on sipa's commit. Instead of puddinpop's proposed change:

Code:
vch.insert(vch.end(), vchSecret.begin(), vchSecret.end());

You changed the code to

Code:
vch.insert(vch.end(), vch.begin(), vch.end());

The secret "vchSecret" was never being used.
Pieter Wuille (OP)
Legendary
*
qt
Offline Offline

Activity: 1072
Merit: 1181


View Profile WWW
June 28, 2011, 08:26:54 PM
 #28

You changed the code to
Code:
vch.insert(vch.end(), vch.begin(), vch.end());
The secret "vchSecret" was never being used.

Sorry, I must have been tired. Thanks for spotting the typo!

I do Bitcoin stuff.
krepta3000
Member
**
Offline Offline

Activity: 92
Merit: 10


View Profile
June 29, 2011, 07:38:38 PM
 #29

I don't understand how to use these RPC commands to dump my screwed up wallet, and import the undamaged portion into a new wallet.  In other words, manually construct a wallet that doesn't include the hung transactions.  I have looked at the RPC commands my bitcoin client accepts, and these commands you list on this thread are not included.  What do I do?
krepta3000
Member
**
Offline Offline

Activity: 92
Merit: 10


View Profile
July 01, 2011, 06:50:08 AM
 #30

Hello?  Anyone ever look at this thread anymore?  I downloaded the tarball for this, extracted it into my bitcoin folder, and ran bitcoin, only to find that these new RPC commands are not included/installed.  What do I do?  I don't know C++, I'm not a great programmer, I don't know how to make this work.  Help?  Please?
EricJ2190
Full Member
***
Offline Offline

Activity: 134
Merit: 102


View Profile
July 01, 2011, 07:02:45 AM
 #31

Hello?  Anyone ever look at this thread anymore?  I downloaded the tarball for this, extracted it into my bitcoin folder, and ran bitcoin, only to find that these new RPC commands are not included/installed.  What do I do?  I don't know C++, I'm not a great programmer, I don't know how to make this work.  Help?  Please?

For now, you need to recompile Bitcoin from its source code to use this. Hopefully this patch will be included in the next release.

But as for your corrupt wallet, I recommend bitcointools. There is a nice guide here: http://forum.bitcoin.org/index.php?topic=11331.0
krepta3000
Member
**
Offline Offline

Activity: 92
Merit: 10


View Profile
July 01, 2011, 06:54:50 PM
 #32

Hello?  Anyone ever look at this thread anymore?  I downloaded the tarball for this, extracted it into my bitcoin folder, and ran bitcoin, only to find that these new RPC commands are not included/installed.  What do I do?  I don't know C++, I'm not a great programmer, I don't know how to make this work.  Help?  Please?

For now, you need to recompile Bitcoin from its source code to use this. Hopefully this patch will be included in the next release.

But as for your corrupt wallet, I recommend bitcointools. There is a nice guide here: http://forum.bitcoin.org/index.php?topic=11331.0

Darn it, I don't know how to recompile things on windows.  It's easy on linux, just type make, and everything is pre-scripted and it just works.  On windows I have no clue.  As for bitcointools, I tried that already, those hung transactions still are not announcing and being processed, so I want them Gone, deleted, removed.  How do I do that with bitcointools?  The only way I can see is to dump my wallet as a text file, then import that into a new wallet, not including the hung transactions and whatever it is that is causing the problem.  But, I can't do that without "dumpwallet" and the other great RPC commands that I have no ability to use at the moment. Sad
Dynotor
Newbie
*
Offline Offline

Activity: 17
Merit: 0


View Profile
July 03, 2011, 05:07:17 PM
 #33

Can anyone help a git and github newbie like me figure out how to get a diff from the pull request?  Just pointing me towards relevant documentation would be fine... I'm just having trouble finding it.  I'm using linux. 
Pieter Wuille (OP)
Legendary
*
qt
Offline Offline

Activity: 1072
Merit: 1181


View Profile WWW
July 04, 2011, 01:20:13 PM
 #34

Can anyone help a git and github newbie like me figure out how to get a diff from the pull request?  Just pointing me towards relevant documentation would be fine... I'm just having trouble finding it.  I'm using linux.  

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


I do Bitcoin stuff.
krepta3000
Member
**
Offline Offline

Activity: 92
Merit: 10


View Profile
July 05, 2011, 12:33:19 AM
 #35

So, uhm, I'm not a developer, and I've never used GIT.  I'm downloading GIT for windows, msysgit, and I'm going to install it.  Will this enable me to somehow get a version of bitcoin running that will let me do dumpwallet, and import wallet?
Dynotor
Newbie
*
Offline Offline

Activity: 17
Merit: 0


View Profile
July 05, 2011, 10:31:16 PM
 #36

Can anyone help a git and github newbie like me figure out how to get a diff from the pull request?  Just pointing me towards relevant documentation would be fine... I'm just having trouble finding it.  I'm using linux.  

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


Thanks so much, Pieter!!!!!




So, uhm, I'm not a developer, and I've never used GIT.  I'm downloading GIT for windows, msysgit, and I'm going to install it.  Will this enable me to somehow get a version of bitcoin running that will let me do dumpwallet, and import wallet?
Krepta3000, before you bother trying to get git to work on windows, you might just make sure you can compile from the source first.  I haven't tried to do so for windows for bitcoin before, but based on my experience with other open source projects the tool chain requirements for compiling under windows usually is much harder to satisfy than for Linux.  My experience has shown me that using a VM running Linux (using virtualization software like VBox if you don't have a linux box handy) is usually a much easier route.

But... since I don't have experience with bitcoin in this area, I'll defer to anyone else with more direct experience...
rabit
Member
**
Offline Offline

Activity: 62
Merit: 10


View Profile
July 07, 2011, 09:51:24 PM
Last edit: July 08, 2011, 09:22:53 AM by rabit
 #37

Can i also remove a key from the wallet with this patch?

If not how many BTCs would it cost to motivate someone to add this feature?
Hans0
Member
**
Offline Offline

Activity: 91
Merit: 10


View Profile
July 08, 2011, 05:29:00 PM
 #38

I am not sure this a suitable to be on by default. This will cause a great amount of lost bitcoins because unsophisticated users are careless.
SgtSpike
Legendary
*
Offline Offline

Activity: 1400
Merit: 1005



View Profile
July 08, 2011, 05:58:37 PM
 #39

I am not sure this a suitable to be on by default. This will cause a great amount of lost bitcoins because unsophisticated users are careless.

+1

This is fine living in a separate branch.

Being able to recompile a branch is a nice
barrier of entry for the tech. clueless.
This SHOULD be included in the default client.  Reason being, it is incredibly useful for people who know how to use it, and not all of us know how to use linux or feel like spending hours on Windows attempting to compile the source with all of the dependencies.

Discluding a feature like this from anyone who doesn't know how to compile c code would be a terrible thing.
molecular
Donator
Legendary
*
Offline Offline

Activity: 2772
Merit: 1019



View Profile
July 08, 2011, 06:53:09 PM
 #40

I am not sure this a suitable to be on by default. This will cause a great amount of lost bitcoins because unsophisticated users are careless.

+1

This is fine living in a separate branch.

Being able to recompile a branch is a nice
barrier of entry for the tech. clueless.
This SHOULD be included in the default client.  Reason being, it is incredibly useful for people who know how to use it, and not all of us know how to use linux or feel like spending hours on Windows attempting to compile the source with all of the dependencies.

Discluding a feature like this from anyone who doesn't know how to compile c code would be a terrible thing.

+1

I'm actively using this feature and I would love to give out qr-codes (sealed) of privkeys to friends. Actually I gave one to a friend, but he's not supposed to open it before 6/17/2012. So I'd really love to have the feature in default client by that time Wink Otherwise I'd have to compile bitcoin for windows, which I really would like to avoid.

Most "normal" users don't even know they can use RPC commands. I think compiling a branch is too high a barrier.

This is also needed for bitbills, btw, which is a pretty cool project as I think.


PGP key molecular F9B70769 fingerprint 9CDD C0D3 20F8 279F 6BE0  3F39 FC49 2362 F9B7 0769
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!