Author

Topic: Mass Private Key to Bitcoin Address Converter (Read 1899 times)

member
Activity: 182
Merit: 30
I search a Mass Private Key to Bitcoin Address Converter.

There is a tool called 'KU' in the pycoin python library, it gets installed in your bin when you install the lib

Here using private-key '1' as an example

DOS-Prompt: "ku 1"

input                        : 1
network                      : Bitcoin mainnet
symbol                       : BTC
secret exponent              : 1
 hex                         : 1
wif                          : KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn
 uncompressed                : 5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf
public pair x                : 55066263022277343669578718895168534326250603453777594175500187360389116729240
public pair y                : 32670510020758816978083085130507043184471273380659243275938904335757337482424
 x as hex                    : 79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
 y as hex                    : 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8
y parity                     : even
key pair as sec              : 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
 uncompressed                : 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798\
                                 483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8
hash160                      : 751e76e8199196d454941c45d1b3a323f1433bd6
 uncompressed                : 91b24bf9f5288532960ac687abb035127b1d28a5
Bitcoin address              : 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH
Bitcoin address uncompressed : 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm
Bitcoin segwit address       : bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4
p2sh segwit                  : 3JvL6Ymt8MVWiCNHC7oWU6nLeHNJKLZGLN
 corresponding p2sh script   : 0014751e76e8199196d454941c45d1b3a323f1433bd6

Note that you get all this info, you pick what you want, 'bitcoin address' is there, then use awk/sed to strip which line/data u want, write a batch file to convert all your private keys to addresses, if you want fast, then study 'ku' source, and write your own python script

Most people use the h160 format as it requires the least storage, and is easy to map to any address format.

If you have say 100M private keys, then you want to use h160, and you'll need 4TB disk-storage on your desktop.

Study the output of KU, learn what all this stuff is, the source can show you which call's in python do the transformation of format
HCP
legendary
Activity: 2086
Merit: 4361
Can possible update code to write file output

may be good for export to file is better print out if it is massive may be 1 million or billion key it need to save to file
Cry still no answer!! people please update code to output file!!

Are you wanting the code to be updated for the private key to address converter that this thread was originally about... or for the "address to pubkey" converter that gsciservices was looking for?

For the former... You don't need to bother with opening a file and writing the output in the Python script itself. Simply redirect the output of the script to a file from the commandline... ie. for linux:
Code:
python your_script.py > your_outfile_name.txt

Windows supports something similar.


If you're wanting the address to public key... well as pooya87 noted, it's asking the impossible if the address has not been "spent" from... you cannot go from address -> public key as public key -> address uses one way hash functions.
newbie
Activity: 2
Merit: 0
 Cry still no answer!! people please update code to output file!!
member
Activity: 406
Merit: 47
Can possible update code to write file output

may be good for export to file is better print out if it is massive may be 1 million or billion key it need to save to file
legendary
Activity: 3472
Merit: 10611
It was published pub key only spent from address; unfortunately 16jY7qLJnxb7CHZyqBP8qca9d51gAjyXQN not find pub key. Could you please modified it which output any wallet address to pub key.
Block explorers can not perform magic, they simply look up the history involving that address and if any coin has ever been spent from that address they simply extract its public key. In this case this address has never been used (spent from) which means the public key is not yet revealed.
To be more specific, if any of its coins were spent then it is too late for you because it means someone already solved the puzzle involving this address Wink
newbie
Activity: 8
Merit: 0
Electrum supports this, just use Electrum


Already tried it Electrum; output is not public key. Only tx hash avaiable....
I have addr to pubkey python script:
python2.2.18

import time
import requests

addresses = open('addr.txt', 'r').read().split('\n')

for address in addresses:
    if address == '':
        continue

    response = requests.get('https://blockchain.info/q/pubkeyaddr/' + address)
    if response.status_code == 200:
        if response.text != '':
            open('pubkeys.txt', 'a').write(address + ' : ' + response.text+"\n")


It was published pub key only spent from address; unfortunately 16jY7qLJnxb7CHZyqBP8qca9d51gAjyXQN not find pub key. Could you please modified it which output any wallet address to pub key.
legendary
Activity: 3472
Merit: 10611
Electrum supports this, just use Electrum
Electrum, as a wallet, has the option to import private keys and will add those keys with their corresponding addresses to its wallet file. The file that is a plain JSON and slows down the application significantly when the size of this wallet file grows big.
jr. member
Activity: 95
Merit: 4
Electrum supports this, just use Electrum
newbie
Activity: 8
Merit: 0
Somewhat shorter

Code:
from bitcoin import *

with open("privkeys.txt") as f:
for line in f:
print(pubtoaddr(privtopub(line.strip())))





Hi,
Any possibilities to making addrtopub as above:

from bitcoin import *

with open("addr.txt") as f:
   for line in f:
      print(addrtopub(addrtopub(line.strip())))
sr. member
Activity: 467
Merit: 267
Somewhat shorter

Code:
from bitcoin import *

with open("privkeys.txt") as f:
for line in f:
print(pubtoaddr(privtopub(line.strip())))
hero member
Activity: 865
Merit: 1006
Hey Guys,

I have a list of private keys and I want translate them to their Bitcoin Addresses. Is their any tool (with GUI) that can easily transform a textfile with private keys inside it to a list of their addresses?

I hope somebody can help me. Smiley

Best regards,

Patrick Smiley

easy in python

Code:
__author__ = 'xcbtrader'
# -*- coding: utf-8 -*-

from bitcoin import *

f = open('file with private.txt', "r")
privates = []
linia = f.readline()

while linia != "":
    linia = linia[0 :-1]
    privates.append (linia)
    linia = f.readline()

f.close()

for priv in privates:
    pub = privtopub(priv)
    addr = pubtoaddr(pub)
    wif = encode_privkey(priv, 'wif')
    print addr
    print wif


Sorry, I istalled python but I don't really know how to use it... could you just say me how to use your code? Smiley
open your favorite text editor / notepad paste in the code and save it as .py e.g converter.py

Only you need a text editor. Copy this code, and save to address.py (or other name)
You need the bitcoin library for run the program.
If you have pip installed  open comand window and type:

pip install bitcoin

Please, this library and program works fine in python 2.7, but not in python 3.4

The link of the library is:

https://github.com/vbuterin/pybitcointools

legendary
Activity: 1274
Merit: 1006
Trainman
Hey Guys,

I have a list of private keys and I want translate them to their Bitcoin Addresses. Is their any tool (with GUI) that can easily transform a textfile with private keys inside it to a list of their addresses?

I hope somebody can help me. Smiley

Best regards,

Patrick Smiley

easy in python

Code:
__author__ = 'xcbtrader'
# -*- coding: utf-8 -*-

from bitcoin import *

f = open('file with private.txt', "r")
privates = []
linia = f.readline()

while linia != "":
    linia = linia[0 :-1]
    privates.append (linia)
    linia = f.readline()

f.close()

for priv in privates:
    pub = privtopub(priv)
    addr = pubtoaddr(pub)
    wif = encode_privkey(priv, 'wif')
    print addr
    print wif


Sorry, I istalled python but I don't really know how to use it... could you just say me how to use your code? Smiley
open your favorite text editor / notepad paste in the code and save it as .py e.g converter.py
sr. member
Activity: 412
Merit: 287
Find someone to google it for you!
hero member
Activity: 865
Merit: 1006
Hey Guys,

I have a list of private keys and I want translate them to their Bitcoin Addresses. Is their any tool (with GUI) that can easily transform a textfile with private keys inside it to a list of their addresses?

I hope somebody can help me. Smiley

Best regards,

Patrick Smiley

easy in python

Code:
__author__ = 'xcbtrader'
# -*- coding: utf-8 -*-

from bitcoin import *

f = open('file with private.txt', "r")
privates = []
linia = f.readline()

while linia != "":
    linia = linia[0 :-1]
    privates.append (linia)
    linia = f.readline()

f.close()

for priv in privates:
    pub = privtopub(priv)
    addr = pubtoaddr(pub)
    wif = encode_privkey(priv, 'wif')
    print addr
    print wif

member
Activity: 117
Merit: 250
I search a Mass Private Key to Bitcoin Address Converter.
Jump to: