how to create a custom solana wallet
/Development

Solana Dev 101 - File system wallets + How to create a custom wallet

4 min read

This blog aims to shed light on what file system wallets are, how to create them, and how to utilize them. Let's get started!

What is a file system wallet?

A file system wallet refers to a wallet where the cryptographic keys are stored as a file on your device. These keys are used to sign transactions and authenticate ones identity when interacting with the Solana network. Unlike hardware wallets or web-based wallets, file system wallets store the keys locally on the device rather than on external hardware or in the cloud. This means that the user has direct control over their keys and is responsible for keeping them secure.

The main advantage of a file system wallet over other types of wallets is its simplicity and flexibility. There's no need for a web interface, no plugins, and no dependencies. It's just a file that you can manage yourself,

How to Create a File System Wallet

It is really easy to create a file system wallet.

First, you'll need to install Solana's command-line tool suite, Solana-CLI, if you haven't already.

You can do this using the following command:

Code
$ sh -c "$(curl -sSfL )"

With Solana-CLI installed, you can now generate a new keypair, which will be stored in a file.

Use the following command to create a new wallet:

Code
solana-keygen new --outfile ~/my-keypair.json

‍This command will create a new keypair and store it in a file named "my-keypair.json”.

How to Use a File System Wallet

Now that you have your file system wallet, you can use it to sign transactions on the Solana network.

When you want to run a CLI command that requires a wallet, you can use the --keypair option followed by the path to your wallet file.

For example, if you want to get the balance of your account, you can use the following command:

Code
solana balance --keypair ~/solana-wallet/my-keypair.json

You will also be able to use these wallets in your Javascript code. The Solana JavaScript SDK makes it easy to bring these wallets into your code as KeyPairs. Simply add the following line of code:

Code
const keypair = Keypair.fromSecretKey(Uint8Array.from());

Make sure to copy the secret key array from the newly created json file and paste it in the parameters.

How to create a custom wallet address

One cool thing about the solana-keygen command is that you are able to create a wallet address that starts and ends with specific characters. This can be great for tracking or setting up easily recognisable wallets.

The solana-keygen command has the choice of both options and subcommands. We will make use of the “grind” subcommand to grind for a vanity key-pair.

If we wanted to create a wallet that starts with “test” we would run the following command:

Code
solana-keygen grind --starts-with 123:1

This will specify that we want the wallet address to start with the string “owen” and that we only want to generate one wallet address. Once this command has been run your machine will now search through millions of keypairs to find a match.

There are a lot of options when it comes to creating a custom address, you can see them all by running:

Code
solana-keygen grind --help

One of the common options is used if you would like a recovery phrase.

You can add in the —use-mnemonic flag to achieve this.

Conclusion

File System Wallets on Solana provide a simple and flexible way for developers to create and use wallets. They are easy to set up and allow full control of the wallet and offer some cool customization options.

While this method might not be suitable for every user due to the level of responsibility it entails, it presents a clear advantage for developers and knowledgable individuals who prefer having full control over their wallet.

Related Articles

Subscribe to Helius

Stay up-to-date with the latest in Solana development and receive updates when we post