Skip to main content

Introduction

Counterfactual creation derives a wallet address from its owner before the wallet is activated on-chain.
  • Use when: you need a deposit address before asking a payer to create the wallet.
  • For: onboarding flows and apps that activate wallets only when they are needed.

How it works

  1. Create a reservation from the program ID, owner public key, and account index or salt.
  2. Derive the config and wallet addresses locally; this requires no RPC or signature.
  3. Build an activation instruction from the same reservation.
  4. Have a funded payer sign and submit activation. The committed owner becomes role 0 with All permission.
  5. After confirmation, fetch the config and use the wallet normally.

Reservation fields

The same reservation derives the same addresses across SDK languages. Confirm that the target deployment supports reserved creation before funding an address.

Flow

SDK example

Reserve and prepare activation

Use the packages from Overview. The Rust example also needs solana-sdk@4 and solana-compute-budget-interface@3 for compatible instruction types.
  • configAddress is for fetching roles; walletAddress is for SOL deposits and token-account ownership.
  • Send the returned instructions with the payer using Sending transactions.
  • The compute limit accommodates P-256 owners. The payer pays account funding and fees; only the payer signs activation.

Restore a saved reservation

Save the reservation bytes together with a trusted wallet address. Check that restoring them still produces that address before requesting activation.
Save reservation.toBytes() and walletAddress.toBase58() from the example above.

After activation

  • SOL deposited before activation remains in the wallet.
  • Repeating activation does not reset an already active wallet’s roles or permissions.
  • Keep the original reservation after owner rotation; current roles determine who can act.
  • A closed wallet cannot be recreated from its reservation.
  • Reserved wallets use V2 subaccounts. Use Rust’s V2 APIs for that flow; Classic’s legacy V1 helpers are incompatible.