What are PDAs?
PDAs are addresses that:- Are derived deterministically from seeds and a program ID
- Do not have a corresponding private key
- Can only be signed by the program that derived them
- Are guaranteed to not lie on the ed25519 curve
Finding PDAs
To find a PDA, usePubkey::find_program_address:
bump is a value (0-255) that ensures the address doesn’t lie on the curve.
Using PDAs in Anchor
Anchor simplifies PDA usage with theseeds and bump constraints:
Initializing PDAs
- Derives the PDA address
- Finds the bump seed
- Validates the derived address matches the provided account
Accessing PDAs
init constraint.
Storing the bump
Store the bump seed in your account to avoid recalculating it:Signing with PDAs
Programs can sign CPIs using PDA seeds:PDA use cases
1. Deterministic account addresses
Create predictable addresses for user-specific accounts:2. Program authority
Use PDAs as authorities for tokens or other accounts:3. Account relationships
Enforce relationships between accounts:Multiple seeds
You can use multiple seeds for more specific PDAs:Complete example
Best practices
PDAs cannot sign transactions - they can only sign CPIs within a program.
Next steps
Cross-program invocations
Learn how to use PDAs with CPIs
SPL integrations
Use PDAs with token accounts