Bitcoin Forum
March 20, 2026, 07:48:49 PM *
News: Latest Bitcoin Core release: 30.2 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: I made my own code to Create your own Bitcoin address (Python)  (Read 845 times)
nc50lc
Legendary
*
Offline Offline

Activity: 3094
Merit: 8519


Self-proclaimed Genius


View Profile
February 08, 2026, 07:07:38 AM
Merited by apogio (1)
 #21

i'm just curious why I need to create my own Bitcoin address instead of using the ones generated by Electrum.
The difference is minimal whether you know python or not.

In a scenario where the user knows how to read python, then he don't have to involve trust on using Electrum if you verify its seed-generation and address derivation code.
The only benefit that I can see is this is just a few lines of code that's easily auditable within a few minutes compared to Electrum's code (excluding the imported libraries)
Although overall, in the end, a power-user will know how secure the entropy used and if the address is correctly generated.

But in a scenario where the user is just an average joe, he can verify neither, then there's no tiny benefit on using OP's script in that case.
And since that advantage is about convenience, it's the opposite even since a non-tech savvy user will find it hard to run a python script rather than using a wallet with GUI.

-snip-
Try to enclose your script between [code][/code] tags.
Reason is: The forum might break its formatting, specially long strings and it's quite hard to copy.
Also, some people could have trouble differentiating which are the parts of the script from the notes of your post.

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits PREDICT..
█████████████████████████
█████████████████████████
███████████▀▀░░░░▀▀██████
██████████░░▄████▄░░████
█████████░░████████░░████
█████████░░████████░░████
█████████▄▀██████▀▄████
████████▀▀░░░▀▀▀▀░░▄█████
██████▀░░░░██▄▄▄▄████████
████▀░░░░▄███████████████
█████▄▄█████████████████
█████████████████████████
█████████████████████████
.
.WHERE EVERYTHING IS A MARKET..
█████
██
██







██
██
██████
Will Bitcoin hit $200,000
before January 1st 2027?

    No @1.15         Yes @6.00    
█████
██
██







██
██
██████

  CHECK MORE > 
NotATether
Legendary
*
Offline Offline

Activity: 2268
Merit: 9579


┻┻ ︵㇏(°□°㇏)


View Profile WWW
February 10, 2026, 07:48:04 PM
 #22

I stopped using plain Python to generate seed phrases or private keys because it's so easier to mess up and accidentally save the private data in the command history, or output it somewhere.

Private keys and stuff need extreme care during generation, if they are even cached in one place then you lose. To be honest, only experts who know the internals of Python can defend against all these situations, which is why it's much better to use a low level language like C for this purpose.

 
 b1exch.to 
  ETH      DAI   
  BTC      LTC   
  USDT     XMR    
.███████████▄▀▄▀
█████████▄█▄▀
███████████
███████▄█▀
█▀█
▄▄▀░░██▄▄
▄▀██▄▀█████▄
██▄▀░▄██████
███████░█████
█░████░█████████
█░█░█░████░█████
█░█░█░██░█████
▀▀▀▄█▄████▀▀▀
13rianx@gmail.com
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
February 16, 2026, 12:45:13 AM
 #23

 this is not necessary there are literally hundreds and hundreds of scripts and programs already , try python index     https://pypi.org.  or use bit. its  about 10 lines and generates  addresses   ie               .                                                                                                                                                                                                                                                                         from bit import Key
from bit.format import bytes_to_wif

def AddressMaker(n):
    # Ensure input is integer (handles both int and str)
    private_key_int = int(n)
    private_key_bytes = private_key_int.to_bytes(32, byteorder='big')

    # Compressed address
    key_compressed = Key.from_bytes(private_key_bytes)

       # Return both addresses
    return {
          key_compressed.address
    }

# Example usage:
result = AddressMaker(5)
print( result)
shinohai
Full Member
***
Offline Offline

Activity: 286
Merit: 117



View Profile
February 16, 2026, 02:21:39 AM
 #24

this is not necessary there are literally hundreds and hundreds of scripts and programs already , try python index     https://pypi.org.  or use bit. its  about 10 lines and generates  addresses   ie               .                                                                                                                                                                                                                                                                         from bit import Key
from bit.format import bytes_to_wif

def AddressMaker(n):
    # Ensure input is integer (handles both int and str)
    private_key_int = int(n)
    private_key_bytes = private_key_int.to_bytes(32, byteorder='big')

    # Compressed address
    key_compressed = Key.from_bytes(private_key_bytes)

       # Return both addresses
    return {
          key_compressed.address
    }

# Example usage:
result = AddressMaker(5)
print( result)


^ This, and it's far better than 5`394 lines of AI slop.

Phobos_Quake (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 5


View Profile
March 07, 2026, 04:16:12 AM
 #25

this is not necessary there are literally hundreds and hundreds of scripts and programs already , try python index     https://pypi.org.  or use bit. its  about 10 lines and generates  addresses   ie               .                                                                                                                                                                                                                                                                         from bit import Key
from bit.format import bytes_to_wif

def AddressMaker(n):
    # Ensure input is integer (handles both int and str)
    private_key_int = int(n)
    private_key_bytes = private_key_int.to_bytes(32, byteorder='big')

    # Compressed address
    key_compressed = Key.from_bytes(private_key_bytes)

       # Return both addresses
    return {
          key_compressed.address
    }

# Example usage:
result = AddressMaker(5)
print( result)


That creates a P2PKH key. A bit outdated And I want to have control over the entropy.
NotATether
Legendary
*
Offline Offline

Activity: 2268
Merit: 9579


┻┻ ︵㇏(°□°㇏)


View Profile WWW
March 08, 2026, 06:44:17 AM
 #26

That creates a P2PKH key. A bit outdated And I want to have control over the entropy.

Most address generation programs and wallets are all sourcing entropy from either /dev/random or /dev/urandom, which generates pseudorandom bytes after true randomness is exhausted.

Deriving statistically random bytes from a given input source is quite tricky, let alone combining bytes from different sources, so that's why you don't see many implementations of anything using non-standard random sources.

 
 b1exch.to 
  ETH      DAI   
  BTC      LTC   
  USDT     XMR    
.███████████▄▀▄▀
█████████▄█▄▀
███████████
███████▄█▀
█▀█
▄▄▀░░██▄▄
▄▀██▄▀█████▄
██▄▀░▄██████
███████░█████
█░████░█████████
█░█░█░████░█████
█░█░█░██░█████
▀▀▀▄█▄████▀▀▀
Phobos_Quake (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 5


View Profile
March 11, 2026, 02:06:27 AM
 #27

That creates a P2PKH key. A bit outdated And I want to have control over the entropy.

Most address generation programs and wallets are all sourcing entropy from either /dev/random or /dev/urandom, which generates pseudorandom bytes after true randomness is exhausted.

Deriving statistically random bytes from a given input source is quite tricky, let alone combining bytes from different sources, so that's why you don't see many implementations of anything using non-standard random sources.


Correct.
There has been an instance of a wallet getting hacked because they were using random from a library, the hackers figured out how the library generates the entropy.

This isn't a problem with the entropy that uses random factors from your computer data, RAM,etc unless your computer is compromised looking at the random generator.

But again, it's not that I don't trust how randomness is done nowadays. It's about not knowing what entropy some wallets are using. I know you can tell by looking at open-source code, but who does that?
I just wanted to have my own method and entropy where I know where the vulnerabilities lie.
Pages: « 1 [2]  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!