solana-dev-keychain
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.
- License 许可
- MIT
- 最近更新
- 2026-11-02
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- solana-dev-keychain
- license
- MIT
- metadata
- { "author": "Solana Foundation", "source": "https://github.com/solana-foundation/solana-dev-skill", "version": "2.7.0", "category": "Skill" }
- description
- 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.
02 资源文件 2
- 参考文档metadata.json369 B
- 参考文档verification.json1.0 KB
03 SKILL.md 正文
Solana Keychain (Server-Side Signing)
Solana Foundation skill — mirrored in the Musebook skills hub. This entry reproduces, verbatim, the
keychain.mdreference 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 thesolana-deventry. 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
- Packages
- Kit plugin client (TypeScript)
- Rust, Python, Go
- Gotchas
- Production rules
- Full documentation
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.
awaitthe final client. keychainSignersetspayerandidentityto the same signer.keychainPayerandkeychainIdentityset 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, withdefault-features = falseplus the backend features you need. Pick exactly one ofsdk-v2(default),sdk-v3orsdk-v4. Transaction v1 needssdk-v4. Construct withSigner::from_*(e.g.Signer::from_aws_kms(...)) and reach the capability viaas_transaction_signer(). - Python:
pip install "solana-keychain[aws-kms]"(extras for backends that need a provider SDK;memory,vaultandparaneed none). Built onsolders; unified factorycreate_keychain_signer(backend, config). - Go: per-backend modules under
github.com/solana-foundation/solana-keychain/go/signers/<backend>/v2, built onsolana-gov2.
Gotchas
- Crossmint and Fordefi native mode can't be a client
payeroridentity. They rewrite or broadcast server-side, and the Kit plugins reject them at compile time and at runtime (SIGNER_CONFIG_ERROR). Create them withcreateKeychainSigner()instead:- Crossmint and Fordefi native auto (
chainset,pushModeomitted or'auto') are sending signers. Send withsignAndSendTransactionMessageWithSigners()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.
- Crossmint and Fordefi native auto (
SIGNER_BROADCAST_UNCONFIRMEDmeans 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 withisSolanaMessageSignerbefore 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:DescribeKeyandkms:GetPublicKeyon 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
memorybackend. In Rust, never enable theunsafe-debugfeature in production.
Full list: production best practices.
Full documentation
Every page is served as Markdown. Fetch the .md URL for details beyond this file.
| Topic | URL |
|---|---|
| Overview | https://solana.com/docs/tools/keychain.md |
| TypeScript (per-backend config, Kit client, capabilities) | https://solana.com/docs/tools/keychain/getting-started/typescript.md |
| Rust | https://solana.com/docs/tools/keychain/getting-started/rust.md |
| Python | https://solana.com/docs/tools/keychain/getting-started/python.md |
| Go | https://solana.com/docs/tools/keychain/getting-started/go.md |
| Choosing a backend | https://solana.com/docs/tools/keychain/choosing-a-backend.md |
| Production best practices | https://solana.com/docs/tools/keychain/production-best-practices.md |
| Signing in production (concepts) | https://solana.com/docs/core/transactions/signing-in-production.md |
| Adding a backend | https://solana.com/docs/tools/keychain/adding-signers.md |
| Source | https://github.com/solana-foundation/solana-keychain |
04 同仓库更多 Skills
youtube-clipper
YouTube 视频智能剪辑工具。下载视频和字幕,AI 分析生成精细章节(几分钟级别), 用户选择片段后自动剪辑、翻译字幕为中英双语、烧录字幕到视频,并生成总结文案。 使用场景:当用户需要剪辑 YouTube 视频、生成短视频片段、制作双语字幕版本时。 关键词:视频剪辑、YouTube、字幕翻译、双语字幕、视频下载、clip video
viem-integration
Integrate EVM blockchains using viem. Use when user says "read blockchain data", "send transaction", "interact with smart contract", "connect to Ethereum", "use viem", "use wagmi", "wallet integration", "viem setup", or mentions blockchain/EVM development with TypeScript.
v4-security-foundations
Security-first Uniswap v4 hook development. Use when user mentions "v4 hooks", "hook security", "PoolManager", "beforeSwap", "afterSwap", or asks about V4 hook best practices, vulnerabilities, or audit requirements.
v4-sdk-integration
App-layer SDK guide for building swap and liquidity experiences directly with the Uniswap v4 SDK. Use when user asks about "v4 sdk", "uniswap v4", "v4 swap", "v4 liquidity", "PoolManager", "V4Planner", "StateView", "PositionManager", "pool state", "v4 position", "uniswap sdk", or when building swap/liquidity UX directly with SDKs rather than via the Trading API.
v4-hook-generator
Generate Uniswap v4 hook contracts via OpenZeppelin MCP. Use when building custom swap logic, async swaps, hook-owned liquidity, custom curves, dynamic fees, MEV protection, limit orders, or oracle hooks.
testing
For testing with Light Protocol programs and clients on localnet, devnet, and mainnet validation.