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

Status
Not open for further replies.

troubled soul

👁️ Quiet Authority
Aug 23, 2020
2,721
0
161
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
 
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.
 
bunchofmolecules said:
1) Coming up with a random number
Click to expand...
This is very difficult.
https://www.mathworks.com/help/stats/generating-random-data.htmlRandom.org can help, if you trust it
bunchofmolecules said:
2) Turning it into a bitcoin private key or seed.
Click to expand...
https://bitcoinmagazine.com/culture/diy-bitcoin-private-key-project
Anyway, you are over complicating it. Just buy a Trezor.

Toggle signature

@JohnnyDoe ”“ Your #1 Source for Guidance in Different Offshore Fields

 
JohnnyDoe said:
This is very difficult.
Click to expand...
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.

JohnnyDoe said:
https://bitcoinmagazine.com/culture/diy-bitcoin-private-key-project
Anyway, you are over complicating it. Just buy a Trezor.
Click to expand...
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.
 
bunchofmolecules said:
Is a casino dice not enough?
Click to expand...
It is in practice, but it is not entirely random: The three-dimensional dynamics of the die throw
bunchofmolecules said:
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).
Click to expand...
Indeed, but we are talking of pure theory here.
bunchofmolecules said:
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.
Click to expand...
Since OP is probably neither a chaos expert nor a programmer, for practical purposes it is less risky for him to “trust” Trezor.

Toggle signature

@JohnnyDoe ”“ Your #1 Source for Guidance in Different Offshore Fields

 
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
 
Forget it all... Don't try to do it yourself... Then you won't be able to find your BTCs again...
 
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);
Click to expand...
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: Jun 7, 2023
 
If you're reading this: please stick to mnemonic phrases and avoid backing up raw private keys, you will thank me later
 
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)
Click to expand...
 
azb1 said:
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
Click to expand...
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.

latindev said:
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)
Click to expand...
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.
 
wellington said:
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.
Click to expand...
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.

JackAlabama said:
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.
Click to expand...
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.
 
JosephLL said:
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.
Click to expand...

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!
 
Status
Not open for further replies.

JohnnyDoe.is is an uncensored discussion forum
focused on free speech,
independent thinking, and controversial ideas.
Everyone is responsible for their own words.

Quick Navigation

User Menu