Creating a token
Create a new SPL token mint, mint tokens, and transfer them
This recipe walks through the full lifecycle of an SPL token: creating a mint, minting tokens to your own associated token account (ATA), and transferring some to another wallet. It runs against a local validator so you can experiment without spending mainnet SOL.
Set up a client
Install Kit and the plugins you need.
Compose a client with a generated signer, a local RPC connection, an airdrop to fund the signer, and the Token program plugin. Make sure a local validator is running (solana-test-validator) before this code executes.
Create the mint
Generate a fresh signer for the mint account and ask the Token program plugin to build a createMint instruction plan. The plan creates the mint account, funds it for rent exemption, and initializes it as a Token mint — all in one atomic operation.
The mint authority is the signer allowed to mint new tokens later. Setting it to client.identity.address makes the current client's identity the authority, which is what you want for a recipe like this one.
Mint tokens to your ATA
Tokens live in associated token accounts (ATAs) — one ATA per (owner, mint) pair. The plugin's mintToATA helper derives the ATA address, creates it if it does not exist yet, and mints tokens to it in a single instruction plan.
mintToATA is asynchronous because it derives the ATA address before building the plan, but the .sendTransaction() shortcut is exposed on the returned promise itself — a single await on the call is enough. Pass the same decimals you used when creating the mint; the plugin uses it as a safety check to make sure you are minting against the mint you think you are.
Transfer tokens to a recipient
Sending tokens to another wallet follows the same pattern as minting: the plugin derives both the source and destination ATAs, creates the destination if it doesn't exist, and issues the transfer.
The authority is the owner of the source tokens, which here is the same identity that minted them. The plugin pulls tokens out of authority's ATA for the given mint, creates the recipient's ATA if needed, and deposits the tokens.
Next steps
- Using program plugins — explore everything
client.tokenand other program namespaces expose. - Fetching accounts — read the mint and token account balances back from the chain.
- Airdropping tokens — extend this recipe to many recipients in parallel.