Create a Vanity Wallet Address with Solana-Keygen

·

Overview

Have you ever wondered how some Solana wallet addresses feature custom prefixes or suffixes (e.g., DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ)?

These aren’t random—they’re crafted using Solana’s CLI tools! In this guide, you’ll learn how to generate a personalized vanity wallet address using the solana-keygen grind command.

👉 Discover advanced wallet customization tips

Prerequisites


Step 1: Project Setup

  1. Create a project directory:

    mkdir custom-wallet
    cd custom-wallet
  2. Verify Solana CLI installation:

    solana --version
  3. Update Solana CLI if needed:

    solana-install update

Step 2: Using Solana-Keygen

The solana-keygen tool generates keypairs with customizable addresses. Key commands:

solana-keygen [OPTIONS] <SUBCOMMAND>

Generate a Vanity Address

Use the grind subcommand to search for specific address patterns:

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

Output:

Wrote keypair to a23...mgr.json

This creates a wallet starting with a23 and saves the private key to a .json file.


Customization Options

OptionDescriptionExample
--starts-with PREFIX:COUNTFinds addresses starting with PREFIX--starts-with sol:2
--ends-with SUFFIX:COUNTFinds addresses ending with SUFFIX--ends-with ana:1
--starts-and-ends-with PREFIX:SUFFIX:COUNTCombines prefix and suffix--starts-and-ends-with quick:node:3
--ignore-caseCase-insensitive search--starts-with ABC --ignore-case
--use-mnemonicGenerates a seed phrase (slower)--use-mnemonic --word-count 24

👉 Optimize your Solana wallet security


Step 3: Advanced Example

Generate a 24-word Japanese mnemonic wallet starting with A and ending with M:

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

Output:

Found matching key: Address: A...M
Seed Phrase: そら まど あじ あう ...

Best Practices

  1. Avoid overly complex patterns (e.g., 123456789 takes hours to compute).
  2. Secure your seed phrases: Never share .json files or mnemonics.
  3. Use BIP39 passphrases for added security (except with --no-bip39-passphrase).

FAQ

1. How long does it take to generate a vanity address?

2. Can I use special characters in prefixes?

3. Is a vanity address less secure?

4. How do I import a generated keypair?

const keypair = Keypair.fromSecretKey(
  Uint8Array.from(JSON.parse(fs.readFileSync('a23...mgr.json')))
);

Final Notes

For feedback or topic requests, contact us.

🚀 Happy grinding!