Skip to content
Concepts

Clone

Pull any program and its account graph from a live RPC into the local SVM sandbox. Cache forever, hydrate in milliseconds.

What gets cloned

  • The program Program binary, exactly as deployed on mainnet.
  • The Anchor IDL if one is registered on-chain.
  • Account data, lamports, owner, rent_epoch, and executable flag for every requested address.
  • Transitive closure: PDAs, ATAs, lookup tables, oracle accounts you mark for follow.

How to clone

terminal
# program by pubkey
pnpm cli program add <programId> --project <pid>

# account / PDA, grouped under a program for organization
pnpm cli account add <pubkey> --project <pid> \
  --program <programId> --label "pool A"

# bulk import from JSON
pnpm cli account bulk-add accounts.json --project <pid>

Cache layout

Blobs are stored under <projectRoot>/.relay/ as content-addressed files. Programs, accounts, IDLs each get their own directory. The catalog index lives in store.json.

layout
.relay/
  programs/<programId>.so
  accounts/<pubkey>.bin
  idls/<programId>.json
  keypairs/<label>.json
  store.json

Snapshot slot

Each clone is tagged with the RPC slot at the moment of fetch. Replay uses this to pin hydration to a specific historical point. Re-clone when you want fresher state.

caveat
Public mainnet RPC retains account state for roughly two epochs. For any meaningful replay or historical clone, use an archive endpoint.