Bitcoin Forum
April 26, 2024, 01:46:43 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 [3]  All
  Print  
Author Topic: Wallet Import Format  (Read 6641 times)
TT (OP)
Member
**
Offline Offline

Activity: 77
Merit: 10



View Profile
November 17, 2011, 06:44:24 AM
 #41

I got it!!!!

I ended up adding a bunch of tracers into the satoshi client to give me hex dumps of stuff so I would have some concrete examples to work with.

Thanks for all the help. I'm sure I'll have other issues later on, though Smiley
1714139203
Hero Member
*
Offline Offline

Posts: 1714139203

View Profile Personal Message (Offline)

Ignore
1714139203
Reply with quote  #2

1714139203
Report to moderator
1714139203
Hero Member
*
Offline Offline

Posts: 1714139203

View Profile Personal Message (Offline)

Ignore
1714139203
Reply with quote  #2

1714139203
Report to moderator
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
TT (OP)
Member
**
Offline Offline

Activity: 77
Merit: 10



View Profile
November 17, 2011, 12:53:56 PM
 #42

In case anyone's interested in the hex dump of the data to be hashed in the above example, it's

0100000001fbe470cf995c04ecaa82fc2d4ae598075e21986700b544f660ffea93a6a82fe501000 0001976a914211f0c809a1a14f46af53ae59aa32d02aaf7272488acffffffff0180969800000000 001976a9148073e789954e05c5938c5cc493308f9021539bb588ac0000000001000000
hashman
Legendary
*
Offline Offline

Activity: 1264
Merit: 1008


View Profile
November 21, 2011, 02:13:44 PM
 #43

Thanks for your work here !

I'm still waiting for somebody to put together a nice RFC to describe these things..   does that seem a possibility for the future? 
TT (OP)
Member
**
Offline Offline

Activity: 77
Merit: 10



View Profile
November 24, 2011, 02:49:06 AM
 #44

Man, it's so frickin' hard to find good OpenSSL library documentation... Sad

It's a little frustrating.

Would anyone happen to know how to create an ECDSA key using only the 32-byte private key format rather than the 279 byte DER format?

For the 279 byte DER format, I know you can do something like:
Quote
EC_KEY* pKey;
d2i_ECPrivateKey(&pKey, &privateKey, privateKeyLength);

But this only seems to work for the 279 byte DER form for the private key.

I'd like to know what sequence of calls to the OpenSSL library to use to get the full 279 byte DER private key  from a 32-byte private key...as, for instance, https://bitcointools.appspot.com/ can do.

Thanks.

-TT
TT (OP)
Member
**
Offline Offline

Activity: 77
Merit: 10



View Profile
November 24, 2011, 08:33:05 PM
 #45

Ah, I got it!

It's all in the key.h source that's part of the satoshi client.
https://github.com/bitcoin/bitcoin/blob/master/src/key.h

CKey::GetPrivKey and CKey::SetPrivKey are accessor methods for the 279-byte DES private key.
CKey::GetSecret and CKey::SetSecret are accessor methods for the 32-byte private key.

Those of you who are interested in the OpenSSL calls needed, it's all spelled out in key.h

-TT
casascius
Mike Caldwell
VIP
Legendary
*
Offline Offline

Activity: 1386
Merit: 1136


The Casascius 1oz 10BTC Silver Round (w/ Gold B)


View Profile WWW
November 26, 2011, 01:52:48 AM
 #46


Would anyone happen to know how to create an ECDSA key using only the 32-byte private key format rather than the 279 byte DER format?

Sure, just pick a random 32-byte number.

Nearly all 32-byte numbers are valid private keys.  The ones that aren't valid as private keys all start with a large number (at least forty-eight) of zero bits, or a large number of one bits, all in a row.  At random, the likelihood of hitting them is so low as to be ignorable.

Companies claiming they got hacked and lost your coins sounds like fraud so perfect it could be called fashionable.  I never believe them.  If I ever experience the misfortune of a real intrusion, I declare I have been honest about the way I have managed the keys in Casascius Coins.  I maintain no ability to recover or reproduce the keys, not even under limitless duress or total intrusion.  Remember that trusting strangers with your coins without any recourse is, as a matter of principle, not a best practice.  Don't keep coins online. Use paper or hardware wallets instead.
Pages: « 1 2 [3]  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!