Skip to main content

Creating a Token

1. Ensure that Rust is installed

To install Rust:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

2. Install the spl-token CLI

cargo install spl-token-cli

3. Ensure the Solana CLI RPC URL targets your intended environment

solana config get
Expected output

Config File: ~/.config/solana/cli/config.yml
RPC URL: https://testnet.atlas.xyz
WebSocket URL: wss://testnet.atlas.xyz/ (computed)
Keypair Path: ~/.config/solana/id.json
Commitment: confirmed

Use the following command to change the target URL:

solana config set --url https://testnet.atlas.xyz

3. Create a new keypair for the token mint

solana-keygen new -o <PATH_TO_KEYPAIR_FILE>

You can also generate a vanity address for the token mint.

4. Create the token

spl-token create-token <PATH_TO_TOKEN_MINT_KEYPAIR>
Expected output

Transaction signature: <SIGNATURE>

Now check that the deployment transaction was sucessful using the explorer: https://explorer.atlas.xyz/. You can also view the token details by clicking on the Mint account.

5. (Optional) Transfer and mint tokens

Now that you have a token, you can experiment with minting and transferring them.

Generate a keypair for your token account

solana-keygen new -o <PATH_TO_TOKEN_KEYPAIR_FILE>

Create the token account

spl-token create-account <TOKEN_MINT_ADDRESS> <PATH_TO_TOKEN_KEYPAIR_FILE>

Mint tokens to the token account

spl-token mint <TOKEN_MINT_ADDRESS> <TOKEN_AMOUNT> [RECIPIENT_TOKEN_ACCOUNT_ADDRESS]

Tip: use solana address -k <PATH_TO_TOKEN_KEYPAIR_FILE> to get the token account address.

Transferring

 spl-token transfer <TOKEN_MINT_ADDRESS> <TOKEN_AMOUNT> <RECIPIENT_WALLET_ADDRESS or RECIPIENT_TOKEN_ACCOUNT_ADDRESS>

Atlas's Token Program is the same as Solana's. If you want to learn more about tokens and the things you can do with them, read the spl-token documentation.