<ol>
<li>Test the windows python code below with the private/public key generated from 
website. Just to verify the correctness. If correct proceed.</li>
<li>Throw coin 256x get your private key.</li>
<li>Throw dice whatever, until you get 256 bits.</li>
<li>enter the private key in the code below.</li>
<li>you should get your bitcoin address.</li>
</ol>

<p>Code:</p>

<pre><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)
</code></pre>

CC BY-SA 4.0
2020-06-15T20:00:07.200Z
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.
Nate Eldredge
CC BY-SA 4.0
2020-06-16T00:53:08.770Z
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] (https://twitter.com/ericsavics1/status/1271589769336598528)
Cisco Mmu
CC BY-SA 4.0
2020-06-16T01:02:07.410Z
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
CC BY-SA 4.0
2020-06-16T12:09:40.810Z
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
CC BY-SA 4.0
2020-06-18T02:08:30.210Z
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
CC BY-SA 4.0
2020-06-18T17:00:15.943Z
don;t sign with a doubtful key ! U can always generate a new one. Just spend your time throwing coins.
Cisco Mmu
CC BY-SA 4.0
2020-06-19T21:12:55.750Z
I do not feel safe with wallets generated keys that I can't see nor store.I want my PK on a piece of paper
Eagle1
CC BY-SA 4.0
2022-03-08T19:29:25.567Z
calculate the public key on paper by hand, so no computer every gets access to it. a bit hard but maximum security if you dont trust computers (or do it on a computer without a network connection and wipe it before reconnecting)
Antoni
CC BY-SA 4.0
2020-06-14T16:35:10.807Z
2020-06-15T17:16:42.260Z
2020-06-15T17:16:42.260Z
Cisco Mmu
<p>The correctness of calculation of an address (and a public key) given a secret-private key can be double checked using another software (if you don't want to use Bitcoin Core), e.g.:</p>
<ul>
<li>Seed Tool <a href="https://bitcoiner.guide/seed/" rel="nofollow noreferrer">https://bitcoiner.guide/seed/</a> -&gt; single address.</li>
<li>pubkeybitcoin <a href="https://github.com/GregTonoski/pubkeybitcoin" rel="nofollow noreferrer">https://github.com/GregTonoski/pubkeybitcoin</a> (public key only).</li>
</ul>
<p>If a public key (or address) is the same as the one calculated by WalletGenerator.net for your secret-private key then I would conclude that your control of the address  has been checked and confirmed.</p>

CC BY-SA 4.0
2024-10-24T08:48:05.523Z
2024-10-24T08:48:05.523Z
Greg Tonoski
<p>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 (<a href="https://github.com/walletgeneratornet/WalletGenerator.net" rel="nofollow noreferrer">https://github.com/walletgeneratornet/WalletGenerator.net</a>) and ran offline.</p>

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

<p>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.</p>

CC BY-SA 4.0
2020-06-15T17:27:02.610Z
It's impossible to "check" if the address is controlled only by one entity (you).
Tony Sanak
CC BY-SA 4.0
2020-06-13T07:16:41.223Z
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
<wallet-security>
How to check that I control an address
Eagle1
# How to check that I control an address

(Asked by: username_0 on 2020-06-13)

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.

**Tags:** wallet-security

> **Comments:**
> **username_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.  
> **username_1**: It's impossible to "check" if the address is controlled only by one entity (you).  

---

## 2 answers

### Answer by username_3 on 2020-06-14. Score: 0

Test the windows python code below with the private/public key generated from 
website. Just to verify the correctness. If correct proceed.
Throw coin 256x get your private key.
Throw dice whatever, until you get 256 bits.
enter the private key in the code below.
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)

> **Comments:**
> **username_4**: 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.  
> **username_3**: 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] (https://twitter.com/ericsavics1/status/1271589769336598528)  
> **username_3**: 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.  
> **username_0**: 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 ?  
> **username_3**: 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.  
> **username_3**: don;t sign with a doubtful key ! U can always generate a new one. Just spend your time throwing coins.  
> **username_0**: I do not feel safe with wallets generated keys that I can't see nor store.I want my PK on a piece of paper  
> **username_5**: calculate the public key on paper by hand, so no computer every gets access to it. a bit hard but maximum security if you dont trust computers (or do it on a computer without a network connection and wipe it before reconnecting)  

---

### Answer by username_6 on 2024-10-24. Score: 0

The correctness of calculation of an address (and a public key) given a secret-private key can be double checked using another software (if you don't want to use Bitcoin Core), e.g.:

* Seed Tool <https://bitcoiner.guide/seed/> -> single address.
* pubkeybitcoin <https://github.com/GregTonoski/pubkeybitcoin> (public key only).

If a public key (or address) is the same as the one calculated by WalletGenerator.net for your secret-private key then I would conclude that your control of the address has been checked and confirmed.


---

