Need help creating my own key pair

4 replies 193 views
GigaStackMember
Posts: 4 · Reputation: 135
#1Nov 4, 2021, 02:02 PM
So, I’m pretty new to this whole thing. I’ve been dollar-cost averaging into BTC on Binance for the last half a year, but I’m done with centralized exchanges. I want to have my own keys now. I found some articles online and played around with chat-gpt to generate my key pair locally like this: First, I used the secp256k1 elliptic curve to make a private key: > openssl ecparam -genkey -name secp256k1 -noout -out privatekey.pem Then, I grabbed the matching public key on the curve: > openssl ec -in privatekey.pem -pubout -out publickey.pem Next, I derived an address using Python: from ecdsa import VerifyingKey import hashlib import base58 def generate_bitcoin_address_from_public_key(public_key_bytes): public_key = VerifyingKey.from_pem(public_key_bytes) # Hash the public key hash_pubkey = hashlib.sha256(public_key.to_string()).digest() hash_pubkey_ripemd160 = hashlib.new('ripemd160', hash_pubkey).digest() version_byte = b'\x00' hash_pubkey_with_version = version_byte + hash_pubkey_ripemd160 checksum = hashlib.sha256(hashlib.sha256(hash_pubkey_with_version).digest()).digest()[:4] binary_address = hash_pubkey_with_version + checksum bitcoin_address = base58.b58encode(binary_address).decode('utf-8') return bitcoin_address with open('publickey.pem', 'r') as file: public_key_pem = file.read() bitcoin_address = generate_bitcoin_address_from_public_key(public_key_pem.encode('utf-8')) print("Bitcoin Address:", bitcoin_address) And this is what I got: BEGIN EC PRIVATE KEY MHQCAQEE IDRd6/hvSUmI3jubQv+FEve/bkPRBi4d4ddCKf1Cdz8yoAcGBSuBBAAK oUQDQgAEr6/Q3oyxMl6Fourug/AVW2a/WyrhoGDPP0iXBPp2rEKSRF+p1G5DL7BL gFsOOBN/U0IT3iiw7agk/DCTxEO0wQ=
5 Reply Quote Share
matrix365Senior Member
Posts: 184 · Reputation: 1104
#2Nov 6, 2021, 09:38 PM
You complicate your life because there are open source Bitcoin softwares to use Bitcoin Core, Electrum and more. [General] Bitcoin Wallets - Which, what, why? You can use the wallet software to create your wallet, backup, and use it to store your bitcoin. [GUIDE] How to Safely Download and Verify Electrum
6 Reply Quote Share
GigaStackMember
Posts: 4 · Reputation: 135
#3Nov 6, 2021, 11:14 PM
Thanks for the documentation. I'm checking it out rn. How to keep my DCA going on when migrating to a cold/paper wallet ? Do i still have to buy through a CEX manually every week ?
3 Reply Quote Share
byte_protoFull Member
Posts: 84 · Reputation: 625
#4Nov 7, 2021, 06:58 PM
Actually its more better to go Hardware wallet which is still the best option for cold wallet and i will advice you to go for Trezor hardware wallet, this thread will be helpful in your choice of picking though 55 Hardware Wallets, compared feature by feature Actually this is up to you, though there are Decentralise exchanges like peachbitcoin.com and others you can find here https://kycnot.me/ this also will be helpful in addition to what hd49728 shared Protect yourself from fake wallet software (guide)
4 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#5Nov 9, 2021, 06:58 AM
The standard paper wallet backup for Bitcoin private keys is "WIF" (wallet import format). More info: learnmeabitcoin.com/technical/keys/private-key/wif/ For public key, hex with compression prefix (pubKey isn't usually required to write in the backup). More info: learnmeabitcoin.com/technical/keys/public-key/ However, those base64 strings when decoded don't look right, Better stick to open-source software/hardware wallets than use the output from that script. You can still use what you're familiar with (CEX to purchase) or use P2P. But I would only suggest you to send bitcoin from the Exchange to your cold storage wallet when you accumulate a significant amount. That's not only to minimize the accumulated fee when sending from exchange, but also to minimize the number of UTXO your wallet will be keeping. The goal is to keep only a few higher value unspent outputs so that your wallet wouldn't have to use a lot of inputs in your future transactions. The lower number of inputs, the lower the transaction's size will be; lower the transaction size results to lower absolute fee. If you want to go P2P, you can use P2P exchanges available in your Country or purchase from users in this forum in Currency Exchange board. Link: http://bitcointalk.org/index.php?board=53.0 (make use the "Trust system" since this is quite risky)
3 Reply Quote Share
?Reply
Sign in to reply to this topic

Related topics