Marketplace has launched, further enabling blockchain developers! Learn more

How to Create a Custom Vanity Wallet Address using Solana CLI

September 23, 2022

Overview

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:

set up your project

Copy
mkdir custom-wallet
cd custom-wallet

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

set up your project

Copy
solana --version

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

set up your project

Copy
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:

using solana keygen

Copy
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:

using solana keygen

Copy
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!

using solana keygen

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

You should see a response like this in your terminal:

using solana keygen

Copy
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:

using solana keygen

Copy
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:

using solana keygen

Copy
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:

using solana keygen

Copy
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.
etc.

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:

using solana keygen

Copy
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:

create a custom wallet

Copy
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: 

create a custom wallet

Copy
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!

Related articles 26

How to Use the Solana Memo Program
Originally Published On: Sep 16, 2022
Updated On: Sep 23, 2022

Tools like Create a new project directory... Import Necessary... To send a memo transaction, we... Now, how can we fetch that memo... You may have noticed in creating... Transaction memos can be a handy...

Continue reading
How to Transfer SPL Tokens on Solana
Originally Published On: Sep 23, 2022
Updated On: Sep 23, 2022

Sending Solana Program Library... Before getting started, it is... Create a new project directory... Import Necessary... If you have created a fungible... Create a new async function,... Finally, at the end of your... Awesome! You now know how to...

Continue reading
How to Send Bulk Transactions on Solana
Originally Published On: Aug 31, 2022
Updated On: Sep 23, 2022

Are you running a batch process... Create a new project directory... Let's start by creating a list... Import Necessary... If you're new to Solana or web3,... Alright! You have an array of... Let's call our functions and... So, our simple example above... Congrats! You just sent SOL to...

Continue reading
How to Send a Transaction On Solana Using JavaScript
Originally Published On: Aug 15, 2021
Updated On: Sep 23, 2022

Hello reader! Today is an... You need to set up your project... While this goal could be... To connect to the devnet that... With a connection to the... On to the fun bit! We can now... Congratulations! If you made it...

Continue reading
How to Query Solana Naming Service Domains (.sol)
Originally Published On: Aug 19, 2022
Updated On: Sep 23, 2022

In a recent guide, we covered To run our on-chain queries,... To build on Solana, you'll need... Let's start by creating a new... Create a new function below... Let's declare our search queries... You now have the tools to run...

Continue reading
How to Deploy an NFT Collection on Solana Using Sugar (Candy Machine)
Originally Published On: Jul 28, 2022
Updated On: Sep 23, 2022

Are you ready to launch your NFT... Create a new project directory... Mac... One of the cool new features of... Next, we will want to fund our... If you have used Candy Machine... Create a new file,... Because we've set our RPC and... For the easiest possible set up,... Congrats! You created a Candy...

Continue reading
How to Mint an NFT on Solana
Originally Published On: Aug 27, 2021
Updated On: Sep 23, 2022

Updated at: April 10,... Solana's goal is singular in... Open Terminal and navigate to a... Open the... The first task we'll need to... We'll now need to create a new... We have an account to send the... Now it's time to mint an NFT and... If you made it this far, you...

Continue reading
How to Mint an NFT on Solana Using Candy Machine
Originally Published On: Sep 20, 2021
Updated On: Sep 23, 2022

NOTE:... Hello reader! We have had a lot... Candy Machine is a tool that... There are two different... With all of the code pulled down... With everything in place there... Congratulations! You just minted...

Continue reading
Como crear un NFT en SOLANA
Originally Published On: Dec 27, 2021
Updated On: Sep 23, 2022

¡Hola querido lector!... Solana tiene un objetivo muy... Nosotros usaremos Solana Devnet... Esta es la parte divertida! La... Si has llegado hasta aquí, has...

Continue reading
How to Create Websocket Subscriptions to Solana Blockchain using Typescript
Originally Published On: Jul 15, 2022
Updated On: Sep 23, 2022

Creating event listeners is an... Create a new project directory... To build on Solana, you'll need... On line 5, create a new... To track a wallet on Solana,... This code is ready to run as is,... Let's go ahead and test it... Solana has created a built-in... Solana has several other,... Nice work! Now you should have a...

Continue reading
An Introduction to the Solana Account Model
Originally Published On: Apr 18, 2022
Updated On: Sep 23, 2022

The Accounts are any place where... There are two types of accounts... Unfortunately, storing all this... To create an account on Solana,... Since the program code and data... Creating and interacting with...

Continue reading
How to Get Transaction Logs on Solana
Originally Published On: Jun 24, 2022
Updated On: Sep 23, 2022

Ever need to pull all the... Create a new project directory... To build on Solana, you'll need... The... If everything is set up... So we've got some useful basic... Kudos! You've now got an inside...

Continue reading
How to Deploy an NFT on Solana Using Candy Machine V2
Originally Published On: Jan 15, 2022
Updated On: Sep 23, 2022

Candy Machine 2 has been... Hello readers, in this guide we... Now, let us begin the... If you have used CMv1 or... With all of our assets loaded... For the easiest possible set up,... Congratulations on successfully...

Continue reading
Como crear un NFT en Solana usando Candy Machine
Originally Published On: Dec 27, 2021
Updated On: Sep 23, 2022

¡Hola querido lector! Hemos... Candy Machine es un programa que... Hay dos repositorios diferentes... Una vez que el código se ha... Con todo lo que hemos realizado... ¡Felicidades! Acabas de hacer...

Continue reading
How to Build a Wallet Generator for Solana in React
Originally Published On: Oct 27, 2021
Updated On: Sep 23, 2022

In this practical guide you will... We have prepared a small... Connection to Solana Network is... To create an account we will... To get the balance of an account... As we said before, in... Congratulations on making it to...

Continue reading