Exemplo 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)
Exemplo n.º 2
0
 def test_encode_privkey(self):
     self.assertEqual(
         key.encode_privkey(
             int(
                 '7F3B6EAF1C8C3BFD8B0727B979746A932B6B9F9489898379DD65C1E3CCC3B4DF',
                 16)),
         '5JnKZDMUAddiGgFjWiHNVrX5pxGcEJ1miscs2Xhy7f9BrGffrps')
Exemplo 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)
Exemplo n.º 4
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)
Exemplo n.º 5
0
 def test_encode_privkey2(self):
     priv = 3566362552192297244228444858243043761472313190548212544975902619635471184649L
     self.assertEqual(
         key.encode_privkey(priv),
         '5Hskz9wmd3fnTPVnmPhaLtvaumjQU9ycCYWwkiRPgdQ1B4PcoAf')
Exemplo n.º 6
0
 def test_encode_privkey2(self):
     priv = 3566362552192297244228444858243043761472313190548212544975902619635471184649L
     self.assertEqual(
         key.encode_privkey(priv),
         '5Hskz9wmd3fnTPVnmPhaLtvaumjQU9ycCYWwkiRPgdQ1B4PcoAf')
Exemplo n.º 7
0
 def test_encode_privkey(self):
     self.assertEqual(
         key.encode_privkey(
             int('7F3B6EAF1C8C3BFD8B0727B979746A932B6B9F9489898379DD65C1E3CCC3B4DF', 16)),
         '5JnKZDMUAddiGgFjWiHNVrX5pxGcEJ1miscs2Xhy7f9BrGffrps')