> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Production best practices

> Operate Keychain signing backends safely in production, covering separation of duties, key rotation, least-privilege access, availability, transport security, monitoring, and audit.

Keychain abstracts the signing backend, but operating a signer in production
remains the operator's responsibility. These practices apply across backends;
see [Choosing a backend](/developers/docs/tools/keychain/choosing-a-backend) for
selecting one.

## Separate hot and cold signers

Use a low-balance operational ("hot") signer for frequent, automated
transactions, and a separate high-value ("cold") signer for treasury movements.
Back the cold signer with MPC custody or a cloud HSM and require approval
policies before it signs. Because the interface is identical, each role can use
a different backend without changing call sites.

## Rotate keys deliberately

For a keypair account, the address is the public key, so rotating the key
produces a new address. Plan rotation as a migration: provision a new key, reassign the
relevant authorities (or move funds) to the new address, then retire the old
one. Use distinct keys per environment so devnet keys are never reused on
mainnet.

## Grant least-privilege access

Scope each backend's credentials to the minimum needed to sign. For AWS KMS,
that is `kms:Sign`, `kms:DescribeKey`, and `kms:GetPublicKey` on the specific key
(the availability check uses the last two); prefer IAM roles over static
credentials. Apply the same principle to Vault policies and managed wallet API
keys.

## Plan for availability

Remote backends depend on a network service. Check availability before relying
on a signer (`isAvailable()` in TypeScript, `is_available()` in Rust and
Python, and `IsAvailable(ctx)` in Go), retry sign-only failures with backoff,
and define a fallback path for outages. Do not blindly retry a broadcasting
backend (Crossmint, Fordefi native auto mode): see
[Handle unconfirmed broadcasts](#handle-unconfirmed-broadcasts).

## Handle unconfirmed broadcasts

Crossmint and Fordefi native auto mode sign and broadcast server-side, so a
failed call does not mean nothing landed. When the provider may have accepted
the transaction, Keychain reports `BROADCAST_UNCONFIRMED`
(`SignerError::BroadcastUnconfirmed` in Rust). The error carries the provider
transaction id when the create was accepted, and always carries the idempotency
key the create went out under, derived from the message.

- Reconcile with the provider using the transaction id before doing anything
  else.
- Resending the byte-identical transaction is safe: the idempotency key
  deduplicates it.
- Rebuilding the transaction (a new blockhash, for example) produces a new key
  and therefore a new transfer.

## Protect secrets and transport

- Remote backends enforce HTTPS on configured base URLs, reject redirects, and
  apply a default request timeout. Vault is no exception: every language rejects
  a plain-HTTP address by default, including a loopback `vault server -dev`. For
  local development, run `vault server -dev-tls` and trust the CA certificate it
  prints as `VAULT_CACERT`. Only Rust and Go can opt in to plain HTTP:
  - Rust: build the signer with `VaultSigner::with_client_builder`. It keeps the
    no-redirect policy and leaves TLS to the builder you pass.
  - Go: set `HTTPClient` in `vault.Config`. A client you supply skips the HTTPS
    and redirect checks, so refuse redirects in its `CheckRedirect`.
  - TypeScript and Python have no plain-HTTP option. Use `vault server -dev-tls`.
- Supply API keys, tokens, and credentials from a secret manager or environment
  variables. Never hard-code them or commit them to source control.
- Keychain sanitizes error responses to avoid leaking secrets into logs; keep
  your own logging free of raw credentials and key material.

## Monitor and audit signing

Track signing success rate, latency, and failure counts, and alert on spikes.
See the metrics in
[Production readiness](/developers/docs/tools/security#monitoring).
Enable provider-side audit logs (KMS, Vault, or custodian) and reconcile them
against the transactions your application submits.

## Know what Keychain checks

- Keychain validates the signing hop, not your transaction: there is no
  simulation, no transaction-content check, and no policy engine. Enforce those
  in your application or in the provider's policy controls.
- Fordefi native manual mode rewrites the transaction (blockhash, Compute Budget
  fee instructions) before signing it. Continue from the transaction it returns,
  never the one you submitted, and run it before any other signer.
- Rust zeroizes intermediate key buffers; Python and Go cannot. With the Memory
  backend in those languages, treat the whole process memory as sensitive.
- With Ledger, the device screen is the only trustworthy description of what is
  being signed. Do not enable the `unsafe-debug` feature or `TRACE` logging for
  `solana_remote_wallet` in production, since both log device and transaction
  detail.

See the
[security model](https://github.com/solana-foundation/solana-keychain/blob/main/docs/SECURITY_MODEL.md)
for the full picture.
