GreySec Forums

Full Version: Random bitcoin private key generation in python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The following code will generate random private keys and derive the BTC address for it.

Code:
#!/usr/bin/python
from bitcoin import *

def keying():
priv = random_key()
pub = privtopub(priv)
addr = pubtoaddr(pub)
wifkey = encode_privkey(priv, 'wif')
print wifkey + "," + addr

while True:
   keying()
(07-16-2018, 01:59 PM)illmanors Wrote: [ -> ]The following code will generate random private keys and derive the BTC address for it.

Code:
#!/usr/bin/python
from bitcoin import *

def keying():
priv = random_key()
pub = privtopub(priv)
addr = pubtoaddr(pub)
wifkey = encode_privkey(priv, 'wif')
print wifkey + "," + addr

while True:
   keying()


did you code it yourself ?