2 min read

Vanity Public Ripple Validator

Vanity Public Ripple Validator

There are many reasons to run a Ripple validator.

Warren Anderson stated in an XRP Chat thread that the simplest reason for someone to run a validator is "to preserve and protect the stable operation and sensible evolution of the network."

I was an early employee at Ripple (back when it was called OpenCoin) and I still hold some of the XRP I was paid for my duties there.

Because of that, it only makes sense to run a validator and contribute to the decentralization of the Ripple network. However, while I was setting up my validator, I had a thought... why not make a vanity validator public key address?

If you take a look through the list of validators on Ripple's list they don't have very inspiring names, public keys are by design random, however where there have been plenty of projects to make vanity Ripple addresses there hasn't been a project yet to create vanity validator addresses. Mainly because there are so few validators out there!

So, I started the process of making a validator, if you want to make your own, the guide here is fairly straightforward and simple.

I got to the step where I generated my private and public key with this command:

$ /opt/ripple/bin/validator-keys create_keys

At this stage I worked on creating a vanity generator, my first step (since I didn't want to generate my keys on the public facing validator) was to download the validator-keys-tool that comes built in with rippled.

Once it was set up I could execute this to generate a private and public key locally without building rippled on another machine all over again:

$ ./validator-keys create_keys

At this point I searched for documentation on the format of validator public keys but I could not find any good sources describing the format. Eventually (after logging a couple thousand public key generations) I was able to figure out that all keys generated by this tool start with 'nH' followed by U B or D.

Then through a lot of trial and error (since coding is by no mean my day job) I came up with this simple python script to run that command above, check the public key for the phrase I desired using regex, and then if no match was found to delete the key file and try again.

import os  
import json  
import re  
trigger = 1  
attempts = 0  
while (trigger > 0):  
    os.system("rm -rf /home/username/.ripple/validator-keys.json")
    os.system("./validator-keys create_keys")
    with open('/home/username/.ripple/validator-keys.json') as data_file:    
        parsed_json = json.load(data_file)
    print(parsed_json['public_key'])
    attempts = attempts + 1
    print(attempts)
    if re.match("^n[H][UBD][jJ]o[n].*$", parsed_json['public_key']):
        trigger = 0
print('done')  

This script searches for 'Jon' in the public key. If you're not very good at using regex like I am, I recommend Regex101 to test and implement regex.

It runs at around 200-400 keys/s, which is pretty slow for a vanity generator but it worked well enough for a short vanity address!

Now, my vanity address at nHUjonMpArM6BKeYPQuqxgaC1aREnRtSqom5TjjiPjRu7UPHn6j7 is live on the Ripple network and acting as a public validator.

I'm currently waiting on domain name verification to have it be listed as jonhq.com's official validator, but until then the vanity address will be my own distinguishing feature.

Some caveats: this script is creating and deleting files at a rapid speed, this could potentially wear out an SSD, so use it cautiously. If someone makes a better vanity generator I'll link it here!