Initial attempt to add Zcash support to vanitygen

From the file . * HUGE ENORMOUS DISCLAIMER *

** THIS FORK OF VANITYGEN IS *NOT TO BE TRUSTED ***
- EXPECT ERRORS
- VERIFY ANY AND ALL OUTPUT FROM THIS PROGRAM THAT ISN'T IMMEDIATELY DISCARDED

The purpose of this fork is to produce a new version of vanitygen that supports Zcash address generation.

Due to remaining bitcoin specific program logic, Zcash address generation is limited to when the program is initiated such as this:

./vanitygen -r abc

1 Like

The above warning still applies but some additional bitcoin specific program logic has been replaced so it can now be invoked like this:

./vanitygen t1abc

Pssst the command is ./vanitygen_z and
add
sudo apt-get install libpcre3 libpcre3dev
to your readme file

Thank you for that - I decided a name-change was needed to better differentiate this repository from the original... OpenSSL is also needed but if you've previously compiled Zcash from source that should already be there...

So, to generate a 't1' address with 'abc' as the vanity string:

./vanitygen_z t1abc

And a 't3' address:

./vanitygen_z -F script t3abc

Any plans for OCL support? Would speed things up a bunch

I don't have the means to test GPU code. But the existing edits might give someone else a push in the right direction.

I have added gpu support.

Its buggy if you input a third character of prefix that it doesn't like. You have to play around a bit with it but it works.

2 Likes

exploitagency, thanks for adding GPU support!

One note/request - there is a restriction on the third character that is currently not rejected.

Valid third characters are H-Z (except for I and O) and a-h. (In other words: H J K L M N P Q R S T U V W X Y Z a b c d e f g h).

If you specify filters that include an invalid third character, there is no warning, but you will get no results.

(I would have opened a GitHub issue on this, but they don't seem to be enabled for that repo).

EDIT: I see that you already warned us about that above! I think there's still value in explaining that it will not warn the user, though (and which characters are allowed). :slight_smile:

EDIT: Also, here's a simple shell loop to run oclvanitygen_z on all GPUs. Adjust the list of dev IDs to match your number of GPUs. Stop them all with 'pkill oclvanitygen_z'. (I create the files in advance in case you want to watch them with multitail, etc.)

#!/bin/bash
for dev in 0 1 2 3 4 5; do
    touch founds-${dev}.out
    ./oclvanitygen_z -o founds-${dev}.out -k -p 0 -d ${dev} -f patterns.list &
done

I will work on it eventually.

Here are Windows Binaries...

1 Like

I have generated some private keys with the ocl version on windows. But all the private keys in the output are one character too short I think. When importing it gives an error.

Also, all the private keys have that i've generated start with a 5.

Example:
Pattern: t1awE
Address: t1awEBMJRwZEQwwnP4H6Ywkwa3x39Tyv9FJ
Privkey: 5JWdjKm3Re8wESP3ni1eE6nBscNi8xnhtzRhEcmdmziKE2b1Bhy

Seems to work under Linux…

I have never moved any funds with one of the accounts though.

What arguments are you feeding the command? It could also be whatever wallet you are trying to use. It would be nice if someone can verify one of these addresses by doing a small funds transfer to/from a vanitygen_z address.

./oclvanitygen_z t1awE

Difficulty: 78508
Pattern: t1awE
Address: t1awEJTdgfoREsdF6Xx11fELyUMeQdXnBf1
Privkey: 5HvSXXEAeCjCKcQR7yQdf8zcvVAB4agEHLfTcbGFAphzwuQdQvf

zcash-cli importprivkey 5HvSXXEAeCjCKcQR7yQdf8zcvVAB4agEHLfTcbGFAphzwuQdQvf

zcash-cli getaddressesbyaccount “”

“t1awEJTdgfoREsdF6Xx11fELyUMeQdXnBf1”,

The example output you gave appears to be the correct length. Were you trying to import the address or the private key?

Tested importing the private key you posted. It appears to have imported correctly. Has anyone done any test spends on vanitygen_z addresses yet?

I used "oclvanitygen_z -o keys t1awE" for the example

I attempted to import the private key with the zcash4win & zcash4mac wallet UI. Both failed - "Invalid spending key" error.

Now I tried with both CMD and the OSX Terminal, and it imported just fine. I think It might have something to do with the java zcash swing wallet.

oclvanitygen_z and vanitygen_z seem to be working fine.

I also moved some funds around succesfully

see https://insight.mercerweiss.com/address/t1awesome7Taq4BT3a9KpUrfnD7rrkWj1jW

One word, t1AWESOME!

Glad it is working out for you. You should report this as a bug to the java wallet devs then so there can be more widespread adoption of the program. Voluntary put a lot of hard work into this project, more people should be using it as there are plenty of reasons for using a vanity address.

1 Like

Thank you for the mention but I only tinkered at the edges to make someone else's program output Zcash addresses. This the link to the project I forked from - https://github.com/samr7/vanitygen

1 Like

I use vanitygen_z on Windows 10.

  1. For greater security, I would like to delete all app files after the address generation. Is it enough to delete vanitygen_z-windows-binary folder? Or should I find any other files or folders at my computer, which can contain the related data, and can be stolen from my computer, in order to stole coins from the wallet?

  2. I saw in CMD options 2 commands that I can use for the encryption of private key:
    Encrypt
    But there’s no command for privkey decryption in CMD options. So, how can I decrypt the encrypted private key?

Aside from attempting to remove options for other crypto currencies (because transparent Zcash addresses have a two byte prefix instead of the typical one byte used by most other currencies), the modifications I made to the original source only focused on address generation. Short answer: I don’t know anything about the encryption and decryption features.

Re: Windows security, I also don’t know. Sorry.

If you don’t care about the vanity aspect of the program and just want to securely generate a private key and transparent address, I also modified Matt Whitlock’s diceware program to output Zcash addresses. The only hitch with that is it’s a big-endian program (ie: not suitable for little-endian Intel / AMD cpus).

Edit: btw I haven’t given these programs much thought since I got a Trezor. Hardware wallets are a much better way to securely use crypto currencies. As good as paper wallet cold storage may be, when it comes time to spend it can be difficult without exposing the private key. For Bitcoin, the Electrum wallet provides the possibility of offline signing but I’m not aware of people being able to do this with any of the current Zcash software.

Thank you for your answers!
Anyway, vanitygen_z is very fine and simple app, I liked it very much!