Bitcoin Forum
November 07, 2024, 02:23:42 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: How to "test" a private key?  (Read 13893 times)
501 (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
November 19, 2013, 11:58:35 PM
 #1

I am currently keeping 90% of my BTC in cold storage on paper wallets. Now I want to start generating my paper wallets with encrypted private keys (just using a cipher of my choice to encode the key before printing it out). However, I'm a little nervous that I'll make a mistake when encoding it, and then the funds I send there will be lost.

I was wondering if there would be a way to test the private key to see if I've actually written it down correctly, but without connecting to the network while doing this (because I want these wallets to remain pure cold storage). Just for my own peace of mind.

Is there any way to do this?
daoneway
Full Member
***
Offline Offline

Activity: 149
Merit: 100



View Profile
November 20, 2013, 12:03:04 AM
 #2

send small amount of btc?

3MJprz7GLVjQaFHx7hhVErPVYugKNxKs1Y
Patel
Legendary
*
Offline Offline

Activity: 1320
Merit: 1007



View Profile WWW
November 20, 2013, 12:04:06 AM
 #3

Download bitaddress.org save html file, go on offline computer, go to wallet details tab, enter private key, see if address matches what you have
501 (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
November 20, 2013, 04:35:21 AM
 #4

Download bitaddress.org save html file, go on offline computer, go to wallet details tab, enter private key, see if address matches what you have

Thanks, that sounds like it will work.

@daoneway I meant testing the private key. I know the public address is correct because I didn't encode that.
Dabs
Legendary
*
Offline Offline

Activity: 3416
Merit: 1912


The Concierge of Crypto


View Profile
November 20, 2013, 04:52:35 AM
 #5

Use bitcoin-qt.
Use offline computer.
Run bitcoin-qt.
Use importprivkey with the unencrypted private key.
Check the address if it's there.
Securely erase or wipe wallet.dat of offline computer.

deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1036



View Profile WWW
November 20, 2013, 09:34:01 AM
 #6

What you should be doing is testing the methodology used to create multiple keys, not testing a particular key.

Spending money sent to an offline address removes the associated security:
  • The private key must be put on an online computer system in order to spend the money, where it may be compromised, and,
  • Spending from an address reveals it's public key, which may reduce cryptography robustness.

Generate multiple paper wallets at the same time using the same method. Spend a test amount of bitcoins sent to one wallet (and discard it), ensuring that your creation and spending method is not flawed.
501 (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
November 20, 2013, 04:47:02 PM
 #7

What you should be doing is testing the methodology used to create multiple keys, not testing a particular key.

Spending money sent to an offline address removes the associated security

I know, I don't want to actually spend any of the money associated with the paper wallet. I just want to check that I encoded and printed the private key correctly, so that in the future when I want to spend the money I don't discover that I made a mistake and the money is lost.

I think Patel and Dabs' solutions will both work, I'm going to test them today.
Dabs
Legendary
*
Offline Offline

Activity: 3416
Merit: 1912


The Concierge of Crypto


View Profile
November 21, 2013, 01:33:23 AM
 #8

Yes, doing an actual test import on a brand new wallet on an offline computer using bitcoin-qt that you securely delete later should allow you to check that you can do it in the future.

For the most part, all my vanitygen generated compressed keys work; you can use any prefix or just 1 to make a lot of them and pick one. If you make wallets using dice or true random numbers, bitaddress.org also works.

For bitaddress.org I use the compressed version. For the brain wallet, I input the passphrase, then I get the resulting uncompressed private key, I put that in the wallet details tab, and use the compressed version of the address and private key.

That has not failed me.

501 (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 0


View Profile
November 21, 2013, 04:48:59 AM
 #9

For bitaddress.org I use the compressed version. For the brain wallet, I input the passphrase, then I get the resulting uncompressed private key, I put that in the wallet details tab, and use the compressed version of the address and private key.

That has not failed me.

Thanks. I haven't tried a brain wallet yet, just normal paper wallets where I encoded the keys before printing them. So just went ahead and booted an offline machine again, decoded the keys myself and then entered them into bitaddress to make sure the address it gave me matched, and it did, so I'm assuming everything is good.
tyz
Legendary
*
Offline Offline

Activity: 3360
Merit: 1533



View Profile
December 25, 2015, 03:13:10 PM
 #10

Sorry, to reactivate this two years old thread but I have got a similar question. I created paper wallets using offline Bitaddress.org.
Now, I want to verify that the generated private keys fit to the public keys. Just to get sure that the algorithm of the downloaded source of Bitaddress.org is not damaged in any way. Is there a little Python or C++ comand tool to verify the keys offline?
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
December 25, 2015, 07:33:31 PM
 #11

Sorry, to reactivate this two years old thread but I have got a similar question. I created paper wallets using offline Bitaddress.org.
Now, I want to verify that the generated private keys fit to the public keys. Just to get sure that the algorithm of the downloaded source of Bitaddress.org is not damaged in any way. Is there a little Python or C++ comand tool to verify the keys offline?
You could try pybitcointools: https://github.com/vbuterin/pybitcointools

tyz
Legendary
*
Offline Offline

Activity: 3360
Merit: 1533



View Profile
December 27, 2015, 07:56:14 PM
 #12

Thanks, this was exactly what i was looking for. Very easy to use. Did not know that Valerin Buterin has released a set of Bitcoin tools based on Python.

Sorry, to reactivate this two years old thread but I have got a similar question. I created paper wallets using offline Bitaddress.org.
Now, I want to verify that the generated private keys fit to the public keys. Just to get sure that the algorithm of the downloaded source of Bitaddress.org is not damaged in any way. Is there a little Python or C++ comand tool to verify the keys offline?
You could try pybitcointools: https://github.com/vbuterin/pybitcointools
adaseb
Legendary
*
Offline Offline

Activity: 3878
Merit: 1733


View Profile
November 19, 2016, 06:09:39 AM
 #13

Sorry to re-bump this old thread. But I am a little paranoid whether I will be able to actually spend the Bitcoin wallet that I created offline.

I know you can use bitaddress.org AND the importprivkey with bitcoind and you can easily check if the PRIVATE key matches the PUBLIC key.

However I am concerned with this situation
http://www.reddit.com/r/Bitcoin/comments/2t3vn0/i_cant_send_my_btc_a_triangle_apear_i_use_multibit/

Basically he created an offline wallet but due to some bug he cant ever spent that bitcoin due to some exponent bug.

I heard that the best way to see if you can actually spend the BTC is to SIGN and VERIFY a message offline. However I can't find an website which does this at the moment.
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
November 19, 2016, 06:32:04 AM
 #14

Sorry to re-bump this old thread. But I am a little paranoid whether I will be able to actually spend the Bitcoin wallet that I created offline.

I know you can use bitaddress.org AND the importprivkey with bitcoind and you can easily check if the PRIVATE key matches the PUBLIC key.

However I am concerned with this situation
http://www.reddit.com/r/Bitcoin/comments/2t3vn0/i_cant_send_my_btc_a_triangle_apear_i_use_multibit/

Basically he created an offline wallet but due to some bug he cant ever spent that bitcoin due to some exponent bug.

I heard that the best way to see if you can actually spend the BTC is to SIGN and VERIFY a message offline. However I can't find an website which does this at the moment.
There are a few ways to check the validity of the key.

First, you can decode the base58 check encoding to get the raw hex of the private key. Then just check that that number is between 1 and 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 inclusive. Obviously if you happen to get a key that is either of those two numbers, you should generate a new key.

You can also install electrum or Bitcoin Core on the machine itself and sign and verify a message to ensure that the key works.

adaseb
Legendary
*
Offline Offline

Activity: 3878
Merit: 1733


View Profile
November 19, 2016, 07:36:24 AM
 #15

Sorry to re-bump this old thread. But I am a little paranoid whether I will be able to actually spend the Bitcoin wallet that I created offline.

I know you can use bitaddress.org AND the importprivkey with bitcoind and you can easily check if the PRIVATE key matches the PUBLIC key.

However I am concerned with this situation
http://www.reddit.com/r/Bitcoin/comments/2t3vn0/i_cant_send_my_btc_a_triangle_apear_i_use_multibit/

Basically he created an offline wallet but due to some bug he cant ever spent that bitcoin due to some exponent bug.

I heard that the best way to see if you can actually spend the BTC is to SIGN and VERIFY a message offline. However I can't find an website which does this at the moment.
There are a few ways to check the validity of the key.

First, you can decode the base58 check encoding to get the raw hex of the private key. Then just check that that number is between 1 and 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 inclusive. Obviously if you happen to get a key that is either of those two numbers, you should generate a new key.

You can also install electrum or Bitcoin Core on the machine itself and sign and verify a message to ensure that the key works.

So using
http://lenschulwitz.com/base58

Say my private key is:
L2vDMT2mY9AiNYZgnfK8tBoCh55XWS76h8bdM2Y3wGfnf4R2EamP

Decoding results in:
80AA05F15D112414670BAD47FCCC52AD6486D5CB33BEA4463E8DFF0C5B1C1F4D150146441A8A

So as long as it doesn't start with a 0 it should be good?





achow101
Moderator
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
November 19, 2016, 03:07:26 PM
 #16

So using
http://lenschulwitz.com/base58

Say my private key is:
L2vDMT2mY9AiNYZgnfK8tBoCh55XWS76h8bdM2Y3wGfnf4R2EamP

Decoding results in:
80AA05F15D112414670BAD47FCCC52AD6486D5CB33BEA4463E8DFF0C5B1C1F4D150146441A8A

So as long as it doesn't start with a 0 it should be good?
Close. First you drop the first byte (0x80) and the last 4 (0x46441A8A). What remains is the actual private key. So long as that is not all zeros or that it does not begin with a bunch of F's, it should be good.

Dabs
Legendary
*
Offline Offline

Activity: 3416
Merit: 1912


The Concierge of Crypto


View Profile
November 19, 2016, 06:01:05 PM
 #17

Say my private key is:
L2vDMT2mY9AiNYZgnfK8tBoCh55XWS76h8bdM2Y3wGfnf4R2EamP

1. Launch Bitcoin Core (can be offline)
2. Open console
3. type importprivkey L2vDMT2mY9AiNYZgnfK8tBoCh55XWS76h8bdM2Y3wGfnf4R2EamP
4. See if you get a new address in the wallet
5. Securely erase / restart tails / revert VM / toss a grenade / shoot computer / burn in thermite


My post from 3 years ago has not changed.

SmartIphone
Legendary
*
Offline Offline

Activity: 1204
Merit: 1000



View Profile
November 19, 2016, 06:08:48 PM
 #18

Besides all suggestions above I would do like this
1) Download brain wallet (a copy is here http://wallet-2sx53n.sakurity.com/ , or in github)
2) (Offline) Sign a message, if it works then it's ok.
adaseb
Legendary
*
Offline Offline

Activity: 3878
Merit: 1733


View Profile
November 19, 2016, 11:37:03 PM
 #19

So using
http://lenschulwitz.com/base58

Say my private key is:
L2vDMT2mY9AiNYZgnfK8tBoCh55XWS76h8bdM2Y3wGfnf4R2EamP

Decoding results in:
80AA05F15D112414670BAD47FCCC52AD6486D5CB33BEA4463E8DFF0C5B1C1F4D150146441A8A

So as long as it doesn't start with a 0 it should be good?
Close. First you drop the first byte (0x80) and the last 4 (0x46441A8A). What remains is the actual private key. So long as that is not all zeros or that it does not begin with a bunch of F's, it should be good.

When I put in

AA05F15D112414670BAD47FCCC52AD6486D5CB33BEA4463E8DFF0C5B1C1F4D1501

I get an error:

Cannot Decode! Invalid Base58 Character(s)!



Say my private key is:
L2vDMT2mY9AiNYZgnfK8tBoCh55XWS76h8bdM2Y3wGfnf4R2EamP

1. Launch Bitcoin Core (can be offline)
2. Open console
3. type importprivkey L2vDMT2mY9AiNYZgnfK8tBoCh55XWS76h8bdM2Y3wGfnf4R2EamP
4. See if you get a new address in the wallet
5. Securely erase / restart tails / revert VM / toss a grenade / shoot computer / burn in thermite


My post from 3 years ago has not changed.

But as you sure I will be able to spend the funds even though the privkey prints the public key? I am concerned about the bug listed here
http://www.reddit.com/r/Bitcoin/comments/2t3vn0/i_cant_send_my_btc_a_triangle_apear_i_use_multibit/

Besides all suggestions above I would do like this
1) Download brain wallet (a copy is here http://wallet-2sx53n.sakurity.com/ , or in github)
2) (Offline) Sign a message, if it works then it's ok.


Is there a difference of that brain wallet sign/verify function compared to the one found in the bitcoin core ?
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
November 20, 2016, 12:11:49 AM
 #20

When I put in

AA05F15D112414670BAD47FCCC52AD6486D5CB33BEA4463E8DFF0C5B1C1F4D1501

I get an error:

Cannot Decode! Invalid Base58 Character(s)!
That's because it isn't a base 58 check encoded private key (what you normally think of as a private key). That is the hex of the actual private key, just a really big number.

Pages: [1] 2 »  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!