in-solana by Supanode

What Is PDA in Solana?

A Program Derived Address (PDA) is an address deterministically derived from a program ID and a set of seeds. Unlike regular addresses, PDAs have no corresponding private key — only the program that derived them can sign for them.

How PDAs work

PDAs are generated using findProgramAddress(seeds, programId), which hashes the seeds with the program ID and finds a point that does not lie on the Ed25519 curve. This guarantees no private key exists for the address.

import { getProgramDerivedAddress, getUtf8Encoder } from "@solana/kit";

const [pda, bump] = await getProgramDerivedAddress({
  programAddress: programId,
  seeds: [getUtf8Encoder().encode("user-data"), userPubkey.toBytes()],
});

The bump is a single byte (0-255) added to the seeds to find an off-curve point.

Why PDAs exist

  1. Deterministic addresses. Given the same seeds and program ID, the PDA is always the same. This lets clients compute account addresses without querying the network.
  2. Program-controlled signing. Only the owning program can sign transactions for a PDA, enabling secure on-chain logic without private key management.
  3. Data storage. PDAs are commonly used to store program state: user profiles, configuration, pool data.

Common patterns

PatternSeeds
User-specific data["user", user_pubkey]
Token vault["vault", mint_pubkey]
Global config["config"]
Order book entry["order", market_pubkey, order_id]

Updated: