Author

Topic: Vanity P2SH address generator! (Read 937 times)

full member
Activity: 157
Merit: 113
June 13, 2017, 06:52:01 AM
#6
It's actually very easy to implement, there's existing OpenCL code for everything necessary.
In order to generate a P2SH vanity address, you only have to calculate the HASH160 of the script and base58check-encode it.

You can open an issue in the vanitygen repo, and I actually have an implementation already, but it is CPU-only though.
newbie
Activity: 45
Merit: 0
June 13, 2017, 02:24:50 AM
#5
There aren't any yet that generate P2SH vanity addresses.

It's strange, why there has not yet appeared a online service that would generate P2SH vanity addresses, is there really no demand for them?

Perhaps the matter is that oclvanitygen does not support the generation of P2SH addresses, and using vanitygen for this would be very slow and inefficient ...
full member
Activity: 157
Merit: 113
June 12, 2017, 06:12:39 AM
#4
There aren't any yet that generate P2SH vanity addresses.
You can try emailing ThePiachu, who owns the Vanity Pool, maybe he can add them.

Also, vanitygen already supports them, but not in a multisig manner like my program does.
By the way, if you generate multisig P2SH vanity addresses, their generation does not require a trusted party, so
  you can do this in a provably secure way.
newbie
Activity: 45
Merit: 0
June 12, 2017, 04:51:32 AM
#3
Can someone know if there are online services that generate a P2SH vanity address on demand?
full member
Activity: 157
Merit: 113
May 01, 2017, 09:15:48 AM
#2
There's another program like this, which has more features, check it out too (it's not mine): https://github.com/antonio-fr/SigVanity/
full member
Activity: 157
Merit: 113
May 01, 2017, 07:48:06 AM
#1
Hey guys!
I have developed a proof-of-concept P2SH vanity address generator!
This program is an implementation of this idea: https://bitcointalksearch.org/topic/10x-faster-vanity-addresses-p2shm-255245.
It's written in Python, thus is very slow, but that's a good proof of concept.

You'll need Python 2.7 and pybitcointools installed.

Code:
#!/usr/bin/env python2
import time
import multiprocessing

from pybitcointools import *

def uint256(x):
    hexdigits = hex(x)[2:].replace("L", "")
    hexdigits = "0"*(64-len(hexdigits)) + hexdigits
    binary = hexdigits.decode("hex")
    return binary

def make_script(pubkey1, pubkey2):
    script = [1, pubkey1, pubkey2, 2, 174]
    return serialize_script(script)

def p2sh(script):
    return hex_to_b58check(hash160(script), 5)

def _worker_thread(thread_number, total_threads, starting_k, pattern, quit):
    print "Worker %d started" % thread_number
    k = starting_k + thread_number
    total = k

    while not quit.is_set():
        start = time.time()
        pubkey2 = "\x02" + uint256(k)
        k += total_threads

        redeem_script = make_script(pubkey1, pubkey2)
        p2sh_addr = p2sh(redeem_script)

        if p2sh_addr[1:].startswith(pattern):
            print "Found!"
            print "P2SH address: " + p2sh_addr
            print "Redeem script: " + redeem_script.encode("hex")
            quit.set()

        elapsed = time.time() - start

        num_checked = k - starting_k
        if num_checked % 16384 == thread_number:
            print "Worker %d: %d addrs per second, %d checked" % (thread_number, 1.0 / elapsed, num_checked)

privkey = random_key()
pubkey1 = encode_pubkey(privtopub(privkey), "bin_compressed")

pattern = raw_input("Vanity pattern: ")

quit = multiprocessing.Event()
total_processes = multiprocessing.cpu_count()

starting_k = int(encode_pubkey(privtopub(privkey), "hex_compressed")[2:], 16) + 1

for worker_num in range(total_processes):
    print "Starting worker %d" % worker_num
    process = multiprocessing.Process(target=_worker_thread, args=(worker_num, total_processes, starting_k, pattern, quit))
    process.start()

quit.wait()

print("Spend private key: %s" % encode_privkey(privkey, "wif"))

Code:
Vanity pattern: P14
Starting worker 0
Starting worker 1
Starting worker 2
Starting worker 3
Worker 0 started
Worker 2 started
Worker 1 started
Worker 3 started
Found!
P2SH address: 3P14KiomBxh3S4QCzztj86E7wi8SQnn314
Redeem script: 512102296c1c6e3acac2d7698a36eb70a5c196cfcc7546c277ff29054281a8be4dd4282102296c1c6e3acac2d7698a36eb70a5c196cfcc7546c277ff29054281a8be4e9d1252ae
Spend private key: 5JFYKkqeku1ytA7p5PSMgRm8Xq3EQGQKsr7nyUUZXns5gvfyV5U

It works by having a dummy public key which is altered to make the script hash contain a specific prefix.
Security: the public key chosen for the nonce public key (intended to be unspendable and unknown) is an incremented value of the actual spending public key. I'd like to hear on the security of that.
It's very easy to add multisig support to this, I'd like to hear on it if needed.
Again, this program is not yet intended for real-world use, so please don't risk funds with it.
I'd like to hear from testers if it works properly (I've done some checks myself and it seems to work fine).

If you find it useful, please consider a donation to the address in my signature, thank you!
Jump to: