Security

Key Management

  • Never expose private keys in frontend code. Use backend signing, hardware wallets, multisignature wallets, or key management services.
  • Separate hot and cold wallets. Hot wallet for operations, cold for treasury.
  • Backup all production keys. Store encrypted backups in multiple secure locations. Losing a key means losing access permanently.
  • Use different keys for devnet and mainnet. Your devnet keys shouldn't be your mainnet keys. Use environment-based configuration to ensure the right keys load for each network.

Signing Infrastructure

For production backend signing, use Keychain—a unified signing library that abstracts multiple key management backends through a single interface: Memory, Vault, Privy, Turnkey, AWS KMS, Fireblocks, GCP KMS, CDP, Para, Dfns, Crossmint, Openfort, and Utila. This lets you develop locally with in-memory keys, then swap to production-grade backends without changing application code.

Not sure which backend fits? See Choosing a backend. Keychain is available for both Rust and TypeScript.

RPC Security

Treat RPC endpoints like API keys—don't expose them in frontend code where they can be extracted and abused. Use a backend proxy or environment variables that aren't bundled into client code.

Monitoring

Track these metrics in production:

MetricWhy
Transaction success rateDetect issues early
Confirmation latencyMonitor network health
Priority fee spendCost management
RPC error rateProvider health

Set up alerts for:

  • Transfers above threshold from treasury
  • Failed transaction rate spikes
  • Unusual recipient patterns
  • RPC error rate increases

For real-time transaction monitoring at scale, see our Indexing Guide.

Verify Addresses

Every token and program has exactly one correct address on mainnet. Spoofed tokens mimicking USDC or other stablecoins are common—they'll have the same name and symbol but a different mint. Your application should hardcode or allowlist the mint addresses (based on your requirements), never accept them dynamically from untrusted sources.

Environment-based configuration: Devnet and Mainnet often use completely different token mints. Set up your application config to load the correct addresses per environment—don't hardcode mainnet addresses and forget to swap them during testing, or worse, ship devnet addresses to production.

Some common stablecoin mints are:

TokenIssuerMint Address
USDCCircleEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
USDTTetherEs9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
PYUSDPayPal2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo
USDGPaxos2u1tszSeqZ3qBWF3uNGPFc8TzMk2tdiwknnRMWGWjGWH

Program addresses matter too. Sending instructions to the wrong program will fail—or worse, result in irreversible loss of funds. The Token Program addresses are:

ProgramAddress
Token ProgramTokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
Token-2022 ProgramTokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb

Allowlisting the right addresses protects against spoofed tokens, but it does not protect against sending to the wrong kind of account. A recipient address can be a wallet, a token account, a mint, or a program, and each requires different handling. Native SOL sent to anything other than a wallet leaves the sender's control — lost outright for a mint or program, recoverable only by the account owner for a token account — with no failed transaction to warn the user.

Validate recipients before sending

Classify every recipient address before signing a transfer. See Verify Address for the full decision tree and reference code that distinguishes wallets, token accounts, mints, and programs.

Is this page helpful?

Sisällysluettelo

Muokkaa sivua
© 2026 Solana Foundation. Kaikki oikeudet pidätetään.