Keypairs & Signers
Signers abstract who can sign transactions and messages in @solana/kit.
Search across all documentation pages
Signers abstract who can sign transactions and messages in @solana/kit.
Quick-reference recipe card - copy-paste ready.
import { generateKeyPairSigner, createKeyPairSignerFromBytes } from "@solana/kit";
const dev = await generateKeyPairSigner();
// or load solana-keygen JSON bytesWhen to reach for this:
import {
generateKeyPairSigner,
createTransactionMessage,
setTransactionMessageFeePayerSigner,
setTransactionMessageLifetimeUsingBlockhash,
appendTransactionMessageInstruction,
signTransactionMessageWithSigners,
createSolanaRpc,
} from "@solana/kit";
import { getTransferSolInstruction } from "@solana-program/system";
const rpc = createSolanaRpc("https://api.devnet.solana.com");
const payer = await generateKeyPairSigner();
const recipient = await generateKeyPairSigner();
const { value: bh } = await rpc.getLatestBlockhash().send();
let msg = createTransactionMessage({ version: 0 });
msg = setTransactionMessageFeePayerSigner(payer, msg);
msg = setTransactionMessageLifetimeUsingBlockhash(bh, msg);
msg = appendTransactionMessageInstruction(
getTransferSolInstruction({ source: payer, destination: recipient.address, amount: 1_000n }),
msg
);
const signed = await signTransactionMessageWithSigners(msg);What this demonstrates:
Signer, not a raw public key string.signTransactionMessageWithSigners resolves signers embedded in the message.Address (base58 public key).KeyPairSigner holds secret material for Node scripts.TransactionSendingSigner without revealing secrets.CryptoKey import paths exist for Web Crypto integrations.| Type | Secret exposed | Typical source |
|---|---|---|
| Key pair | Yes (server) | JSON keypair file |
| Wallet | No | Phantom, Solflare |
| No-op | N/A | Placeholder in partial builds |
// Never log or serialize secret key bytes
const { address } = await generateKeyPairSigner();setTransactionMessageFeePayerSigner.| Alternative | Use When | Don't Use When |
|---|---|---|
| Wallet Standard signers | Browser dApps | Headless CI scripts |
| Hardware wallet | High-value keys | Rapid local iteration |
| KMS/HSM service | Production servers | Local dev only |
Yes - point RPC and wallet at the same cluster.
Avoid in one module - migrate wholesale per route.
Wallets provide signers; kit builds messages.
Lock 7.0.0 in package.json and CI.
Compute budget instructions before send.
Surfpool 0.12.0 or local validator with devnet clones.
Always bigint lamports in kit code.
confirmed for UI; finalized for treasury.
Reads on server; signing in client components.
Simulate, read logs, verify account owners.
Stack versions: This page was written for Agave 4.1.1, Solana CLI 3.0.10, Anchor 0.32.1, anchor-lang 0.32.1, Rust 1.91.1, @solana/kit 7.0.0, Surfpool 0.12.0, and LiteSVM 0.6.x.
Reviewed by Chris St. John·Last updated Jul 16, 2026