2

I recently created a bunch of bitcoin addresses (public starting with 1, PK starting with 5) from a paper wallet, that I downloaded from their github (https://github.com/walletgeneratornet/WalletGenerator.net) and ran offline.

I imported the first PK in my full node, it translated to the pub address I expected and I control this address.

I don't feel comfortable sending coins to addresses I don't know for sure I control. How can I check securely and "easily" that I control them ? Adding all of those PK in Bitcoin core is long and decreases security.

2
  • 2
    Even though you control the private key, private keys generated by distrusted code shouldn't be used. You might not be the only person to have generated that private key. They might have a long but "short enough that they can scan it" list of private keys and they might be querying the blockchain explorer until they see someone make a payment to it.
    – MCCCS
    Jun 13 '20 at 7:16
  • 1
    It's impossible to "check" if the address is controlled only by one entity (you).
    – Tony Sanak
    Jun 15 '20 at 17:27
0
  1. Test the windows python code below with the private/public key generated from website. Just to verify the correctness. If correct proceed.
  2. Throw coin 256x get your private key.
  3. Throw dice whatever, until you get 256 bits.
  4. enter the private key in the code below.
  5. you should get your bitcoin address.

Code:

# COMMENTS
import bitcoin 
import binascii
PrivKey1 = 'e8ee7398abbbdc8920f53c8fd454e86eab74beae2a9c42d28bf86402f3d87fcb'
PrivKey1Type = bitcoin.get_privkey_format(PrivKey1)
print("Private Key types")
G = bitcoin.encode_privkey(PrivKey1, 'hex',0)
print("Type: hex", G)
G = bitcoin.encode_privkey(PrivKey1, 'hex_compressed',0)
print("Type: hex_compressed",G)
G = bitcoin.encode_privkey(PrivKey1, 'wif',0)
print("Type: wif",G)
G = bitcoin.encode_privkey(PrivKey1, 'wif_compressed',0)
print("Type: wif_compressed",G)    
PubKey1  = bitcoin.privkey_to_pubkey(PrivKey1)
PubKey1type = bitcoin.get_pubkey_format(PubKey1)
H1 = bitcoin.encode_pubkey(PubKey1, 'bin')
print("Public Key")
print("Bin format", H1)
H2 = bitcoin.encode_pubkey(PubKey1, 'bin_compressed')
print("Bin Compressed format", H2)
H3 = bitcoin.encode_pubkey(PubKey1, 'hex')
print("hex format", H3)
H4 = bitcoin.encode_pubkey(PubKey1, 'hex_compressed')
print("Hex Compressed format", H4)
K1 = bitcoin.decode_pubkey(H4)
print("decoded format", K1)
Hash1 = bitcoin.bin_hash160((H1))
print("PubKey Hash from Uncompressed PubKey", binascii.b2a_hex(Hash1))
Hash2 = bitcoin.bin_hash160((H2))
print("PubKey Hash from compressed PubKey", binascii.b2a_hex(Hash2))
BTCaddress = bitcoin.pubkey_to_address(PubKey1, 0)
print("Bitcoin Address", BTCaddress)
7
  • 3
    This doesn't ensure that only you control the address. If you have malware on your computer, your private key could have been sent elsewhere the instant you typed it in. Jun 15 '20 at 20:00
  • in my answer, i asked the user to generate their private key by throwing coin 256x. He can run the code offline. Malware issue is beyond the scope of discussion. Even hardware wallet got bug with malware.[link] (twitter.com/ericsavics1/status/1271589769336598528)
    – Cisco Mmu
    Jun 16 '20 at 0:53
  • Since 2016, i go through some length advise explanation here and there but in the end i still got nowhere. So, I decided randomness is best using throwing coins. and the algorithm to generate addresses is fixed. So I wrote the above code. U can use it. rather than lengthy comment, u get a code for secure generation of BTC address. If you are paranoid, then you look at the library call as well.
    – Cisco Mmu
    Jun 16 '20 at 1:02
  • this is close to what I want. However it doesn't check on the bitcoin network, just because the pub key generated from the PK is the same that I had originally, it should mean I can sign with this key ?
    – Eagle1
    Jun 16 '20 at 12:09
  • well, at least it is correct! if in doubt U can always try it with a tiny amount first! but then most wallet already have BIP 32 /44 where address is used only once. that one i need more time to code as i not a good programmer.
    – Cisco Mmu
    Jun 18 '20 at 2:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.