Solana Keychain (Server-Side Signing)
Solana Foundation skill — mirrored in the Musebook skills hub.
This entry reproduces, verbatim, the keychain.md reference of the
foundation-maintained solana-dev skill (v2.7.0, MIT) from
https://github.com/solana-foundation/solana-dev-skill. It is one of the 16 topic
references the solana-dev router discloses progressively; for the full
skill (router + all references + nested guides), install the upstream
original: npx skills add https://github.com/solana-foundation/solana-dev-skill — also mirrored in this hub as the
solana-dev entry. Maintained by the Solana Foundation; Musebook does
not author or maintain this content. Relative links in the body point
at the upstream skill's file layout and resolve in the full install.
Solana Keychain
Solana Keychain is a Solana Foundation library that gives you one signing interface across key-management backends: AWS KMS, GCP KMS, HashiCorp Vault, Privy, Turnkey, Fireblocks and others. It ships for TypeScript, Rust, Python and Go, at parity. The backend is chosen by config, so you can develop with an in-memory key and switch to a KMS or MPC custodian without rewriting call sites. All four SDKs are audited by OtterSec; the audit covers specific commits, listed in AUDIT_STATUS.md.
Contents
When to use Keychain
Use Keychain for server-side signing: backend services, bots, AI agents with managed wallets, treasury and custodial apps, fee payers (including Kora nodes), and apps provisioning wallets for their users. It keeps raw keypair files off servers.
Keychain checks the signing hop, not the transaction. It does no simulation, content check or policy enforcement. Validate in your app (and simulate before signing, per the skill's guardrails), or use the provider's policy engine.
Packages
| Package |
Version |
Purpose |
solana-keychain (crates.io, PyPI) |
2.0.0 |
Rust crate with one feature per backend; Python package with extras |
@solana/keychain |
2.0.0 |
Umbrella: createKeychainSigner(config) plus all backend factories (createPrivySigner, …) |
@solana/keychain-core |
2.0.0 |
Interfaces, SignerErrorCode, capability guards, signAndSendTransaction |
@solana/keychain-<backend> |
2.0.0 |
One package per backend (-aws-kms, -vault, -turnkey, …). Install only the one you use |
@solana/keychain-kit-plugin |
2.0.0 |
keychainSigner, keychainPayer, keychainIdentity Kit client plugins. Peer @solana/kit >=8.1.0 |
Every TypeScript signer except Crossmint and Fordefi native mode is a Kit TransactionPartialSigner. It signs transaction v1 (Fireblocks useProgramCall: true is the exception: legacy and v0 only).
Kit plugin client (TypeScript)
pnpm add @solana/keychain-kit-plugin @solana/kit @solana/kit-plugin-rpc
import { createClient, lamports } from '@solana/kit';
import { solanaRpc } from '@solana/kit-plugin-rpc';
import { keychainSigner } from '@solana/keychain-kit-plugin';
const rpcUrl = 'https://api.devnet.solana.com';
const client = await createClient()
.use(keychainSigner({
backend: 'aws-kms',
keyId: process.env.KMS_KEY_ID!,
publicKey: process.env.KMS_PUBLIC_KEY!, // base58 address of the KMS key
region: 'us-east-1',
}))
.use(solanaRpc({ rpcUrl, transactionConfig: { version: 1, priorityFeeLamports: lamports(5_000n) } }));
await client.sendTransaction([instruction]);
- The signer plugin is async and must come before the RPC plugin, the same as every Kit signer plugin.
await the final client.
keychainSigner sets payer and identity to the same signer. keychainPayer and keychainIdentity set one role each and can use different backends, e.g. a KMS fee payer with a Turnkey authority.
- Each plugin creates a new signer when it is applied. To share one signer across clients, create it once and install it with the standard signer plugin:
createClient().use(signer(await createKeychainSigner(config))).
- Call
await client.payer.isAvailable() as a health check before relying on a remote backend.
- Config is a tagged union on
backend: memory, vault, aws-kms, gcp-kms, privy, turnkey, fireblocks, cdp, crossmint, dfns, openfort, para, utila, fordefi. The fields for each backend are listed in the TypeScript guide.
Rust, Python, Go
- Rust:
cargo add solana-keychain, with default-features = false plus the backend features you need. Pick exactly one of sdk-v2 (default), sdk-v3 or sdk-v4. Transaction v1 needs sdk-v4. Construct with Signer::from_* (e.g. Signer::from_aws_kms(...)) and reach the capability via as_transaction_signer().
- Python:
pip install "solana-keychain[aws-kms]" (extras for backends that need a provider SDK; memory, vault and para need none). Built on solders; unified factory create_keychain_signer(backend, config).
- Go: per-backend modules under
github.com/solana-foundation/solana-keychain/go/signers/<backend>/v2, built on solana-go v2.
Gotchas
- Crossmint and Fordefi native mode can't be a client
payer or identity. They rewrite or broadcast server-side, and the Kit plugins reject them at compile time and at runtime (SIGNER_CONFIG_ERROR). Create them with createKeychainSigner() instead:
- Crossmint and Fordefi native auto (
chain set, pushMode omitted or 'auto') are sending signers. Send with signAndSendTransactionMessageWithSigners() from @solana/signers.
- Fordefi native manual (
pushMode: 'manual') is a modifying signer. modifyAndSignTransactions() returns a rewritten transaction; broadcast that one yourself, never the one you passed in.
SIGNER_BROADCAST_UNCONFIRMED means the transaction may have landed. Reconcile with the provider before retrying (providerMayHaveAccepted(error) from @solana/keychain-core). Resending the byte-identical transaction is safe. A rebuilt transaction with a new blockhash is a second transfer.
- Not every backend signs messages. Utila and Crossmint have no
signMessages, and CDP signs UTF-8 messages only. Narrow with isSolanaMessageSigner before calling it.
- Swapping backends changes call sites only when the shape changes. Moving to or from Crossmint or Fordefi native mode changes the capability (sending or modifying signer instead of partial signer). Every other swap is config-only.
- Key rotation means a new address. The key is the address, so plan rotation as a migration of authorities and funds.
Production rules
- Separate hot signers (automated, low balance) from cold signers (treasury, MPC or HSM with approvals), and use distinct keys per environment.
- Grant least privilege. AWS KMS needs only
kms:Sign, kms:DescribeKey and kms:GetPublicKey on the specific key. Prefer IAM roles over static credentials.
- Load provider secrets from a secret manager or env vars. Never hard-code or commit them, and never log key material.
- Retry sign-only failures with backoff. Don't blindly retry backends that broadcast (see
SIGNER_BROADCAST_UNCONFIRMED).
- Monitor signing latency and failures, and turn on provider-side audit logs.
- Python and Go cannot zeroize key buffers, so treat process memory as sensitive with the
memory backend. In Rust, never enable the unsafe-debug feature in production.
Full list: production best practices.
Full documentation
Every page is served as Markdown. Fetch the .md URL for details beyond this file.
1---2name: solana-dev-keychain3description: Solana Keychain — one signing interface over KMS, Vault, MPC custody, and managed-wallet backends; Kit 8 plugin client setup, production rules, and links to the full docs.4license: MIT5metadata:6 author: Solana Foundation7 version: "2.7.0"8 source: https://skillmd.com/skills/solizardking/solana-dev-keychain9 upstream: https://github.com/solana-foundation/solana-dev-skill10 category: Skill11---1213# Solana Keychain (Server-Side Signing)1415> **Solana Foundation skill — mirrored in the Musebook skills hub.**16> This entry reproduces, verbatim, the `keychain.md` reference of the17> foundation-maintained **solana-dev** skill (v2.7.0, MIT) from18> https://github.com/solana-foundation/solana-dev-skill. It is one of the 16 topic19> references the solana-dev router discloses progressively; for the full20> skill (router + all references + nested guides), install the upstream21> original: `npx skills add https://github.com/solana-foundation/solana-dev-skill` — also mirrored in this hub as the22> `solana-dev` entry. Maintained by the Solana Foundation; Musebook does23> not author or maintain this content. Relative links in the body point24> at the upstream skill's file layout and resolve in the full install.2526# Solana Keychain2728Solana Keychain is a Solana Foundation library that gives you one signing interface across key-management backends: AWS KMS, GCP KMS, HashiCorp Vault, Privy, Turnkey, Fireblocks and others. It ships for TypeScript, Rust, Python and Go, at parity. The backend is chosen by config, so you can develop with an in-memory key and switch to a KMS or MPC custodian without rewriting call sites. All four SDKs are audited by OtterSec; the audit covers specific commits, listed in [AUDIT_STATUS.md](https://github.com/solana-foundation/solana-keychain/blob/main/audits/AUDIT_STATUS.md).2930## Contents31- [When to use Keychain](#when-to-use-keychain)32- [Packages](#packages)33- [Kit plugin client (TypeScript)](#kit-plugin-client-typescript)34- [Rust, Python, Go](#rust-python-go)35- [Gotchas](#gotchas)36- [Production rules](#production-rules)37- [Full documentation](#full-documentation)3839## When to use Keychain4041Use Keychain for **server-side** signing: backend services, bots, AI agents with managed wallets, treasury and custodial apps, fee payers (including [Kora](kora.md) nodes), and apps provisioning wallets for their users. It keeps raw keypair files off servers.4243Keychain checks the signing hop, not the transaction. It does no simulation, content check or policy enforcement. Validate in your app (and simulate before signing, per the skill's guardrails), or use the provider's policy engine.4445## Packages4647| Package | Version | Purpose |48|---|---|---|49| `solana-keychain` (crates.io, PyPI) | 2.0.0 | Rust crate with one feature per backend; Python package with extras |50| `@solana/keychain` | 2.0.0 | Umbrella: `createKeychainSigner(config)` plus all backend factories (`createPrivySigner`, …) |51| `@solana/keychain-core` | 2.0.0 | Interfaces, `SignerErrorCode`, capability guards, `signAndSendTransaction` |52| `@solana/keychain-<backend>` | 2.0.0 | One package per backend (`-aws-kms`, `-vault`, `-turnkey`, …). Install only the one you use |53| `@solana/keychain-kit-plugin` | 2.0.0 | `keychainSigner`, `keychainPayer`, `keychainIdentity` Kit client plugins. Peer `@solana/kit >=8.1.0` |5455Every TypeScript signer except Crossmint and Fordefi native mode is a Kit `TransactionPartialSigner`. It signs transaction v1 (Fireblocks `useProgramCall: true` is the exception: legacy and v0 only).5657## Kit plugin client (TypeScript)5859```bash60pnpm add @solana/keychain-kit-plugin @solana/kit @solana/kit-plugin-rpc61```6263```ts64import { createClient, lamports } from '@solana/kit';65import { solanaRpc } from '@solana/kit-plugin-rpc';66import { keychainSigner } from '@solana/keychain-kit-plugin';6768const rpcUrl = 'https://api.devnet.solana.com';69const client = await createClient()70 .use(keychainSigner({71 backend: 'aws-kms',72 keyId: process.env.KMS_KEY_ID!,73 publicKey: process.env.KMS_PUBLIC_KEY!, // base58 address of the KMS key74 region: 'us-east-1',75 }))76 .use(solanaRpc({ rpcUrl, transactionConfig: { version: 1, priorityFeeLamports: lamports(5_000n) } }));7778await client.sendTransaction([instruction]);79```8081- The signer plugin is async and must come before the RPC plugin, the same as every Kit signer plugin. `await` the final client.82- `keychainSigner` sets `payer` and `identity` to the same signer. `keychainPayer` and `keychainIdentity` set one role each and can use different backends, e.g. a KMS fee payer with a Turnkey authority.83- Each plugin creates a new signer when it is applied. To share one signer across clients, create it once and install it with the standard signer plugin: `createClient().use(signer(await createKeychainSigner(config)))`.84- Call `await client.payer.isAvailable()` as a health check before relying on a remote backend.85- Config is a tagged union on `backend`: `memory`, `vault`, `aws-kms`, `gcp-kms`, `privy`, `turnkey`, `fireblocks`, `cdp`, `crossmint`, `dfns`, `openfort`, `para`, `utila`, `fordefi`. The fields for each backend are listed in the [TypeScript guide](https://solana.com/docs/tools/keychain/getting-started/typescript.md).8687## Rust, Python, Go8889- **Rust:** `cargo add solana-keychain`, with `default-features = false` plus the backend features you need. Pick exactly one of `sdk-v2` (default), `sdk-v3` or `sdk-v4`. Transaction v1 needs `sdk-v4`. Construct with `Signer::from_*` (e.g. `Signer::from_aws_kms(...)`) and reach the capability via `as_transaction_signer()`.90- **Python:** `pip install "solana-keychain[aws-kms]"` (extras for backends that need a provider SDK; `memory`, `vault` and `para` need none). Built on `solders`; unified factory `create_keychain_signer(backend, config)`.91- **Go:** per-backend modules under `github.com/solana-foundation/solana-keychain/go/signers/<backend>/v2`, built on `solana-go` v2.929394## Gotchas9596- **Crossmint and Fordefi native mode can't be a client `payer` or `identity`.** They rewrite or broadcast server-side, and the Kit plugins reject them at compile time and at runtime (`SIGNER_CONFIG_ERROR`). Create them with `createKeychainSigner()` instead:97 - Crossmint and Fordefi native auto (`chain` set, `pushMode` omitted or `'auto'`) are sending signers. Send with `signAndSendTransactionMessageWithSigners()` from `@solana/signers`.98 - Fordefi native manual (`pushMode: 'manual'`) is a modifying signer. `modifyAndSignTransactions()` returns a rewritten transaction; broadcast that one yourself, never the one you passed in.99- **`SIGNER_BROADCAST_UNCONFIRMED` means the transaction may have landed.** Reconcile with the provider before retrying (`providerMayHaveAccepted(error)` from `@solana/keychain-core`). Resending the byte-identical transaction is safe. A rebuilt transaction with a new blockhash is a second transfer.100- **Not every backend signs messages.** Utila and Crossmint have no `signMessages`, and CDP signs UTF-8 messages only. Narrow with `isSolanaMessageSigner` before calling it.101- **Swapping backends changes call sites only when the shape changes.** Moving to or from Crossmint or Fordefi native mode changes the capability (sending or modifying signer instead of partial signer). Every other swap is config-only.102- **Key rotation means a new address.** The key is the address, so plan rotation as a migration of authorities and funds.103104## Production rules105106- Separate hot signers (automated, low balance) from cold signers (treasury, MPC or HSM with approvals), and use distinct keys per environment.107- Grant least privilege. AWS KMS needs only `kms:Sign`, `kms:DescribeKey` and `kms:GetPublicKey` on the specific key. Prefer IAM roles over static credentials.108- Load provider secrets from a secret manager or env vars. Never hard-code or commit them, and never log key material.109- Retry sign-only failures with backoff. Don't blindly retry backends that broadcast (see `SIGNER_BROADCAST_UNCONFIRMED`).110- Monitor signing latency and failures, and turn on provider-side audit logs.111- Python and Go cannot zeroize key buffers, so treat process memory as sensitive with the `memory` backend. In Rust, never enable the `unsafe-debug` feature in production.112113Full list: [production best practices](https://solana.com/docs/tools/keychain/production-best-practices.md).114115## Full documentation116117Every page is served as Markdown. Fetch the `.md` URL for details beyond this file.118119| Topic | URL |120|---|---|121| Overview | https://solana.com/docs/tools/keychain.md |122| TypeScript (per-backend config, Kit client, capabilities) | https://solana.com/docs/tools/keychain/getting-started/typescript.md |123| Rust | https://solana.com/docs/tools/keychain/getting-started/rust.md |124| Python | https://solana.com/docs/tools/keychain/getting-started/python.md |125| Go | https://solana.com/docs/tools/keychain/getting-started/go.md |126| Choosing a backend | https://solana.com/docs/tools/keychain/choosing-a-backend.md |127| Production best practices | https://solana.com/docs/tools/keychain/production-best-practices.md |128| Signing in production (concepts) | https://solana.com/docs/core/transactions/signing-in-production.md |129| Adding a backend | https://solana.com/docs/tools/keychain/adding-signers.md |130| Source | https://github.com/solana-foundation/solana-keychain |