Our valued sponsor

How to generate your own Bitcoin address and Private key without using any third party tool?

troubled soul

Pro Member
Aug 23, 2020
2,734
1,835
113
Visit site
Hello Everyone....

I want to store my bit coin for Long-term....I do not want to trust any third party app/tools for the same....My plane is to create my own Bitcoin address and Private Key....without using any third party tool....Anybody know how to do this ?

Is anybody try doing this ?

Thanks
 
  • Like
Reactions: JohnLocke
It can be done, but doing it yourself can get errors along the way. Generating a private key can be generalized into two parts:

1) Coming up with a random number
2) Turning it into a bitcoin private key or seed.

You can come up with a random number using dice, or multiple of them. The second part can be outsourced to a 3rd party tool on an airgapped computer. Don't trust the 3rd party tool? Use 2, 3 or even five of them to make sure they spit out the same seed.
 
  • Like
Reactions: bountymounty
This is very difficult.
Is a casino dice not enough? 256 bits of dice is surely random enough and does not require you to trust an RNG. Your suggestion of random.org requires to trust random.org RNG and your computer and the network connection between them. It is inferior to dice in my opinion as it involves more trust required than an actual physical dice in your hands.


Anyway, you are over complicating it. Just buy a Trezor.
Have you read that blog post? That is definitely a more complicated method than I recommended (typing your 256 bits of dice entropy into multiple open source tools on an airgapped computer and getting yourself a nice deterministic wallet of endless addresses and private keys).

In the end you recommend the OP to use Trezor, while their question was how to generate a private key without trusting 3rd parties such as Trezor.
 
1 buy laptop, make sure its vacuum packed
2 open it. Tear up & destroy its lan and wifi and bluetoorh electeical circuits.
3 flip a coin 160 times , make sure you do it alone. Mark each outcome on paper.
4 copy python script on laptop and manually type the outcome string from step3: 100010101111....

5 burn the paper, laptop. Bury the coin somewhere.

6 keep the seed passphrase in yourh head.
 
  • Like
Reactions: JohnLocke
Is a casino dice not enough?
It is in practice, but it is not entirely random: The three-dimensional dynamics of the die throw
Have you read that blog post? That is definitely a more complicated method than I recommended (typing your 256 bits of dice entropy into multiple open source tools on an airgapped computer and getting yourself a nice deterministic wallet of endless addresses and private keys).
Indeed, but we are talking of pure theory here.
In the end you recommend the OP to use Trezor, while their question was how to generate a private key without trusting 3rd parties such as Trezor.
Since OP is probably neither a chaos expert nor a programmer, for practical purposes it is less risky for him to “trust” Trezor.
 
  • Like
Reactions: troubled soul
Ok as a developer my first response is: Do not re-invent the god damn wheel!... But here is how you do it:

- Get the bip39 list in the language of your preference (here is the english one bips/english.txt at master · bitcoin/bips · GitHub).
- Pick 24 words in an fully random way (btw this is not enough to ensure entropy but since you want to do it yourself)
- Use the 24 words to generated a master seed (from here you will generate private keys), you do this by generating a hash using a PBKDF2 method with those 24 words as the source (you can use a passphrase which is normally known as a 25th words mnemonic phrase which I think is misleading but hey I don't make the rules here)
- From the master seed that you got you now need to generate the keys from it based on the blockchain you're using, so here comes BIP44 which is the standard so every wallet handles this in the same way. You generate the keys by doing a derivation in an specific point and you might have seem something like "m / 44' / 0' / 0' / 0 / 0" before in a hardware latter or website... So read it up here: bips/bip-0044.mediawiki at master · bitcoin/bips · GitHub and find the path for your preferred chain
- From that you will get your private keypairs and you will be able to generate more by just changing the path while also being able to recover them from one single 24 words list...

Now, that being said: Doing all of this is useless if you don't know how to build your own wallet because you still need to sign transactions so you will end up adding them to a wallet and so you will be in the same position as if you just had created them with the damn wallet in the first place ;)

Get a trezor or a ledger if you don't know how to build your own because there are more chances you will lock out of your funds before someone actually hacks your devices
 
  • Like
Reactions: void and JohnnyDoe
1.) Generating a random private key is very easy, only 2 lines of code in node.js, if you don't need a seed phrase only a hex private key.
Download from nodejs.org, copy it to another PC that was never connected to the internet.
var crypto = require('crypto');
privateKey = crypto.randomBytes(32).toString('hex');

console.log(privateKey);
Since any 256bit hex number is also a private key we just have to generate a random number, nothing special is required.

2.) Getting the public address corresponding to your key that was generated in step 1 is doable but pretty difficult if you aren't a programmer.
To generate a random hex all you need is the official nodejs crypto module, which is pretty safe, but to derive the address you have to use more than 10 different 3rd party non-official modules, so you either have to read all their source codes or trust them.

For non-programmers probably the best way is to download the offline bitaddress.org website, copy it to another PC that was never connected to the internet, open it, go to Wallet Details and you can see the derived address for the hex keys you generate.
 
Last edited:
  • Like
Reactions: troubled soul
Simple Solution

import random
import ecdsa

def generate_wallet():
# Generate a random private key
private_key = random.getrandbits(256)

# Create a public key from the private key
public_key = ecdsa.SigningKey.from_secret_exponent(private_key, curve=ecdsa.SECP256k1).get_verifying_key().to_public_key()

# Get the Bitcoin address from the public key
address = ecdsa.util.encode_point(public_key, 'bin').decode('hex')[12:]

return private_key, address

if __name__ == '__main__':
private_key, address = generate_wallet()
print('Private key:', private_key)
print('Address:', address)
 
Hello Everyone....

I want to store my bit coin for Long-term....I do not want to trust any third party app/tools for the same....My plane is to create my own Bitcoin address and Private Key....without using any third party tool....Anybody know how to do this ?

Is anybody try doing this ?

Thanks
id advise strongly against it. If you have to ask, the chances of errors are high.
Best buy a trezor and follow the best practices which are online since many years... and it will be fine.

Ok as a developer my first response is: Do not re-invent the god damn wheel!... But here is how you do it:

- Get the bip39 list in the language of your preference (here is the english one bips/english.txt at master · bitcoin/bips · GitHub).
- Pick 24 words in an fully random way (btw this is not enough to ensure entropy but since you want to do it yourself)
this is the underlying problem. How to achieve full randomness. Very difficult to do and what one think is random mostly isnt random at all. stated primitively, its why ai can construct nice sounding language or one can have automatic text correction services etc.
 
  • Like
Reactions: troubled soul
Trezor can be hacked lol

Ledger collects heaps of information (ip, computer etc)

What you want is a airgapped HW wallet - something like Ngrave etc or something card.
This is very difficult.
Random.org can help, if you trust it


Anyway, you are over complicating it. Just buy a Trezor.
 
  • Like
Reactions: troubled soul
Trezor can be hacked lol

Ledger collects heaps of information (ip, computer etc)

What you want is a airgapped HW wallet - something like Ngrave etc or something card.
Every software is hackable, always remember that is not a matter of how but when. For a hacker to hack your Trezor it needs to have access to the device, just like with any other wallet (air gapped wallets included).

About Ledger collecting heaps of information... All wallets/sites/nodes you use also collect them, they are public information for a reason... Some of them tell you what they collect, others just collect them if they want without telling you.

The problem is the marketing, people believe that a hardware wallet is by default all the security you need when is not. In my opinion if someone steals your device you should think of your money as something fully compromised and you should start working in moving the funds to another place.

id advise strongly against it. If you have to ask, the chances of errors are high.
Best buy a trezor and follow the best practices which are online since many years... and it will be fine.


this is the underlying problem. How to achieve full randomness. Very difficult to do and what one think is random mostly isnt random at all. stated primitively, its why ai can construct nice sounding language or one can have automatic text correction services etc.
100% that's why in my comment I said picking 24 words from the bip39 list is not enough to secure a decent amount of entropy, humans tend to select some words over others and that's why it's better to use a software that tries to get them as randomly as possible than doing it manually.
 
1 buy laptop, make sure its vacuum packed
2 open it. Tear up & destroy its lan and wifi and bluetoorh electeical circuits.
3 flip a coin 160 times , make sure you do it alone. Mark each outcome on paper.
4 copy python script on laptop and manually type the outcome string from step3: 100010101111....

5 burn the paper, laptop. Bury the coin somewhere.

6 keep the seed passphrase in yourh head.

All steps are fine, but burying the coin is a rookie mistake. If someone finds it some day, they can trace back all the flipping outcomes and your BTC will be lost!
 
  • Haha
Reactions: latindev
The best option you have is probably to generate seed address with a calculator.

"Generate a Seed Phrase using a calculator."


And I have a perfect guide if you want to learn how to truly keep your crypto safe. The ultimate opsec guide for crypto.

"The Only Safe Way to Store Crypto"

 
  • Like
Reactions: troubled soul