How to make a bitcoin address generator! Using Python! (Reddit Bitcoin)


I started out with paper wallets for my btc when I first learned about how to store bitcoin. I made one on bitaddress.org, but the vulnerability of trusting a website to do it for you wasnt very reassuring. Neither is the fact you could be keylogged or the government sec spies could be watching you or xyz. Next best thing was a desktop wallet or a chrome app but I cant see the code so I didnt trust it and I wasnt about to buy a hardware wallet for something i wasn’t sure about so there was no easy super secure in my gut feeling i know its safe way of storing my bitcoin. Well I recently learned some python and I want to share a way for you to verify the code, safely generate a wallet, and even have people on Reddit vet the process / code. (I am on a windows computer so for reference, all instructions will be for windows computers, but the code should work for mac as well.) To generate a bitcoin wallet you will need the following. *Python installed on your computer *The “bitcoin” python tools bitcoin library installed Here is where you can install / how to install these. *Python 3.7.3 https://www.python.org/downloads/ Bitcoin (bitcoin module 1.1.42 https://pypi.org/project/bitcoin/) To install the bitcoin python module, open cmd after installing python, and enter the following: “pip install bitcoin” Let this process finish. After both of these are installed, right click on your desktop and create a new text document, and open it with text editor. Then copy and paste this code inside. (Feel free to read it, it comes with explanations as to what everything does). After that, name the document, change its appendage to .py and make sure to set it to .*all file types before you save. from tkinter import * #tkinter is window module from bitcoin import * #bitcoin is bitcoin module 1.1.42 found on pypi Window = Tk() Window.geometry(“259×100”) #Makes window and sets size def button1_commmand(): a = random_key() print(“Btc private key: “, a) global b b = (a) #Button 1 generates random key locally using pip installed bitcoin module algorithm def button2_commmand(): print(“Chosen private key: “, b) #Button 2 sets chosen private key as one to generate other keys from def button3_command(): global pubfrompriv pubfrompriv = privtopub(b) print(“Public key from chosen private key: “, pubfrompriv) #Button 3 creates public key from private key def button4_command(): addfrompub = pubtoaddr(pubfrompriv) print(“Public address from generated public key:”, addfrompub) #Button 4 creates address from public key from chosen private key #Look in terminal for results #What follows is window & button configs WindowMenu = Menu(Window) Window.config(menu=WindowMenu) topFrame = Frame(Window, width = 200, height = 25).grid(row=0, columnspan=3) bottomFrame = Frame(Window, width = 200, height = 25).grid(row=0, columnspan=3) button1 = Button(topFrame, text=”Generate Private Key”, fg=”red”, command = button1_commmand) button2 = Button(topFrame, text=”Choose Private Key”, fg=”green”, command = button2_commmand) button3 = Button(bottomFrame, text=”Generate Public Key”, fg=”blue”, command = button3_command) button4 = Button(bottomFrame, text=”Generate Public Address”, fg=”black”, command = button4_command) button1.grid(row=1) button2.grid(row=3) button3.grid(row=1, column= 2) button4.grid(row=3, column= 2) label_1 = Label(Window, text=”Action 1″) label_2 = Label(Window, text=”Action 2″) label_3 = Label(Window, text=”Action 3″) label_4 = Label(Window, text=”Action 4″) label_1.grid(row= 0, column=0) label_2.grid(row= 2, column=0) label_3.grid(row= 0, column=2) label_4.grid(row= 2, column=2) def quit(self): self.root.destroy() Window.mainloop() #All of this is button and window dimmension configs #You can input your private keys to https://www.bitaddress.org/ to test it out! #Make sure to generate offline, and now you can be 1 step safer than generating it online or through a web wallet! #Make sure you never share your private seed with anyone Great job, now you have a python script generating you bitcoin private and public keys. All you have to do is double click on the .py file you just created and a cmd window will pop up, along with 4 buttons for you to click on. Make sure to generate them offline, hodl tight, and tell people about bitcoin.
submitted by /u/1Win [link] [comments]

Leave a Reply