Robby Zambito

28 Feb 2021

How to Generate a Vanity Algorand Address

A vanity address is an address that has been generated such that it has some recognizable pattern. For example, if you want to accept Algorand at your business, you could generate a wallet whose address resembles or matches a portion of your business name. Personally, I have an address which matches my nickname, which is quite nice.

To generate addresses, I created this Go program (Repo can be found here).

package main

import (
    "fmt"
    "github.com/algorand/go-algorand-sdk/crypto"
    "github.com/algorand/go-algorand-sdk/mnemonic"
    "os"
    "regexp"
    "runtime"
)

func main() {
    walletChan := make(chan string)
    pattern := os.Args[1]
    for i := 0; i < runtime.NumCPU(); i++ {
        go func() {
            for {
                account := crypto.GenerateAccount()
                go func(acc crypto.Account) {
                    m, _ := mnemonic.FromPrivateKey(acc.PrivateKey)
                    wallet := fmt.Sprintf("%s:%s\n", acc.Address, m)
                    matched, _ := regexp.MatchString(pattern, wallet)
                    if matched {
                        walletChan <- wallet
                    }
                }(account)
            }
        }()
    }

    fmt.Println(<-walletChan)
    os.Exit(0)

}

This script is made available under the 0-clause BSD license

To run this program, you must have Go installed on your machine. I will assume you have it installed for this post. If you need help installing it, you can reach out to me, and I will try to help you get set up.

You can install this by running the following command, which should automatically build and install the dependencies.

$ go install git.robbyzambito.me/robby/vawg/v2@latest

If you have go installed properly, this should add the vawg binary to your $PATH. You can then generate a wallet by passing a regular expression as an argument. Here is an example of running the program:

$ vawg "^H[E3]LL[0O]"
H3LLOVA5RAKHN5ZDL6TMO5UF3XH5VS4UWELAL7UUFWKO6NUFALLK3BPM3I:number frog indicate over verb stable ignore salute leopard loop merit neither attract wrap assume pluck rely firm album deny shield dumb visit absent canal

I advise against using this wallet since I posted it on the internet.

This took about two minutes to run on my machine with a Ryzen 7 3700X. If it seems to hang and eat up a lot of CPU, that means it’s working :)

A few things to note:

  • Wallet addresses are in full caps, so if you do not pass it a full caps string it will never find a wallet.
  • The regular expression matches against the whole output. The ^ means that it should match against the beginning of the output. This is usually what you want.
  • Since it uses regular expressions, you could increase the results you would accept (and potentially cut down on search time) by providing accepted alternatives. This is shown in the example, where a 3 is accepted in place of an E, and a 0 would be accepted in place of an O.

The seed phrase (the sequence of words after the “:”) can be used to add the wallet to whatever wallet app you use.