Pages:
Author

Topic: Python snippet to create Bitcoin public/private key pairs (Read 3829 times)

hero member
Activity: 865
Merit: 1006
Genrate bitcoin address with decimal number.

Code:
from bitcoin import *

def generar_HEX(nDecimal):
aHex = hex(nDecimal)
aHex = aHex[2:].upper()
aHex = ((64-len(aHex)) * '0') + aHex
return aHex

nDecimal = 10000  # number to generate bitcoin address
priv = generar_HEX(nDecimal)
pub = privtopub(priv)
addr = pubtoaddr(pub)
wif = encode_privkey(priv, 'wif')

print 'NUMBER: ' + str(nDecimal)
print 'PRIV: ' + priv
print 'PUB: ' + pub
print 'ADDR: ' + addr
print 'WIF: ' + wif
legendary
Activity: 1456
Merit: 1083
I may write code in exchange for bitcoins.
Anyone an idea how i can get the compressed address???


I used this script when I was studying this stuff.  Some of these functions are from a blog (url in the comments, a few others were written or modified by me):

Code:
#!/usr/bin/python
# for my education, following along with bitcoins the hard way blog post:
# http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html
import random
import hashlib
import ecdsa
import struct

b58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'

def base58encode(n):
  result = ''
  while n > 0:
    result = b58[n%58] + result
    n /= 58
  return result

def base58decode(s):
  result = 0
  for i in range(0, len(s)):
    result = result * 58 + b58.index(s[i])
  return result

def base256encode(n):
  result = ''
  while n > 0:
    result = chr(n % 256) + result
    n /= 256
  return result

def base256decode(s):
  result = 0
  for c in s:
    result = result * 256 + ord(c)
  return result

def countLeadingChars(s, ch):
  count = 0
  for c in s:
    if c == ch:
      count += 1
    else:
      break
  return count

# https://en.bitcoin.it/wiki/Base58Check_encoding
def base58CheckEncode(version, payload):
  s = chr(version) + payload
  checksum = hashlib.sha256(hashlib.sha256(s).digest()).digest()[0:4]
  result = s + checksum
  leadingZeros = countLeadingChars(result, '\0')
  return '1' * leadingZeros + base58encode(base256decode(result))


def base58CheckDecode(s):
  leadingOnes = countLeadingChars(s, '1')
  s = base256encode(base58decode(s))
  result = '\0' * leadingOnes + s[:-4]
  chk = s[-4:]
  checksum = hashlib.sha256(hashlib.sha256(result).digest()).digest()[0:4]
  assert(chk == checksum)
  version = result[0]
  return result[1:]

def privateKeyToWif(key_hex, compressed=False):
  if compressed:
    key_hex=key_hex+'01'
  return base58CheckEncode(0x80, key_hex.decode('hex'))


def privateKeyToPublicKey(s, compressed=False):

  sk = ecdsa.SigningKey.from_string(s.decode('hex'), curve=ecdsa.SECP256k1)
  vk = sk.verifying_key

  if compressed:
    from ecdsa.util import number_to_string
    order = vk.pubkey.order
    # print "order", order
    x_str = number_to_string(vk.pubkey.point.x(), order).encode('hex')
    # print "x_str", x_str
    sign = '02' if vk.pubkey.point.y() % 2 == 0 else '03'
    # print "sign", sign
    return (sign+x_str)
  else:
    return ('\04' + vk.to_string()).encode('hex')


def pubKeyToAddr(s):
  ripemd160 = hashlib.new('ripemd160')
  ripemd160.update(hashlib.sha256(s.decode('hex')).digest())
  return base58CheckEncode(0, ripemd160.digest())

def makeRawTransaction(outputTransactionHash, sourceIndex, scriptSig, outputs):
  def makeOutput(data):
    redemptionSatoshis, outputScript = data
    return (struct.pack("           '%02x' % len(outputScript.decode('hex')) + outputScript)
  formattedOutputs = ''.join(map(makeOutput, outputs))
  return (
    "01000000" + # 4 bytes version
    "01" + # variant for number of inputs
    outputTransactionHash.decode('hex')[::-1].encode('hex') + # reverse OutputTransactionHash
    struct.pack('    '%02x' % len(scriptSig.decode('hex')) + scriptSig +
    "ffffffff" + # sequence
    "%02x" % len(outputs) + # number of outputs
    formattedOutputs +
    "00000000" # lockTime
  )


import sys
private_key = None
if len(sys.argv)>1:
  if sys.argv[1] == "-x":
    private_key = sys.argv[2].zfill(64)
  else:
    private_key = '%064x' % int(sys.argv[1])
else: private_key = ''.join(['%x' % random.randrange(16) for x in range(0,64)])

print "A private key: ", private_key
print "The uncompressed WIF: ",privateKeyToWif(private_key)
print "The WIF: ",privateKeyToWif(private_key, compressed=True)
public_key = privateKeyToPublicKey(private_key)
cpublic_key = privateKeyToPublicKey(private_key,compressed=True)
print "The uncompressed bitcoin pubkey: ", public_key
print "The bitcoin pubkey: ", cpublic_key
print "The uncompressed bitcoin address: ", pubKeyToAddr(public_key)
print "The bitcoin address: ", pubKeyToAddr(cpublic_key)

You can see that this script takes a private key as a command line arg, and it takes hex if you specify -x, otherwise it just generates a random private key.  After that, it spits out the addresses and WIFS for that private key, both uncompressed and compressed.  See the functions themselves for how it's done, specifically, look at privateKeyToPublicKey.  Uncomment the debugging "print" lines if you want some further output.
full member
Activity: 169
Merit: 100
Anyone an idea how i can get the compressed address???
full member
Activity: 169
Merit: 100
Sorry, but with this script, I can only genrate a random privkey.
Is there a way to specify the privkey?



Yes, is posible:

Code:
priv = sha256('some big phrase')

Great, nice!


hero member
Activity: 865
Merit: 1006
Sorry, but with this script, I can only genrate a random privkey.
Is there a way to specify the privkey?



Yes, is posible:

Code:
priv = sha256('some big phrase')
full member
Activity: 169
Merit: 100
Sorry, but with this script, I can only genrate a random privkey.
Is there a way to specify the privkey?

full member
Activity: 169
Merit: 100
Thx for the quick reply, i'll give it a try!

I know this thread is quite old, but maybe somebody can help me,
how should this script look for compressed addresses???

How can I get the format 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm (public key) and 5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf (private key) ?
Your "public key" is actually a bitcoin address, and your "private
key" has been WIF encoded.

Here is a revised snippet:

Quote
from ecdsa.ecdsa import *
from binascii import hexlify, unhexlify
import hashlib

__zeros = '0000000000000000000000000000000000000000000000000000000000000000'
__b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
__b58base = len(__b58chars)

def b58encode(v):
  long_value = 0L
  for (i, c) in enumerate(v[::-1]):
    long_value += (256**i) * ord(c)
  result = ''
  while long_value >= __b58base:
    div, mod = divmod(long_value, __b58base)
    result = __b58chars[mod] + result
    long_value = div
  result = __b58chars[long_value] + result
  nPad = 0
  for c in v:
    if c == '\0': nPad += 1
    else: break
  return (__b58chars[0]*nPad) + result


def getKeys(secretNumber):
  rpmd160hash = hashlib.new('ripemd160')
  pubKey = Public_key(generator_secp256k1,generator_secp256k1*secretNumber)
  formattedPubKey = '\x04'+int_to_string(pubKey.point.x())+int_to_string(pubKey.point.y())
  rpmd160hash.update(hashlib.sha256(formattedPubKey).digest())
  btcAddress = '\x00'+rpmd160hash.digest()
  chksum = hashlib.sha256(hashlib.sha256(btcAddress).digest()).digest()[:4]
  btcAddress = b58encode(btcAddress+chksum)
  formattedPubKey = hexlify(formattedPubKey)
  formattedPrivKey = hexlify(int_to_string(secretNumber))
  formattedPrivKey = '80'+__zeros[0:64-len(formattedPrivKey)]+formattedPrivKey
  formattedPrivKey = unhexlify(formattedPrivKey)
  chksum = hashlib.sha256(hashlib.sha256(formattedPrivKey).digest()).digest()[:4]
  formattedPrivKey = b58encode(formattedPrivKey+chksum)
  return (btcAddress,formattedPrivKey, formattedPubKey)


secretNumber = 10000000000000000000
bitcoinAddress, privateKey, publicKey = getKeys(secretNumber)
print 'SecretNumber: ',secretNumber
print 'BitcoinAddress: '+bitcoinAddress
print 'PrivateKey: '+privateKey
print 'PublicKey: '+publicKey



This scrypt is very slow.
Please, use this:

https://github.com/vbuterin/pybitcointools

Exemple:
Code:
from bitcoin import *

priv = random_key()
pub = privtopub(priv)
addr = pubtoaddr(pub)
wifKey = encode_privkey(priv, 'wif')

print 'Bitcoin Address: ' + addr
print 'WIF Key: ' + wifKey
hero member
Activity: 865
Merit: 1006
I know this thread is quite old, but maybe somebody can help me,
how should this script look for compressed addresses???

How can I get the format 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm (public key) and 5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf (private key) ?
Your "public key" is actually a bitcoin address, and your "private
key" has been WIF encoded.

Here is a revised snippet:

Quote
from ecdsa.ecdsa import *
from binascii import hexlify, unhexlify
import hashlib

__zeros = '0000000000000000000000000000000000000000000000000000000000000000'
__b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
__b58base = len(__b58chars)

def b58encode(v):
  long_value = 0L
  for (i, c) in enumerate(v[::-1]):
    long_value += (256**i) * ord(c)
  result = ''
  while long_value >= __b58base:
    div, mod = divmod(long_value, __b58base)
    result = __b58chars[mod] + result
    long_value = div
  result = __b58chars[long_value] + result
  nPad = 0
  for c in v:
    if c == '\0': nPad += 1
    else: break
  return (__b58chars[0]*nPad) + result


def getKeys(secretNumber):
  rpmd160hash = hashlib.new('ripemd160')
  pubKey = Public_key(generator_secp256k1,generator_secp256k1*secretNumber)
  formattedPubKey = '\x04'+int_to_string(pubKey.point.x())+int_to_string(pubKey.point.y())
  rpmd160hash.update(hashlib.sha256(formattedPubKey).digest())
  btcAddress = '\x00'+rpmd160hash.digest()
  chksum = hashlib.sha256(hashlib.sha256(btcAddress).digest()).digest()[:4]
  btcAddress = b58encode(btcAddress+chksum)
  formattedPubKey = hexlify(formattedPubKey)
  formattedPrivKey = hexlify(int_to_string(secretNumber))
  formattedPrivKey = '80'+__zeros[0:64-len(formattedPrivKey)]+formattedPrivKey
  formattedPrivKey = unhexlify(formattedPrivKey)
  chksum = hashlib.sha256(hashlib.sha256(formattedPrivKey).digest()).digest()[:4]
  formattedPrivKey = b58encode(formattedPrivKey+chksum)
  return (btcAddress,formattedPrivKey, formattedPubKey)


secretNumber = 10000000000000000000
bitcoinAddress, privateKey, publicKey = getKeys(secretNumber)
print 'SecretNumber: ',secretNumber
print 'BitcoinAddress: '+bitcoinAddress
print 'PrivateKey: '+privateKey
print 'PublicKey: '+publicKey



This scrypt is very slow.
Please, use this:

https://github.com/vbuterin/pybitcointools

Exemple:
Code:
from bitcoin import *

priv = random_key()
pub = privtopub(priv)
addr = pubtoaddr(pub)
wifKey = encode_privkey(priv, 'wif')

print 'Bitcoin Address: ' + addr
print 'WIF Key: ' + wifKey
full member
Activity: 169
Merit: 100
I know this thread is quite old, but maybe somebody can help me,
how should this script look for compressed addresses???

How can I get the format 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm (public key) and 5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf (private key) ?
Your "public key" is actually a bitcoin address, and your "private
key" has been WIF encoded.

Here is a revised snippet:

Quote
from ecdsa.ecdsa import *
from binascii import hexlify, unhexlify
import hashlib

__zeros = '0000000000000000000000000000000000000000000000000000000000000000'
__b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
__b58base = len(__b58chars)

def b58encode(v):
  long_value = 0L
  for (i, c) in enumerate(v[::-1]):
    long_value += (256**i) * ord(c)
  result = ''
  while long_value >= __b58base:
    div, mod = divmod(long_value, __b58base)
    result = __b58chars[mod] + result
    long_value = div
  result = __b58chars[long_value] + result
  nPad = 0
  for c in v:
    if c == '\0': nPad += 1
    else: break
  return (__b58chars[0]*nPad) + result


def getKeys(secretNumber):
  rpmd160hash = hashlib.new('ripemd160')
  pubKey = Public_key(generator_secp256k1,generator_secp256k1*secretNumber)
  formattedPubKey = '\x04'+int_to_string(pubKey.point.x())+int_to_string(pubKey.point.y())
  rpmd160hash.update(hashlib.sha256(formattedPubKey).digest())
  btcAddress = '\x00'+rpmd160hash.digest()
  chksum = hashlib.sha256(hashlib.sha256(btcAddress).digest()).digest()[:4]
  btcAddress = b58encode(btcAddress+chksum)
  formattedPubKey = hexlify(formattedPubKey)
  formattedPrivKey = hexlify(int_to_string(secretNumber))
  formattedPrivKey = '80'+__zeros[0:64-len(formattedPrivKey)]+formattedPrivKey
  formattedPrivKey = unhexlify(formattedPrivKey)
  chksum = hashlib.sha256(hashlib.sha256(formattedPrivKey).digest()).digest()[:4]
  formattedPrivKey = b58encode(formattedPrivKey+chksum)
  return (btcAddress,formattedPrivKey, formattedPubKey)


secretNumber = 10000000000000000000
bitcoinAddress, privateKey, publicKey = getKeys(secretNumber)
print 'SecretNumber: ',secretNumber
print 'BitcoinAddress: '+bitcoinAddress
print 'PrivateKey: '+privateKey
print 'PublicKey: '+publicKey


tyz
legendary
Activity: 3360
Merit: 1533
@ThePiGuy: the problem was solved. open an own thread with asking for someone who can implement keys generation into Bf language.
legendary
Activity: 1456
Merit: 1083
I may write code in exchange for bitcoins.
Step #2 - Convert to Brainfuck for fun because you know why not.

Are you talking about brainfuck the language http://en.wikipedia.org/wiki/Brainfuck?  Is there some kind of relevance for bumping this 2 week old thread?  Do you actually want code for generating keys in brainfuck or where you just bumping your post count?

No, I actually want someone to convert it to that language because not only would it be a pretty great challenge, but Brainfuck can easily be implemented on an Arduino (or literally any other platform), so it could actually serve to be a very useful function.

I don't know anything about programming for Arduino, but I'm really surprised if you can't compile C code for it.  And since you already have all the bitcoin core, there's also a libbitcoin in C, don't you already have what you need to convert keys on arduino?  Also, isn't arduino just an arm7?  Can't you run python on linux on it?  Sorry for my ignorance.

You are somewhat right, but it's not a 64-bit machine like Bitcoin Core is meant to run on though.  It's not quite that easy, because it's memory is on the order of 16 KB.

Brainfuck on the other hand, is SOOO easy to implement if all you need to do is generate an address.

If it's SOOO easy, maybe you can do it yourself if you check out those python methods in that library I linked to above.  I've never written a line of brainfuck in my life so I don't think I can help you.

Cheers!

I didn't say coding in Brainfuck was easy...it's maybe the most confusing thing I've ever tried to do (but there are some real pros in it).  I just said that implementing an interpreter in it is really easy in just about any other language.

So you can implement your own interpreter really easy (I'm guessing you're talking about a REPL http://en.wikipedia.org/wiki/Read–eval–print_loop) but you can't implement some string manipulation very easy?  I must still be misunderstanding something.  Anyway, I can't help you when it comes to coding in brainfuck.  Dunno what else to say.
newbie
Activity: 25
Merit: 0
Step #2 - Convert to Brainfuck for fun because you know why not.

Are you talking about brainfuck the language http://en.wikipedia.org/wiki/Brainfuck?  Is there some kind of relevance for bumping this 2 week old thread?  Do you actually want code for generating keys in brainfuck or where you just bumping your post count?

No, I actually want someone to convert it to that language because not only would it be a pretty great challenge, but Brainfuck can easily be implemented on an Arduino (or literally any other platform), so it could actually serve to be a very useful function.

I don't know anything about programming for Arduino, but I'm really surprised if you can't compile C code for it.  And since you already have all the bitcoin core, there's also a libbitcoin in C, don't you already have what you need to convert keys on arduino?  Also, isn't arduino just an arm7?  Can't you run python on linux on it?  Sorry for my ignorance.

You are somewhat right, but it's not a 64-bit machine like Bitcoin Core is meant to run on though.  It's not quite that easy, because it's memory is on the order of 16 KB.

Brainfuck on the other hand, is SOOO easy to implement if all you need to do is generate an address.

If it's SOOO easy, maybe you can do it yourself if you check out those python methods in that library I linked to above.  I've never written a line of brainfuck in my life so I don't think I can help you.

Cheers!

I didn't say coding in Brainfuck was easy...it's maybe the most confusing thing I've ever tried to do (but there are some real pros in it).  I just said that implementing an interpreter in it is really easy in just about any other language.
legendary
Activity: 1456
Merit: 1083
I may write code in exchange for bitcoins.
Step #2 - Convert to Brainfuck for fun because you know why not.

Are you talking about brainfuck the language http://en.wikipedia.org/wiki/Brainfuck?  Is there some kind of relevance for bumping this 2 week old thread?  Do you actually want code for generating keys in brainfuck or where you just bumping your post count?

No, I actually want someone to convert it to that language because not only would it be a pretty great challenge, but Brainfuck can easily be implemented on an Arduino (or literally any other platform), so it could actually serve to be a very useful function.

I don't know anything about programming for Arduino, but I'm really surprised if you can't compile C code for it.  And since you already have all the bitcoin core, there's also a libbitcoin in C, don't you already have what you need to convert keys on arduino?  Also, isn't arduino just an arm7?  Can't you run python on linux on it?  Sorry for my ignorance.

You are somewhat right, but it's not a 64-bit machine like Bitcoin Core is meant to run on though.  It's not quite that easy, because it's memory is on the order of 16 KB.

Brainfuck on the other hand, is SOOO easy to implement if all you need to do is generate an address.

If it's SOOO easy, maybe you can do it yourself if you check out those python methods in that library I linked to above.  I've never written a line of brainfuck in my life so I don't think I can help you.

Cheers!
newbie
Activity: 25
Merit: 0
Step #2 - Convert to Brainfuck for fun because you know why not.

Are you talking about brainfuck the language http://en.wikipedia.org/wiki/Brainfuck?  Is there some kind of relevance for bumping this 2 week old thread?  Do you actually want code for generating keys in brainfuck or where you just bumping your post count?

No, I actually want someone to convert it to that language because not only would it be a pretty great challenge, but Brainfuck can easily be implemented on an Arduino (or literally any other platform), so it could actually serve to be a very useful function.

I don't know anything about programming for Arduino, but I'm really surprised if you can't compile C code for it.  And since you already have all the bitcoin core, there's also a libbitcoin in C, don't you already have what you need to convert keys on arduino?  Also, isn't arduino just an arm7?  Can't you run python on linux on it?  Sorry for my ignorance.

You are somewhat right, but it's not a 64-bit machine like Bitcoin Core is meant to run on though.  It's not quite that easy, because it's memory is on the order of 16 KB.

Brainfuck on the other hand, is SOOO easy to implement if all you need to do is generate an address.
legendary
Activity: 1456
Merit: 1083
I may write code in exchange for bitcoins.
Step #2 - Convert to Brainfuck for fun because you know why not.

Are you talking about brainfuck the language http://en.wikipedia.org/wiki/Brainfuck?  Is there some kind of relevance for bumping this 2 week old thread?  Do you actually want code for generating keys in brainfuck or where you just bumping your post count?

No, I actually want someone to convert it to that language because not only would it be a pretty great challenge, but Brainfuck can easily be implemented on an Arduino (or literally any other platform), so it could actually serve to be a very useful function.

I don't know anything about programming for Arduino, but I'm really surprised if you can't compile C code for it.  And since you already have all the bitcoin core, there's also a libbitcoin in C, don't you already have what you need to convert keys on arduino?  Also, isn't arduino just an arm7?  Can't you run python on linux on it?  Sorry for my ignorance.
newbie
Activity: 25
Merit: 0
Step #2 - Convert to Brainfuck for fun because you know why not.

Are you talking about brainfuck the language http://en.wikipedia.org/wiki/Brainfuck?  Is there some kind of relevance for bumping this 2 week old thread?  Do you actually want code for generating keys in brainfuck or where you just bumping your post count?

No, I actually want someone to convert it to that language because not only would it be a pretty great challenge, but Brainfuck can easily be implemented on an Arduino (or literally any other platform), so it could actually serve to be a very useful function.
legendary
Activity: 1456
Merit: 1083
I may write code in exchange for bitcoins.
Step #2 - Convert to Brainfuck for fun because you know why not.

Are you talking about brainfuck the language http://en.wikipedia.org/wiki/Brainfuck?  Is there some kind of relevance for bumping this 2 week old thread?  Do you actually want code for generating keys in brainfuck or where you just bumping your post count?
newbie
Activity: 25
Merit: 0
Step #2 - Convert to Brainfuck for fun because you know why not.
tyz
legendary
Activity: 3360
Merit: 1533
Thanks, the snippet works very well! Exactly what I have looked for.
Great work!
newbie
Activity: 7
Merit: 0
How can I get the format 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm (public key) and 5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf (private key) ?
Your "public key" is actually a bitcoin address, and your "private
key" has been WIF encoded.

Here is a revised snippet:

Quote
from ecdsa.ecdsa import *
from binascii import hexlify, unhexlify
import hashlib

__zeros = '0000000000000000000000000000000000000000000000000000000000000000'
__b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
__b58base = len(__b58chars)

def b58encode(v):
  long_value = 0L
  for (i, c) in enumerate(v[::-1]):
    long_value += (256**i) * ord(c)
  result = ''
  while long_value >= __b58base:
    div, mod = divmod(long_value, __b58base)
    result = __b58chars[mod] + result
    long_value = div
  result = __b58chars[long_value] + result
  nPad = 0
  for c in v:
    if c == '\0': nPad += 1
    else: break
  return (__b58chars[0]*nPad) + result


def getKeys(secretNumber):
  rpmd160hash = hashlib.new('ripemd160')
  pubKey = Public_key(generator_secp256k1,generator_secp256k1*secretNumber)
  formattedPubKey = '\x04'+int_to_string(pubKey.point.x())+int_to_string(pubKey.point.y())
  rpmd160hash.update(hashlib.sha256(formattedPubKey).digest())
  btcAddress = '\x00'+rpmd160hash.digest()
  chksum = hashlib.sha256(hashlib.sha256(btcAddress).digest()).digest()[:4]
  btcAddress = b58encode(btcAddress+chksum)
  formattedPubKey = hexlify(formattedPubKey)
  formattedPrivKey = hexlify(int_to_string(secretNumber))
  formattedPrivKey = '80'+__zeros[0:64-len(formattedPrivKey)]+formattedPrivKey
  formattedPrivKey = unhexlify(formattedPrivKey)
  chksum = hashlib.sha256(hashlib.sha256(formattedPrivKey).digest()).digest()[:4]
  formattedPrivKey = b58encode(formattedPrivKey+chksum)
  return (btcAddress,formattedPrivKey, formattedPubKey)


secretNumber = 10000000000000000000
bitcoinAddress, privateKey, publicKey = getKeys(secretNumber)
print 'SecretNumber: ',secretNumber
print 'BitcoinAddress: '+bitcoinAddress
print 'PrivateKey: '+privateKey
print 'PublicKey: '+publicKey

Pages:
Jump to: