SOL Vault

Stage 1 of 5

Create the vault

Give every authority one deterministic vault PDA.

~12 min
  1. 01
  2. 02
  3. 03
  4. 04
  5. 05

Your goal

Initialize a vault at the PDA derived from the fixed namespace `vault` and the authority public key.

The contract

  • Use the exact seed formula: [b\"vault\", authority.key().as_ref()].
  • Store the authority, bump, and a zero tracked balance.
  • Only the authority pays for initialization.

Build it

Finish the `initialize` instruction and its account constraints. Keep the starter program ID unchanged.

Then build

$ anchor build
Common mistakes
  • Using a random keypair account instead of the PDA.
  • Leaving the bump or authority unset.
  • Changing the declared program ID.
    Create the vault · SOL Vault | learn.sol