Search content
Sort by

Showing 20 of 27 results by deon
Post
Topic
Board Project Development
Re: I want to upload all public bitcoin addresses on blockchain to mysql, How?
by
deon
on 07/05/2017, 06:01:28 UTC
I know it will never work.  But I l would like to see if I can build my own bitcoin collider.

I found a python script that generates a public and private key.  I modified it to take an input file.  I increment the 77 byte exponent by 1.  Then put it in a loop.  I check for a transaction history using a call to blockchain.info.   If a transaction is found  (i know, will not happen),  I write the private and public key to a file.  I update the input file at the end of each run.

I want to run it against my own database, instead of making calls to the blockchain.info.  As you can see from my source, I put a 20 second between each call so as not to overwhelm the api.  I also run the program with a sleep time between runs.

This is how I run the program from my linux command line.
while sleep 235; do python usethis.py; done;

Would love to get this running with no sleep time.

You need inputfile.txt example input
cbc8ec257d4c93be235d243e082b417a2db859e712204ad65063836b207b20dc

counter.txt value
0



source

Code:
#!/usr/bin/env python
# Joric/bitcoin-dev, june 2012, public domain

import hashlib
import time
import ctypes
import ctypes.util
import sys
from pybitcointools import *

ssl = ctypes.cdll.LoadLibrary (ctypes.util.find_library ('ssl') or 'libeay32')

def check_result (val, func, args):
    if val == 0: raise ValueError
    else: return ctypes.c_void_p (val)

ssl.EC_KEY_new_by_curve_name.restype = ctypes.c_void_p
ssl.EC_KEY_new_by_curve_name.errcheck = check_result

class KEY:
    def __init__(self):
        NID_secp256k1 = 714
        self.k = ssl.EC_KEY_new_by_curve_name(NID_secp256k1)
        self.compressed = False
        self.POINT_CONVERSION_COMPRESSED = 2
        self.POINT_CONVERSION_UNCOMPRESSED = 4

    def __del__(self):
        if ssl:
            ssl.EC_KEY_free(self.k)
        self.k = None

    def generate(self, secret=None):
        if secret:
            self.prikey = secret
            priv_key = ssl.BN_bin2bn(secret, 32, ssl.BN_new())
            group = ssl.EC_KEY_get0_group(self.k)
            pub_key = ssl.EC_POINT_new(group)
            ctx = ssl.BN_CTX_new()
            ssl.EC_POINT_mul(group, pub_key, priv_key, None, None, ctx)
            ssl.EC_KEY_set_private_key(self.k, priv_key)
            ssl.EC_KEY_set_public_key(self.k, pub_key)
            ssl.EC_POINT_free(pub_key)
            ssl.BN_CTX_free(ctx)
            return self.k
        else:
            return ssl.EC_KEY_generate_key(self.k)

    def get_pubkey(self):
        size = ssl.i2o_ECPublicKey(self.k, 0)
        mb = ctypes.create_string_buffer(size)
        ssl.i2o_ECPublicKey(self.k, ctypes.byref(ctypes.pointer(mb)))
        return mb.raw

    def get_secret(self):
        bn = ssl.EC_KEY_get0_private_key(self.k);
        bytes = (ssl.BN_num_bits(bn) + 7) / 8
        mb = ctypes.create_string_buffer(bytes)
        n = ssl.BN_bn2bin(bn, mb);
        return mb.raw.rjust(32, chr(0))

    def set_compressed(self, compressed):
        self.compressed = compressed
        if compressed:
            form = self.POINT_CONVERSION_COMPRESSED
        else:
            form = self.POINT_CONVERSION_UNCOMPRESSED
        ssl.EC_KEY_set_conv_form(self.k, form)

def dhash(s):
    return hashlib.sha256(hashlib.sha256(s).digest()).digest()

def rhash(s):
    h1 = hashlib.new('ripemd160')
    h1.update(hashlib.sha256(s).digest())
    return h1.digest()

b58_digits = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'

def base58_encode(n):
    l = []
    while n > 0:
        n, r = divmod(n, 58)
        l.insert(0,(b58_digits[r]))
    return ''.join(l)

def base58_decode(s):
    n = 0
    for ch in s:
        n *= 58
        digit = b58_digits.index(ch)
        n += digit
    return n

def base58_encode_padded(s):
    res = base58_encode(int('0x' + s.encode('hex'), 16))
    pad = 0
    for c in s:
        if c == chr(0):
            pad += 1
        else:
            break
    return b58_digits[0] * pad + res

def base58_decode_padded(s):
    pad = 0
    for c in s:
        if c == b58_digits[0]:
            pad += 1
        else:
            break
    h = '%x' % base58_decode(s)
    if len(h) % 2:
        h = '0' + h
    res = h.decode('hex')
    return chr(0) * pad + res

def base58_check_encode(s, version=0):
    vs = chr(version) + s
    check = dhash(vs)[:4]
    return base58_encode_padded(vs + check)

def base58_check_decode(s, version=0):
    k = base58_decode_padded(s)
    v0, data, check0 = k[0], k[1:-4], k[-4:]
    check1 = dhash(v0 + data)[:4]
    if check0 != check1:
        raise BaseException('checksum error')
    if version != ord(v0):
        raise BaseException('version mismatch')
    return data

def gen_eckey(passphrase=None, secret=None, pkey=None, compressed=False, rounds=1, version=0):
    k = KEY()
    if passphrase:
        secret = passphrase.encode('utf8')
        for i in xrange(rounds):
            secret = hashlib.sha256(secret).digest()
    if pkey:
        secret = base58_check_decode(pkey, 128+version)
        compressed = len(secret) == 33
        secret = secret[0:32]
    k.generate(secret)
    k.set_compressed(compressed)
    return k

def get_addr(k,version=0):
    time.sleep(20)
    pubkey = k.get_pubkey()
    secret = k.get_secret()
    hash160 = rhash(pubkey)
    addr = base58_check_encode(hash160,version)
    payload = secret
    if k.compressed:
        payload = secret + chr(1)
    pkey = base58_check_encode(payload, 128+version)
    h = history(addr)
    if h != []:
       print "we found one!"
       print addr
       print pkey
       winnerfile = open('winner.txt', 'w')
       winnerfile.write(pkey,':',addr)
       winnerfile.close()

    return addr, pkey

def reencode(pkey,version=0):
    payload = base58_check_decode(pkey,128+version)
    secret = payload[:-1]
    payload = secret + chr(1)
    pkey = base58_check_encode(payload, 128+version)
    print get_addr(gen_eckey(pkey))

def test(otherversion):
    # random compressed
    #print get_addr(gen_eckey(compressed=True,version=otherversion),version=otherversion)

    # uncomment these to create addresses via a different method
    # random uncompressed
    #print get_addr(gen_eckey())
    # by secret
    
    inputfile = open('inputfile.txt', 'r')
    startdata = inputfile.read()
    inputfile.close()
    print "starting point"

    counterfile = open('counter.txt', 'r')
    counter = counterfile.read()
    counterfile.close()
  
    inputlove=startdata.strip()  
    inputlove = inputlove.zfill(64)
    inputkeyin = int(inputlove,16)

    startingpoint = int(inputlove,16)
    outcounter = int(counter)
    
    while inputkeyin < startingpoint + 100:
        print inputkeyin
        inputkeyhex = hex(inputkeyin)[2:-1]
        print inputkeyhex
        get_addr(gen_eckey(secret=inputkeyhex.decode('hex')))
        inputkeyin = int(inputkeyhex,16)
        inputkeyin = inputkeyin + 1
        outcounter = outcounter + 1

    outputfile = open('inputfile.txt', 'w')
    outputfile.write(inputkeyhex)
    outputfile.close()
    if outcounter > 0:
       outputcounter = open('counter.txt', 'w')
       stroutcounter=str(outcounter)
       outputcounter.write(stroutcounter)
       outputcounter.close()
  
if __name__ == '__main__':
    import optparse
    parser = optparse.OptionParser(usage="%prog [options]")
    parser.add_option("--otherversion", dest="otherversion", default=0,
                    help="Generate address with different version number")
    (options, args) = parser.parse_args()


answeryes = "y"
answercapitalyes = "Y"

test(int(options.otherversion))
  
 
Post
Topic
Board Project Development
Topic OP
I want to upload all public bitcoin addresses on blockchain to mysql, How?
by
deon
on 06/05/2017, 05:55:27 UTC
I want to upload all public bitcoin addresses on blockchain to mysql, How?

I guess a csv file of the blockchain would work. I want to use a python program to search the mysql database.

Post
Topic
Board Beginners & Help
Re: working on a bitcoin collider program in python, Am I on the right track?
by
deon
on 02/05/2017, 08:51:11 UTC
Here is the output if I find a private/public key combo.

I sent some bitcoin to the public address to see if it would work.  I didn't actually find one in the wild.

Code:
router@router-start:~/Desktop/python/bitcoingen$ python usethis.py
Y or N - Ready?
y
starting point
97674904567355991655113266145083667907747545640392289442288010322941462011111
d7f2096fe3f3b6902abc2afc3bab9ae3ce8d9303525f0505689a1507cca15ce7
97674904567355991655113266145083667907747545640392289442288010322941462011112
d7f2096fe3f3b6902abc2afc3bab9ae3ce8d9303525f0505689a1507cca15ce8
97674904567355991655113266145083667907747545640392289442288010322941462011113
d7f2096fe3f3b6902abc2afc3bab9ae3ce8d9303525f0505689a1507cca15ce9
97674904567355991655113266145083667907747545640392289442288010322941462011114
d7f2096fe3f3b6902abc2afc3bab9ae3ce8d9303525f0505689a1507cca15cea
we found one!
188CwnKs664tu4eKyohvektz6PbsCFPkFK
5KTPcpSHpmDAtYyjYX5VVWwkqRigQtxWf4o5pFYGd9wEGG5K2Tq
Post
Topic
Board Beginners & Help
Topic OP
working on a bitcoin collider program in python, Am I on the right track?
by
deon
on 02/05/2017, 08:45:42 UTC
I modified a script I found to take an input file with a 64 byte hex integer (77 integer exponent).  I check for any transactions and then increment by 1 and and check again.  I put a 12 second delay between calls so I don't overload blockchain.info.

Am I on the right track? 


Code:
#!/usr/bin/env python
# Joric/bitcoin-dev, june 2012, public domain

import hashlib
import time
import ctypes
import ctypes.util
import sys
from pybitcointools import *

ssl = ctypes.cdll.LoadLibrary (ctypes.util.find_library ('ssl') or 'libeay32')

def check_result (val, func, args):
    if val == 0: raise ValueError
    else: return ctypes.c_void_p (val)

ssl.EC_KEY_new_by_curve_name.restype = ctypes.c_void_p
ssl.EC_KEY_new_by_curve_name.errcheck = check_result

class KEY:
    def __init__(self):
        NID_secp256k1 = 714
        self.k = ssl.EC_KEY_new_by_curve_name(NID_secp256k1)
        self.compressed = False
        self.POINT_CONVERSION_COMPRESSED = 2
        self.POINT_CONVERSION_UNCOMPRESSED = 4

    def __del__(self):
        if ssl:
            ssl.EC_KEY_free(self.k)
        self.k = None

    def generate(self, secret=None):
        if secret:
            self.prikey = secret
            priv_key = ssl.BN_bin2bn(secret, 32, ssl.BN_new())
            group = ssl.EC_KEY_get0_group(self.k)
            pub_key = ssl.EC_POINT_new(group)
            ctx = ssl.BN_CTX_new()
            ssl.EC_POINT_mul(group, pub_key, priv_key, None, None, ctx)
            ssl.EC_KEY_set_private_key(self.k, priv_key)
            ssl.EC_KEY_set_public_key(self.k, pub_key)
            ssl.EC_POINT_free(pub_key)
            ssl.BN_CTX_free(ctx)
            return self.k
        else:
            return ssl.EC_KEY_generate_key(self.k)

    def get_pubkey(self):
        size = ssl.i2o_ECPublicKey(self.k, 0)
        mb = ctypes.create_string_buffer(size)
        ssl.i2o_ECPublicKey(self.k, ctypes.byref(ctypes.pointer(mb)))
        return mb.raw

    def get_secret(self):
        bn = ssl.EC_KEY_get0_private_key(self.k);
        bytes = (ssl.BN_num_bits(bn) + 7) / 8
        mb = ctypes.create_string_buffer(bytes)
        n = ssl.BN_bn2bin(bn, mb);
        return mb.raw.rjust(32, chr(0))

    def set_compressed(self, compressed):
        self.compressed = compressed
        if compressed:
            form = self.POINT_CONVERSION_COMPRESSED
        else:
            form = self.POINT_CONVERSION_UNCOMPRESSED
        ssl.EC_KEY_set_conv_form(self.k, form)

def dhash(s):
    return hashlib.sha256(hashlib.sha256(s).digest()).digest()

def rhash(s):
    h1 = hashlib.new('ripemd160')
    h1.update(hashlib.sha256(s).digest())
    return h1.digest()

b58_digits = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'

def base58_encode(n):
    l = []
    while n > 0:
        n, r = divmod(n, 58)
        l.insert(0,(b58_digits[r]))
    return ''.join(l)

def base58_decode(s):
    n = 0
    for ch in s:
        n *= 58
        digit = b58_digits.index(ch)
        n += digit
    return n

def base58_encode_padded(s):
    res = base58_encode(int('0x' + s.encode('hex'), 16))
    pad = 0
    for c in s:
        if c == chr(0):
            pad += 1
        else:
            break
    return b58_digits[0] * pad + res

def base58_decode_padded(s):
    pad = 0
    for c in s:
        if c == b58_digits[0]:
            pad += 1
        else:
            break
    h = '%x' % base58_decode(s)
    if len(h) % 2:
        h = '0' + h
    res = h.decode('hex')
    return chr(0) * pad + res

def base58_check_encode(s, version=0):
    vs = chr(version) + s
    check = dhash(vs)[:4]
    return base58_encode_padded(vs + check)

def base58_check_decode(s, version=0):
    k = base58_decode_padded(s)
    v0, data, check0 = k[0], k[1:-4], k[-4:]
    check1 = dhash(v0 + data)[:4]
    if check0 != check1:
        raise BaseException('checksum error')
    if version != ord(v0):
        raise BaseException('version mismatch')
    return data

def gen_eckey(passphrase=None, secret=None, pkey=None, compressed=False, rounds=1, version=0):
    k = KEY()
    if passphrase:
        secret = passphrase.encode('utf8')
        for i in xrange(rounds):
            secret = hashlib.sha256(secret).digest()
    if pkey:
        secret = base58_check_decode(pkey, 128+version)
        compressed = len(secret) == 33
        secret = secret[0:32]
    k.generate(secret)
    k.set_compressed(compressed)
    return k

def get_addr(k,version=0):
    time.sleep(12)
    pubkey = k.get_pubkey()
    secret = k.get_secret()
    hash160 = rhash(pubkey)
    addr = base58_check_encode(hash160,version)
    payload = secret
    if k.compressed:
        payload = secret + chr(1)
    pkey = base58_check_encode(payload, 128+version)
    h = history(addr)
    if h != []:
       print "we found one!"
       print addr
       print pkey
       sys.exit()
    return addr, pkey

def reencode(pkey,version=0):
    payload = base58_check_decode(pkey,128+version)
    secret = payload[:-1]
    payload = secret + chr(1)
    pkey = base58_check_encode(payload, 128+version)
    print get_addr(gen_eckey(pkey))

def test(otherversion):
    # random compressed
    #print get_addr(gen_eckey(compressed=True,version=otherversion),version=otherversion)

    # uncomment these to create addresses via a different method
    # random uncompressed
    #print get_addr(gen_eckey())
    # by secret
   
    inputfile = open('inputfile.txt', 'r')
    startdata = inputfile.read()
    inputfile.close()
    print "starting point"
   
    inputlove=startdata.strip()   
    inputlove = inputlove.zfill(64)
    inputkeyin = int(inputlove,16)

    startingpoint = int(inputlove,16)
   

   
    while inputkeyin < startingpoint + 100:
        print inputkeyin
        inputkeyhex = hex(inputkeyin)[2:-1]
        print inputkeyhex
        get_addr(gen_eckey(secret=inputkeyhex.decode('hex')))
        inputkeyin = int(inputkeyhex,16)
        inputkeyin = inputkeyin + 1
    outputfile = open('inputfile.txt', 'w')
    outputfile.write(inputkeyhex)
    outputfile.close()
 
if __name__ == '__main__':
    import optparse
    parser = optparse.OptionParser(usage="%prog [options]")
    parser.add_option("--otherversion", dest="otherversion", default=0,
                    help="Generate address with different version number")
    (options, args) = parser.parse_args()


answeryes = "y"
answercapitalyes = "Y"


print "Y or N  - Ready?"
fileresponse = raw_input()

if fileresponse == answeryes or fileresponse == answercapitalyes:
  test(int(options.otherversion))
else:
  print "maybe next time"
 
Post
Topic
Board Economics
Re: Is the world economy dependent on the American economy?
by
deon
on 22/01/2016, 10:09:38 UTC
The world economy is intertwined, the US economy is dependent on the world economy and vice versa. Naturally the world economy would suffer greatly if the US economy failed, but it would eventually recover and other economies would fill the vacuum.

This was what I was gonna say.  If Europe, China, or the US economy fail the effects will be felt worldwide.  But things will recover.  This is part of the issue today,  Every region is messing with their currencies. Trying to force infinite economic growth every quarter.
Post
Topic
Board Bitcoin Discussion
Re: Did anyone buy during $1200?
by
deon
on 22/01/2016, 09:48:59 UTC
Thank goodness no.  I was kicking myself when it got that high though and was watching the price at $10.

Post
Topic
Board Bitcoin Discussion
Re: Is Bitcoin 'real money' to you?
by
deon
on 23/12/2015, 05:50:40 UTC
Yes,  If somebody says they are gonna give me $5 is USD or Bitcoin,  I will be equally as happy.

Post
Topic
Board Speculation
Re: We're going to crash! Here's proof!
by
deon
on 23/12/2015, 05:42:38 UTC
Best way to predict the market is to force the market.  When you want to buy, spread misinformation and fear.  You can do this by using twitter.  Or going to a popular forum and telling everyone your autistic brother has predicted a crash.
 Smiley
Post
Topic
Board Bitcoin Discussion
Re: Is it a waste of time mentioning Bitcoin to friends and family?
by
deon
on 09/11/2015, 18:45:30 UTC
I don't talk about it with family.  I do with my friends that like tech stuff too.   I don't tell people to invest though,  I don't tell people to invest in anything anymore,  If the price goes down they will hate you.

I talk about bitcoin, Just as a small hobby for web and app development ideas.
Post
Topic
Board Gambling discussion
Re: Is their any safe methods to gamble?
by
deon
on 03/11/2015, 09:32:53 UTC
I gamble only for the fun of it.  Just assume I am gonna lose.  Try to give myself a limit.  When I lose the limit,  Time to stop.
Post
Topic
Board Off-topic
Re: 0.5 BTC reward - smart enough to tell me what is wrong with this book cover?
by
deon
on 03/11/2015, 09:27:20 UTC
The ants have too many segments.

That was my thinking too.  Head, thorax, and Abdomen.
Post
Topic
Board Bitcoin Discussion
Re: The lack of newbie friendly tutorials
by
deon
on 01/11/2015, 06:09:39 UTC
Best thing to do is just jump in with bitcoin.  Tell people to open an online wallet and they can usually figure the rest out.
Post
Topic
Board Micro Earnings
Re: In 2015, faucets are bad for bitcoin
by
deon
on 31/10/2015, 07:59:39 UTC
Kind of frustrating when you try to spend bitcoin from all those micro-transactions.    

I Sad
Post
Topic
Board Bitcoin Discussion
Re: Bitcoin vs Dollar
by
deon
on 30/10/2015, 13:04:35 UTC
There are rumors of negative interest rate and cash confiscation in the US.  I can see it happening. 

Zero interest rates are what is supporting the stock market.  Bitcoin is a good way to trade without going to banks and maybe hold onto your wealth.
Post
Topic
Board Bitcoin Discussion
Re: cash remains the only option if there's an emergency
by
deon
on 16/10/2015, 04:35:48 UTC
Remember the Boy Scout motto "Be Prepared"?    I believe in diversification.  Yes,  It is good to have some cash ready.  But what about a run on banks?  If you come walking out of the bank with your cash, there could be robbers or cops (civil forfeiture) following you home and ready to take your cash. 
Post
Topic
Board Bitcoin Discussion
Re: What's the biggest scam that's ever been in Bitcoin?
by
deon
on 07/10/2015, 09:58:25 UTC
Mt Gox is at the top of the list.  Number 2 is all the ransomware.  Looks really bad on the community when bitcoin payments are demanded for extortion.
Post
Topic
Board Bitcoin Discussion
Re: Do you spread the word about Bitcoin?
by
deon
on 15/09/2015, 16:47:54 UTC
I am gonna do a garage sale.  Post it in the local paper with "bitcoin accepted".

You guys gave me an idea too.  Maybe make a youtube video of the garage sale and show how easy it is to accept payment.
Post
Topic
Board Bitcoin Discussion
Re: Going to use profit I made via BTC to raise awareness!
by
deon
on 01/09/2015, 11:36:38 UTC
Great idea.  Ocean preservation sounds good.  People love animals/dolphins too.  I notice that on reddit.  Feel good story about bitcoin people help ocean life might be picked up by reddit and quickly followed by news organizations.
Post
Topic
Board Bitcoin Discussion
Re: What will happen to bitcoin in our wallet when we die
by
deon
on 25/07/2015, 06:06:37 UTC
I have a list of important passwords stored away in a safe for when I die.  This includes my coinbase account.   I will add my multibit password to the list too.  Thanks for bringing this up.
Post
Topic
Board Bitcoin Discussion
Re: Bill & Melinda Gates Foundation funds Bitsoko, promotes BTC literacy in Kenya
by
deon
on 15/07/2015, 14:38:46 UTC
That is pretty cool.  I think Bill and Melinda Gates are really into making the world a better place.  Opposed to the Bill Gates from Microsoft's early days. 

This could help Africa become more technologically advanced.  I view Bitcoin like NASA.  It gets people interested in Technology and creativity takes off.