Ejemplo n.º 1
0
def mine(g_num, work):
    num = 0
    while True:
        try:
            priv = key.generate_priv()
            pub = key.priv_to_pub(priv)
            addr = byte_util.base58_encode(key.pub_to_address(pub))
            addr_comp = byte_util.base58_encode(
                key.pub_to_address_compressed(pub))
            num += 1
            if num % INC == 0:
                with g_num.get_lock():
                    g_num.value += INC
                # if g_num.value > 10000:
                #     return
            if any(VANITY_RE.match(a) for a in [addr, addr_comp]):
                try:
                    priv_enc = key.encode_privkey(priv)
                except Exception, e:
                    priv_enc = repr(e)
                try:
                    priv_cmp_enc = key.encode_privkey_compressed(priv)
                except Exception, e:
                    priv_cmp_enc = repr(e)
                msg = '\nI found one!\nAddress: %s\nAddress (compressed): %s\nPrivate Key (raw): %r\nPrivate Key Encoded: %s\nPrivate Key Encoded (compressed): %s\n' % (
                    addr, addr_comp, priv, priv_enc, priv_cmp_enc)
                print msg[:-1]
                with open('found_keys', 'a') as found_keys:
                    found_keys.write(msg)

            for rec in work:
                pub_sum = pub + rec['public_key']
                addr = byte_util.base58_encode(key.pub_to_address(pub_sum))
                addr_comp = byte_util.base58_encode(
                    key.pub_to_address_compressed(pub_sum))
                if not any(
                        a.startswith(rec['pattern'])
                        for a in [addr, addr_comp]):
                    continue

                try:
                    priv_hex = hex(priv)[2:].rstrip('L').upper()
                except Exception, e:
                    priv_hex = repr(e)
                try:
                    priv_enc = key.encode_privkey(priv)
                except Exception, e:
                    priv_enc = repr(e)
Ejemplo n.º 2
0
def main():
    priv = key.generate_priv()
    priv_enc = key.encode_privkey(priv)
    priv_cmp_enc = key.encode_privkey_compressed(priv)
    pub = key.priv_to_pub(priv)
    addr = byte_util.base58_encode(key.pub_to_address(pub))
    addr_comp = byte_util.base58_encode(key.pub_to_address_compressed(pub))
    print 'Address: %s\nPrivate Key Encoded: %s\nAddress (compressed): %s\nPrivate Key Encoded (compressed): %s' % (addr, priv_enc, addr_comp, priv_cmp_enc)
Ejemplo n.º 3
0
def main():
    priv = key.generate_priv()
    priv_enc = key.encode_privkey(priv)
    priv_cmp_enc = key.encode_privkey_compressed(priv)
    pub = key.priv_to_pub(priv)
    addr = byte_util.base58_encode(key.pub_to_address(pub))
    addr_comp = byte_util.base58_encode(key.pub_to_address_compressed(pub))
    print 'Address: %s\nPrivate Key Encoded: %s\nAddress (compressed): %s\nPrivate Key Encoded (compressed): %s' % (
        addr, priv_enc, addr_comp, priv_cmp_enc)