Search content
Sort by

Showing 17 of 17 results by Phobos_Quake
Post
Topic
Board Development & Technical Discussion
Re: I made my own code to Create your own Bitcoin address (Python)
by
Phobos_Quake
on 25/12/2024, 19:43:22 UTC
I have this code:

It creates a 18 words seed phrase, and shows its BIP32 Root Key. With this, you can use the seed words in Electrum (or any BIP39 compatible wallet) and with the BIP32 Root Key you can import the same wallet in Bitcoin core (using importdescriptors command).

If you already have one seed phrase, it returns just the BIP32 Root Key.

It looks fine, but gotta be careful that you are trusting a third-party for the entropy and you will have to use the output of that code on wallets that actually support it, like Electrum. Not all wallets support other than 12 or 24 words. Or other limits.
Post
Topic
Board Development & Technical Discussion
Re: I made my own code to Create your own Bitcoin address (Python)
by
Phobos_Quake
on 25/12/2024, 19:33:43 UTC
Nice work mate but a few point to mention
First :
Handling private keys and seed phrases in plaintext is inherently risky. You stand at a very high risk if an attacker gets hold of your system.

Quote
user_variable = "test"
Using user_variable for entropy is highly risky. Assuming a user provides a weak or predictable input?. Despite introducing randomness via salting understanding the strength of the entropy greatly relies on the quality of the user input


Yes, first, i stated at the fist post to turn off the internet on the system before running the code.
And i know that if the user chooses a weak entropy it runs risk of the private key getting cracked. That's why i also stated the entropy should be a large text, mix languages, roll your face over the keyboard, all together.

Post
Topic
Board Bitcoin Discussion
Re: Bitcoin mass adoption and transactions fees
by
Phobos_Quake
on 25/12/2024, 19:25:24 UTC
I keep reading the argument that if you hold a substantial amount of Bitcoin or if you invest big quantities monthly, you won't care about fees.

But what about all the people that are starting or will start out investing into Bitcoin? High transactions fees will push them away from investing or DCA.
And i haven't raised the argument of Bitcoin as a currency. I know it's meant to be moved slow and as a store of value, not daily transactions. But even then, if you intend to buy Bitcoin every month, costly fees are painful.
Post
Topic
Board Development & Technical Discussion
Topic OP
Bitcoin mass adoption and transactions fees
by
Phobos_Quake
on 20/12/2024, 04:46:36 UTC
I'm worried about fees going too high when Bitcoin gets mass adopted. (I don't need to explain, 1 block every 10 minutes)

If Bitcoin fees go to $100 or more per transactions, then it's not viable for low and middle class, for mundane tasks like transferring some to someone, DCA a monthly low amount,etc

Layer 2 doesn't seem to be the solution. Layer 2 means risk.
The beauty of Bitcoin is how secure it is to just store your Bitcoins on the layer 1
Post
Topic
Board Development & Technical Discussion
Re: I made my own code to Create your own Bitcoin address (Python)
by
Phobos_Quake
on 18/12/2024, 17:11:41 UTC
BIP32 is applicable to both Bitcoin and Ethereum: BIP32 is a standard for hierarchical deterministic (HD) key generation and is used in both Bitcoin and Ethereum, among other cryptocurrencies.

Bech32 is used for SegWit addresses. If you're generating a Legacy or P2SH address, you'll need to use Base58Check encoding instead.

And you can see at the end of the code that IT IS showing the WIF format for a private key.
Post
Topic
Board Development & Technical Discussion
Re: I made my own code to Create your own Bitcoin address (Python)
by
Phobos_Quake
on 03/12/2024, 15:12:39 UTC
I have found an error with my code. The seed phrase had no connection with the private key, which it would make it impossible to restore it with the seed phrase it printed.
An AI search helped me detect it.

"Incorrect Derivation of the Master Key:
In BIP32, the master key is derived from the seed using HMAC-SHA512 with a specific key (b"Bitcoin seed"), not hashlib.pbkdf2_hmac as you are using.
Your code uses hashlib.pbkdf2_hmac to derive the master key, which is not part of the BIP32 standard.

Private Key Derivation:

The private key is not directly derived from the master key. Instead, BIP32 defines a hierarchical deterministic (HD) wallet structure where private keys are derived from the master key using child key derivation (CKD) functions.

Bech32 Address Generation:

The Bech32 address generation in your code is not following the correct derivation path. For a valid Bech32 address, you need to derive the public key from the private key and then hash it using SHA256 and RIPEMD-160 before encoding it into Bech32 format."

Here is the corrected code:

import hashlib
from mnemonic import Mnemonic
from bip32utils import BIP32Key
import bech32

# Input your entropy code
entropy_code = ""  # IMPORTANT: After running the program, erase your code
# Convert the entropy code to bytes
entropy = bytes.fromhex(entropy_code)

# Generate a BIP39 mnemonic phrase
mnemonic = Mnemonic("english")
words = mnemonic.to_mnemonic(entropy)  # 12-word phrase

# Derive a seed from the mnemonic phrase
seed = mnemonic.to_seed(words)

# Derive the master key from the seed using BIP32
bip32_master_key = BIP32Key.fromEntropy(seed)

# Get the private key (hexadecimal) from the master key
private_key = bip32_master_key.PrivateKey()

# Convert private key to WIF format
wif_private_key = bip32_master_key.WalletImportFormat()

# Derive the public key
public_key = bip32_master_key.PublicKey()

# Hash the public key to generate the Bech32 address
hashed_public_key = hashlib.new('ripemd160', hashlib.sha256(public_key).digest()).digest()

# Generate the Bech32 address
hrp = "bc"  # Human-readable part for Bitcoin mainnet addresses
witver = 0  # Witness version (0 for Pay-to-Witness-Public-Key-Hash addresses)
bech32_address = bech32.encode(hrp, witver, hashed_public_key)

# Print the Bitcoin private key (WIF format), mnemonic phrase, and Bech32 address
print("Bitcoin Private Key (WIF format):", wif_private_key)
print("Bitcoin Private Key (Hexadecimal):", private_key.hex())
print("BIP39 Mnemonic Phrase:", words)
print("Bech32 Address:", bech32_address)
Post
Topic
Board Electrum
Re: Adding a seed phrase to your wallet on Electrum?
by
Phobos_Quake
on 28/06/2024, 22:42:40 UTC
Thanks.

I hope is not too off-topic but regarding "Custom Word extensions" to the seed phrase.

How does this work? Because i guess that if i try to import a seed phrase to another wallet, let's say "BitcoinCore" i don't think they will support the extension of custom words i added to my seed phrase?
Post
Topic
Board Electrum
Re: Adding a seed phrase to your wallet on Electrum?
by
Phobos_Quake
on 28/06/2024, 16:12:32 UTC
For people wondering about my script to create a bitcoin address, i actually made a post showing how it works

https://bitcointalk.org/index.php?topic=5489456.msg63825931#msg63825931
Post
Topic
Board Electrum
Re: Adding a seed phrase to your wallet on Electrum?
by
Phobos_Quake
on 05/06/2024, 17:22:00 UTC
Thank you.

Yes, i created my own Private, public key and seed phrase on my own with my own script.

But the option of just importing the seed phrase and Electrum makes it bech32 works for me.

I know Electrum is open-source but you would rely on the community to find something fishy in the code, you yourself won't go on each update and read the whole code of Electrum. That's why i wanted to create my own private key.
Post
Topic
Board Electrum
Topic OP
Adding a seed phrase to your wallet on Electrum?
by
Phobos_Quake
on 05/06/2024, 16:45:50 UTC
Hi, i have created my own private key, public key and seed phrase.

But i can't see the option to add a seed phrase to my private key.
When i created my wallet it asks you to set a type of address and the private key, i created a bech32 address with the private key successfully.

Is there a way to add my seed phrase to that private key?

If i start a new wallet and use the seed phrase i have instead, can i make it bech32?
Post
Topic
Board Bitcoin Discussion
Re: Mempool Observer Topic
by
Phobos_Quake
on 20/04/2024, 01:17:08 UTC
Yes, a bit worrisome if some entities get together to keep Bitcoin fees high for a period of time. Expensive, but possible.
Post
Topic
Board Bitcoin Discussion
Re: Mempool Observer Topic
by
Phobos_Quake
on 20/04/2024, 01:01:54 UTC

[/quote]

alot of people wanted to get their UTXO in block 840,000 so paid stupid fee's to outbid competition, not everyone could get in so some are getting their tx added in later blocks so expect the fee's to be high, out of stupid milestone notoriety hopes

we will see this wave of idiocy of 840k notoriety bidding war die down and then go back to the idiocy of the newest junk/scam spam of runes that replaced the brc ordinals scam spam
[/quote]

Thank you, i didn't understand why fees went up.
Post
Topic
Board Service Discussion
Re: Best and cheap Non-KYC P2P for Bitcoin?
by
Phobos_Quake
on 23/03/2024, 16:54:24 UTC
I tried THORswap, they charge you $20 fee. So much for their advertisement of having native BTC.

If you're using Ethereum, then you're being charged Ethereum transaction fees (which are pretty high). You're going to get that high of a fee regardless of what smart contract you're going to use.


ETH? I was using Native Rune for Native BTC and the fee was $20 i also tried with BNB USDT on THORswap and the same thing.
Post
Topic
Board Service Discussion
Re: Best and cheap Non-KYC P2P for Bitcoin?
by
Phobos_Quake
on 21/03/2024, 21:10:14 UTC
I tried THORswap, they charge you $20 fee. So much for their advertisement of having native BTC
Post
Topic
Board Currency exchange
Re: Best and cheap Non-KYC P2P for Bitcoin?
by
Phobos_Quake
on 19/03/2024, 17:38:18 UTC
Thanks, i'll check them out.

Yes, i want some that allow stable coins for buying BTC, i have seen many that charge you a premium like %4 above BTC price, sometimes the minimum quantity to buy is too high and then the website itself charge you a high BTC fee to transfer to your BTC address.

Agoradesk seems good
Post
Topic
Board Development & Technical Discussion
Topic OP
I made my own code to Create your own Bitcoin address (Python)
by
Phobos_Quake
on 19/03/2024, 02:34:27 UTC
So, i haven't found many places online that provides you a way to create your own address.
We have https://www.bitaddress.org (They also have an offline use method) But it doesn't create a bech32 address (Which provides cheaper fees) and i'm not sure they allow you to generate a seed-phrase.

One of the reason as to why i wanted full control on my Bitcoin keys creation is because is hard to verify that non-custodial wallets really don't know your private keys. You would need to use a packet sniffer like Wireshark at the moment that you use your seed phrase to access your wallet to see what packets are sent to the wallet provider, and even then, it's hard to know what information is shared to them.
Of course, you might have to interact with a wallet software the moment you want to withdraw your coins, but creating your own valid address can be useful as paper wallet till then.

Another problem i wanted to address is "Entropy". One of the reasons they warn you to not create your own address is because your entropy method might be weak and could be hacked.

Now, i'm no expert at Bitcoin nor Python, so one of the purposes of sharing my code is also to hear feedback on vulnerabilities or inefficiencies it might have.
To execute this code i used Spyder with anaconda interpreter (Downloaded needed libraries through anaconda)

1) Create your own entropy

import hashlib
import os

def generate_entropy_from_input(user_input):
    salt = os.urandom(16)  # Generate a random salt
    encoded_input = user_input.encode('utf-8')
    sha512_hash = hashlib.sha512(salt + encoded_input).digest()  # Use a stronger hashing algorithm
    entropy = sha512_hash[:16]  # Adjust the length of entropy as per your requirements
    return entropy.hex()

user_variable = "test" #Choose your input here for entropy #IMPORTANT: erase your input after running the program
entropy_code = generate_entropy_from_input(user_variable)
print("Entropy Code:", entropy_code)


On the line "user_variable = "test" #Choose your input here for entropy #IMPORTANT: erase your input after running the program"
We can erase test and input whatever we want in there, you can roll your face over your keyboard, type a book story in different languages,etc and make sure it makes no sense in the end so no one can guess your entropy.

On top of that, i added random salting so each time you run this code, the entropy result code will be different even if the entropy is the same (This is to safe guard in case someone ends up saving the code file with the last entropy input they have used)

Now, when we ran that code, it gave us a result in hex that we can use on the next step.

2) Create your own Bitcoin address

import hashlib
import bip32utils
from mnemonic import Mnemonic
import bech32
import base58

# Input your entropy code
entropy_code = ""  # IMPORTANT: After running the program, erase your code
# Convert the entropy code to bytes
entropy = bytes.fromhex(entropy_code)

# Generate a BIP39 mnemonic phrase
mnemonic = Mnemonic("english")
words = mnemonic.to_mnemonic(entropy)  # 12-word phrase

# Derive a seed from the mnemonic phrase
seed = mnemonic.to_seed(words)

# Derive a master key from the seed
master_key = hashlib.pbkdf2_hmac('sha512', seed, b'mnemonic', 2048)

# Derive the private key from the master key
private_key = master_key[:32]

# Convert private key to WIF format
extended_private_key = b'\x80' + private_key + b'\x01'
checksum = hashlib.sha256(hashlib.sha256(extended_private_key).digest()).digest()[:4]
wif_private_key = base58.b58encode(extended_private_key + checksum).decode()

# Hash the private key
hashed_private_key = hashlib.sha256(private_key).digest()

# Apply RIPEMD-160 hash
ripemd160_hash = hashlib.new('ripemd160')
ripemd160_hash.update(hashed_private_key)
hashed_ripemd160 = ripemd160_hash.digest()

# Add a version byte
version_byte = b'\x00'
extended_hashed_ripemd160 = version_byte + hashed_ripemd160

# Calculate the checksum
checksum = hashlib.sha256(hashlib.sha256(extended_hashed_ripemd160).digest()).digest()[:4]

# Append the checksum
address_bytes = extended_hashed_ripemd160 + checksum

# Determine the appropriate values for hrp, witver, and witprog based on the address type
hrp = "bc"  # Human-readable part for Bitcoin mainnet addresses
witver = 0  # Witness version (0 for Pay-to-Witness-Public-Key-Hash addresses)
witprog = hashed_ripemd160  # Use the hashed RIPEMD-160 instead of address_bytes

# Generate the Bech32 public key
bech32_public_key = bech32.encode(hrp, witver, hashed_ripemd160)

# Print the Bitcoin private key (WIF format), checksum, Bech32 address, and Bech32 public key
print("Bitcoin Private Key (WIF format):", wif_private_key)
print("Bitcoin Private Key (Hexadecimal):", private_key.hex())
print("Checksum:", checksum.hex())
print("BIP39 Mnemonic Phrase:", words)
print("Bech32 Public Key:", bech32_public_key)
print("If your public key ends with a P, try to generate a new one")


Here, all you need to change is the entropy code required at the start, which is the entropy code we got when we ran the first code.

You can see what the results will be by checking all the "Print" output at the end.
Remember you might need to download the libraries onto your pc first. And this code should be ran with your Internet off

I hope this can be useful to someone and don't hesitate to tell me if my code has some issues or vulnerabilities

Post
Topic
Board Currency exchange
Topic OP
Best and cheap Non-KYC P2P for Bitcoin?
by
Phobos_Quake
on 19/03/2024, 01:57:37 UTC
Hi,

So, it's been surprising and ironic how hard is to buy one of the first cryptocurrencies and the most known native "Bitcoin" with low fees and non-KYC

If you have a bech32 or taproot address, the transactions fees should be pretty cheap, they should be what you can see on https://mempool.space (Right now, low priority is around $1.80)
But many start at $4 if you are lucky and CEX go crazy to $15 or more

The best i could find non-kyc and the lowest fee has been https://localcoinswap.com when i tried it was $2.50 in March 2024 and you can buy directly on the website with USDT for example, it also allows you to designate the destination address, so you don't need to do a withdraw from the website after buying. They also have a P2P marketplace but people usually charge a premium over BTC price.

Also, it would be nice to find a P2P marketplace non-kyc that allows you to buy with a coin that the website controls. For example: We know that Bisq has their own coin that allows you to hold for lower fees when you use it, but you can't buy BTC with Bisq coin. If it did, you wouldn't need to trust the seller or use annoying P2P payment methods like Paypal, Zelle,etc. (I know Bisq doesn't do this because they want to be %100 decentralized and using Bisq would give them some power and centralized risks for the users).

Do you know any other Non-KYC marketplaces with low BTC fees?