Index of every page on this site: llms.txt
All skills
Run it yourself

Use when user asks to "build a Solana dapp", "write an Anchor program", "create a token", "debug Solana errors", "set up wallet connection", "test my Solana program", "fuzz my Solana program", "deploy to devnet", "send a v1 transaction", "support larger transactions", "fix maxSupportedTransactionVersion", or "explain Solana concepts" (rent, accounts, PDAs, CPIs). Also for program architecture (state layout, compute units, throughput, naming), quick on-chain lookups via public RPC + curl, gasless or sponsored-fee transactions (Kora), server-side signing with KMS/Turnkey/Privy/Fireblocks (Solana Keychain), and issuing stablecoins or allowlisted tokens (Mosaic). Covers wallets, Anchor/Pinocchio, Codama clients, Surfpool/LiteSVM/Mollusk testing, security review, and v1 transactions (SIMD-0385). Prefers @solana/kit 8 plugin clients building transaction v1 by default, @solana/kit-plugin-wallet + @solana/react for wallets, web3.js v3 as the legacy migration target, and Surfpool for local networks.

Use this Skill: https://skilld.dev/gh/solana-foundation/solana-dev-skill/solana-dev

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referenceskitprogramstoken.md

≈1.9k tokens on demand. Your agent reads this file only when SKILL.md points to it.

SPL Token Program

Solana's standard token program. Defines Mints (token config + supply) and Token Accounts (per-owner balances). For tokens that need extensions, use Token-2022 instead.

If using plugin clients, prefer client.use(tokenProgram()) for a fluent API that auto-derives ATAs and defaults the payer. The low-level instructions below are for manual pipe() transaction building. See overview.md and plugins.md.

Program address: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA

import { TOKEN_PROGRAM_ADDRESS } from '@solana-program/token';

Account Types

Mint (82 bytes)

import { fetchMint, fetchMaybeMint, getMintSize } from '@solana-program/token';

const mint = await fetchMint(rpc, mintAddress);
// mint.data.decimals, mint.data.supply, mint.data.mintAuthority, mint.data.freezeAuthority

Token Account (165 bytes)

import { fetchToken, fetchMaybeToken, getTokenSize } from '@solana-program/token';

const token = await fetchToken(rpc, tokenAddress);
// token.data.mint, token.data.owner, token.data.amount

Multisig

import { fetchMultisig } from '@solana-program/token';

const multisig = await fetchMultisig(rpc, multisigAddress);
// multisig.data.m, multisig.data.n, multisig.data.signers

PDA: Associated Token Account

One deterministic token account per owner per mint. Derived from owner + mint + token program — no on-chain lookup needed. Always prefer ATAs for user-facing flows.

import { findAssociatedTokenPda, TOKEN_PROGRAM_ADDRESS } from '@solana-program/token';

const [ata] = await findAssociatedTokenPda({
  owner: walletAddress,
  mint: mintAddress,
  tokenProgram: TOKEN_PROGRAM_ADDRESS,
});

Key Instructions

Initialize Mint

import { getInitializeMintInstruction } from '@solana-program/token';

const ix = getInitializeMintInstruction({
  mint: mintKeypair.address,
  decimals: 9,
  mintAuthority: authority.address,
  freezeAuthority: authority.address, // optional
});

Transfer

Prefer getTransferCheckedInstruction — validates mint and decimals on-chain, preventing wrong-token transfers.

import { getTransferInstruction, getTransferCheckedInstruction } from '@solana-program/token';

// Simple transfer
const ix = getTransferInstruction({
  source: sourceTokenAccount,
  destination: destTokenAccount,
  authority: owner,
  amount: 1_000_000n,
});

// Checked transfer (validates decimals)
const ix = getTransferCheckedInstruction({
  source: sourceTokenAccount,
  mint: mintAddress,
  destination: destTokenAccount,
  authority: owner,
  amount: 1_000_000n,
  decimals: 9,
});

Mint To

import { getMintToInstruction, getMintToCheckedInstruction } from '@solana-program/token';

const ix = getMintToInstruction({
  mint: mintAddress,
  token: destinationTokenAccount,
  mintAuthority: authority,
  amount: 1_000_000_000n,
});

Approve Delegate

import { getApproveInstruction } from '@solana-program/token';

const ix = getApproveInstruction({
  source: tokenAccount,
  delegate: delegateAddress,
  owner: owner,
  amount: 500_000n,
});

Burn

import { getBurnInstruction } from '@solana-program/token';

const ix = getBurnInstruction({
  account: tokenAccount,
  mint: mintAddress,
  authority: owner,
  amount: 100_000n,
});

Instruction Plans

Handle multi-step operations (e.g., create ATA if needed). Auto-check preconditions and only include necessary instructions — use for user-facing flows. Build a plan with the get*InstructionPlan builders, then execute it through a plugin client that has planning + sending capability via client.sendTransaction(plan) (see plugins.md). For a shorter form, client.use(tokenProgram()) exposes client.token.instructions.createMint(...) / client.token.instructions.mintToATA(...); call .sendTransaction() on the returned plan to submit (e.g. await client.token.instructions.createMint({ newMint, decimals, mintAuthority }).sendTransaction()).

Create Mint

import { getCreateMintInstructionPlan } from '@solana-program/token';

const plan = getCreateMintInstructionPlan({
  payer,
  newMint: mintKeypair,
  decimals: 9,
  mintAuthority: authority.address,
});

await client.sendTransaction(plan);

Mint to ATA (Creates ATA if needed)

Use the async builder — it derives the ATA automatically.

import { getMintToATAInstructionPlanAsync } from '@solana-program/token';

const plan = await getMintToATAInstructionPlanAsync({
  payer,
  owner: recipientAddress,
  mint: mintAddress,
  mintAuthority: authority,
  amount: 1_000_000_000n,
  decimals: 9,
});

await client.sendTransaction(plan);

Complete Pattern: Create Token + Mint

import {
  pipe, createTransactionMessage, setTransactionMessageFeePayerSigner,
  setTransactionMessageLifetimeUsingBlockhash, appendTransactionMessageInstructions,
  fillTransactionMessageProvisoryResourceLimits,
  estimateResourceLimitsFactory, estimateAndSetResourceLimitsFactory,
  signTransactionMessageWithSigners, sendAndConfirmTransactionFactory,
  assertIsTransactionWithBlockhashLifetime, generateKeyPairSigner, lamports,
} from '@solana/kit';
import {
  getInitializeMintInstruction, getMintToInstruction,
  getMintSize, TOKEN_PROGRAM_ADDRESS, findAssociatedTokenPda,
  getCreateAssociatedTokenInstruction,
} from '@solana-program/token';
import { getCreateAccountInstruction } from '@solana-program/system';

// 1. Generate mint keypair
const mintKeypair = await generateKeyPairSigner();

// 2. Get rent
const mintRent = await rpc.getMinimumBalanceForRentExemption(BigInt(getMintSize())).send();

// 3. Derive ATA
const [ata] = await findAssociatedTokenPda({
  owner: recipient.address,
  mint: mintKeypair.address,
  tokenProgram: TOKEN_PROGRAM_ADDRESS,
});

const { value: latestBlockhash } = await rpc.getLatestBlockhash().send();

const draft = pipe(
  createTransactionMessage({ version: 1 }),
  m => setTransactionMessageFeePayerSigner(payer, m),
  m => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, m),
  m => appendTransactionMessageInstructions([
    // Create mint account
    getCreateAccountInstruction({
      payer,
      newAccount: mintKeypair,
      lamports: lamports(mintRent),
      space: getMintSize(),
      programAddress: TOKEN_PROGRAM_ADDRESS,
    }),
    // Initialize mint
    getInitializeMintInstruction({
      mint: mintKeypair.address,
      decimals: 9,
      mintAuthority: payer.address,
    }),
    // Create ATA
    getCreateAssociatedTokenInstruction({
      payer,
      ata,
      owner: recipient.address,
      mint: mintKeypair.address,
    }),
    // Mint tokens
    getMintToInstruction({
      mint: mintKeypair.address,
      token: ata,
      mintAuthority: payer,
      amount: 1_000_000_000n,
    }),
  ], m),
  fillTransactionMessageProvisoryResourceLimits,
);

const message = await estimateAndSetResourceLimitsFactory(
  estimateResourceLimitsFactory({ rpc }),
)(draft);

const sendAndConfirm = sendAndConfirmTransactionFactory({ rpc, rpcSubscriptions });
const signed = await signTransactionMessageWithSigners(message);
assertIsTransactionWithBlockhashLifetime(signed);
await sendAndConfirm(signed, { commitment: 'confirmed' });

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning18d5 checks · Risk SAFE
  • Gen Agent Trust Hub19d

    This skill is a legitimate and comprehensive developer resource for Solana blockchain development. It identifies and mitigates common security risks through explicit instructions on handling untrusted on-chain data and enforces transaction safety via user-review guardrails. All external dependencies and tool installations originate from trusted, official Solana ecosystem providers.

  • Socket18d

    No alerts

  • Snyk19d

    Risk: LOW · No issues

  • Runlayer8mo

    3/15 files flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at c9da262. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 3 weeks ago
compatibility
Requires Node.js 20.18+, Rust toolchain, Solana CLI, Anchor CLI
metadata
{
  "author": "Solana Foundation",
  "version": "2.8.0"
}

README badge

README badge for solana-foundation/solana-dev-skill