Program Derived Addresses (PDAs)
A Program Derived Address is an account on Solana mathematically guaranteed to have no private key. It is owned and controlled strictly by the smart contract.
How Solana Derives PDAs
Solana creates a PDA by hashing user seeds and the program ID with a search for a canonical bump (a number from 255 down to 0) that pushes the address off the Ed25519 elliptic curve. Because the point lies off the curve, no corresponding private key exists. Only the smart contract can sign on behalf of this account via CPI seeds.
Seed Derivations in PointPass
1. Loyalty Program PDA
One loyalty program per merchant wallet. Guarantees that each merchant has isolated state and mint authority.
seeds = [b"loyalty", merchant.key().as_ref()]
2. Points Mint PDA
The SPL Token Mint account whose mint authority is the LoyaltyProgram PDA itself.
seeds = [b"mint", loyalty_program.key().as_ref()]
3. Redemption Receipt PDA
Created upon burning points. Uses an incremental redemption_count index seed to prevent replay and enforce ordering.
seeds = [ b"redemption", loyalty_program.key().as_ref(), customer.key().as_ref(), receipt_number.to_le_bytes().as_ref() ]