Skip to content

​In short

A wallet holds a key pair: a public address that anyone can pay, and a private key that signs approvals and never leaves the device.

​Addresses and private keys

A keypair has two halves:
  • The public key is the wallet’s address. It is 32 bytes, written as a base58 string of 32 to 44 characters, for example DxQ6RYwhfmX66AQCf3B8aL4P9EivuXnf8HQBkFZwZZFJ. You can share it freely: people pay it, and anyone can look up the accountsAccountsEverything on Solana (balances, tokens, programs, app data) lives in accounts: records at an address, each with an owner that is allowed to change it.Learn more (Accounts: Everything on Solana (balances, tokens, programs, app data) lives in accounts: records at an address, each with an owner that is allowed to change it.) it owns.
  • The private key proves ownership. Whoever holds it can sign for the address, so it never leaves the wallet app, key file, or key management system that stores it.
Solana uses the Ed25519 signature scheme. The Solana CLI stores a keypair as a JSON file containing a 64-byte array: the 32-byte secret followed by the 32-byte public key. Not every address has a private key. Program-derived addressesProgram-derived addressesA PDA is an address derived from a program plus some seeds. It has no private key, so only that program can sign for it, which makes it handy for storing app state at predictable addresses.Learn more (Program-derived addresses: A PDA is an address derived from a program plus some seeds. It has no private key, so only that program can sign for it, which makes it handy for storing app state at predictable addresses.) are derived from a program and some seeds, and only that program can sign for them.

​Create a keypair

Creating a keypair is local and free: no network call. An account appears at the address only once it’s funded with SOL.
Kit
Example output: each run generates a new key pair
Output

​Signatures

Every transaction is signed by the wallets it spends from. The first signature doubles as the transaction’s ID, which is what your code gets back and looks up later. A transaction lists the accounts that must approve it. The network checks every signature before it runs any instruction, and rejects the transaction if one is missing or invalid. The first signer is the fee payer, which doesn’t have to be your customer: with fee sponsorshipFee sponsorshipBy default, the transaction's fee payer needs a little SOL to pay its fee. A fee-payer service such as Kora lets your app pay instead, so customers only ever hold dollars.Learn more (Fee sponsorship: By default, the transaction’s fee payer needs a little SOL to pay its fee. A fee-payer service such as Kora lets your app pay instead, so customers only ever hold dollars.), your app signs as fee payer and covers the fee. A signature is 64 bytes, usually shown as base58.

​Sign and verify a message

Wallets can also sign bytes that aren’t a transaction, for example to prove a user controls an address at sign-in. Anyone with the address can verify it.
Kit
Example output
Output

​Wallets in apps and on servers

  • In the browser, users keep their keys in a wallet app. Your app asks the wallet to sign and never sees the private key. See React & Next.js.
  • On a server, your code signs with its own keypair, for example to pay fees for users or to send payouts. Load it from a secret store, or sign through a KMS or HSM with Keychain. See signing in production.
  • Never put a private key in browser code, in a repository, or in logs.

​Recipes