Skip to main content

How to Create a Custom Vanity Wallet Address using Solana CLI

Updated on
Jul 3, 2023

6 min read


Have you ever noticed that some Solana account addresses have defining prefixes or suffixes (e.g., DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ)?

Example of Vanity URL - $DUST

That can't just be random, right? Correct! Solana's CLI has some powerful tools to generate your own custom Wallet address. In this guide, you will create your very own custom wallet address using Solana CLI and the grind tool.

What You Will Need

Set Up Your Project

Create a new project directory in your terminal with:

mkdir custom-wallet
cd custom-wallet

Check that your Solana CLI tool is installed and up to date. In your terminal, enter:

solana --version

To check for and install updates, in your terminal, enter:

solana-install update

You should see something like this:

Solana CLI Update Complete

Let's get started.

Using Solana-Keygen

Solana CLI has a native command for creating new keypairs, Solana-Keygen. Solana-Keygen commands follow the following format:

solana-keygen [OPTIONS] <SUBCOMMAND>

Options and Subcommands are both outlined in the help menu. You can check them and all of the functionality of Solana-Keygen by entering the help subcommand in your terminal:

solana-keygen --help

You should see a help menu that looks something like this:

Solana CLI Help Menu

You should see a subcommand, grind. We will be using this to generate your custom wallet. This subcommand effectively generates keys until it finds one that meets your search criteria. Let's test it out!

solana-keygen grind --starts-with a23:1

You should see a response like this in your terminal:

custom-wallet % solana-keygen grind --starts-with a23:1
Searching with 10 threads for:
1 pubkey that starts with 'a23' and ends with ''
Wrote keypair to a23...mgr.json

Epic! You just created your first vanity wallet address, one that starts with 1 instance (set by the ":1") of "a23". You should see a .json file in your project folder with the private key of the new address. This can be imported into your Solana project using the Solana JS SDK by using:

const keypair = Keypair.fromSecretKey(Uint8Array.from(ARRAY_IN_JSON FILE));

Before checking out a few of solana-keygen's other features, let's grind a wallet that starts with 123456789. In your terminal, enter:

solana-keygen grind --starts-with 123456789:1

Your CLI should be showing you an update every couple of seconds that searching continues and 0 matches have been found:

custom-wallet % solana-keygen grind --starts-with 123456789:1                          
Searching with 10 threads for:
1 pubkey that starts with '123456789' and ends with ''
Searched 1000000 keypairs in 1s. 0 matches found.
Searched 2000000 keypairs in 3s. 0 matches found.
Searched 3000000 keypairs in 5s. 0 matches found.

Press CTRL+C to cancel your search, or you might be waiting a very long time. This is a good example of how the grind subcommand is working. It's looking for a keypair, checking if it matches your criteria, and trying again until your criteria are met. This illustration shows that it is significantly more difficult to find an address with nine user-defined variables than three. That said, it's usually common to only grind addresses with 2-5 characters defined. Beyond that, you'll be utilizing a tremendous amount of computing power and waiting a very long time.

Now let's explore some of the other features of solana-keygen. In your terminal, enter:

solana-keygen grind --help

Note the command above, as it's always a great point of reference if you forget how to use the command!

You'll see three sections: Usage, Flags, and Options (tbh, I see flags as just a different type of options, but Solana CLI separates them ):

Usage shows the format of our commands. We always start with solana-keygen grind followed by any flags and options: solana-keygen grind [FLAGS] [OPTIONS] [Your Search Query] 

  • --starts-with PREFIX:COUNT, where PREFIX is the desired custom prefix you are searching for and COUNT is the number of Keypairs to generate (e.g., --starts-with first:2 will generate two Keypairs with a wallet address that starts with quick).
  • --ends-with SUFFIX:COUNT, where SUFFIX is the desired custom suffix you are searching for and COUNT is the number of Keypairs to generate (e.g., --starts-with node:1 will generate one Keypairs with a wallet address that ends with node).
  • --starts-and-ends-with PREFIX:SUFFIX:COUNT, where PREFIX is the desired custom prefix you are searching for, SUFFIX is the desired custom suffix you are searching for, and COUNT is the number of Keypairs to generate (e.g., --starts-and-ends-with quick:node:3 will generate three Keypairs with a wallet address that starts with quick and ends with node).
  • Note: PREFIX and SUFFIX must be of type Base58 (A-Z, a-z, 0-9) except easily mistakable characters (zeroes (0), capital i’s (I) and o’s (O), lower case l’s).

Other Options

  • --ignore-case will make your search case insensitive (case sensitive by default)
  • --use-mnemonic    by default, the **grind** function saves a private key, not a mnemonic key phrase. This flag will generate using a mnemonic key phrase.  Expect a significant slowdown in this mode.
  • --no-outfile  (must be used in conjunction with --use-mnemonic). Only print a seed phrase and pubkey. Do not output a keypair file.
  • --no-bip39-passphrase (must be used in conjunction with --use-mnemonic). Do not prompt for a BIP39 passphrase (This passphrase improves the security of the recovery seed phrase, NOT the keypair file itself, which is stored as insecure plain text)
  • --word-count  (must be used in conjunction with --use-mnemonic). Specify the number of words that will be in the generated seed phrase (default: 12)
  • --language <LANGUAGE> (must be used in conjunction with --use-mnemonic) specify the language for the mnemonic phrase (english, chinese-simplified, chinese-traditional, japanese, spanish, korean, french, italian)
  • --num-threads <NUMBER> Specify the number of grind threads [default: 10]
  • -C, --config <FILEPATH> Configuration file to use

There's a lot there, so don't worry if it doesn't all make sense. The best way to learn is to test it out!

Create a Custom Wallet

Time to test it out! You can look above for help if you need it. Generate a single address that starts with your first name initial and ends with your last name initial (not case sensitive). Create a 24-word Japanese mnemonic that does not have a .json output or bip39 passphrase.

After you have tried it out on your own, you can take a look at how we did it below:

solana-keygen grind --starts-and-ends-with A:M:1 --ignore-case --use-mnemonic --word-count 24 --language japanese --no-outfile --no-bip39-passphrase 

How'd you do? If all went right, you should see a response in your terminal that says "Found matching key" with your wallet address and seed phrase! Pretty cool, right?

If you'd like, you can do a reverse look up with your seed phrase using this command: 

solana-keygen pubkey prompt://

I'd recommend trying out each option to understand how everything works and then make the address of your dreams!

Stay Safe Out There!

Remember, regardless of how you create new seeds or wallets, please practice wallet safety best practices. We have published a Guide: An Introduction to Crypto Wallets and How to Keep Them Secure to help you out.

Is your vanity wallet just scratching the surface of what you're looking for? Check out our Guide: How to Create a .sol Domain using Solana Naming Service to create a custom .sol domain name.

Create a cool wallet? Shoot us a note on Discord or Twitter and share!

We <3 Feedback!

If you have any feedback or questions on this guide, let us know. We’d love to hear from you!

Share this guide