Keypair and sign directly. In
production the important question is different: where does the private key
live, and who is allowed to authorize a signature with it?
Never embed private keys in client-side code, bundle them into a frontend, or
commit them to source control. Anyone who obtains a key gains full control of
that account’s funds.
Signing approaches
| Approach | Where the key lives | Who signs | Best for |
|---|---|---|---|
| Local keypair | A file or environment variable on the machine | Your code, directly | Local development, tests, CI |
| Browser wallet | The end user’s wallet (e.g. Phantom, Solflare) | The end user, per transaction | Frontend dApps where users sign their own transactions |
| Cloud KMS / HSM | A hardware-backed key service (AWS KMS, GCP KMS, Vault) | Your backend requests a signature from the service | Backend services, treasury operations, regulated environments |
| Managed / MPC wallets | Split or custodied across a provider’s infrastructure | The provider co-signs according to your policy | Embedded wallets, approval workflows, institutional custody |
Backend signing
When a server needs to sign (paying fees, sending program transactions, or operating a treasury), use a dedicated key-management backend rather than a raw keypair. The Solana Foundation maintains Keychain, a unified signing library (Rust, TypeScript, Python, and Go) that exposes oneSolanaSigner interface across every backend in the table above: Memory,
HashiCorp Vault, AWS KMS, GCP KMS, Fireblocks, Privy, Turnkey, CDP, Crossmint,
Dfns, Para, Openfort, Utila, and Fordefi.
Because the interface is shared across backends, you can develop locally with an
in-memory key and switch to a production backend through configuration, without
rewriting application code (backends that broadcast for you, such as Crossmint,
are called through a sign-and-send path instead). Keychain is compatible with
@solana/kit, the
Rust SDK, solders (Python) and solana-go v2
(Go).
Keychain
Unified signing across local keys, KMS, HSM, and managed wallet backends.
Choosing a backend
Compare custody models and pick the right signing backend for your app.