Skip to docs content
Getting Started/Quickstart

Getting Started

Quickstart

Point layoutd at two versions of an account, run diff, read the verdict.

The 60-second path

layoutd compares two versions of a single account. You give it the old and new account definitions (Anchor IDL JSON), name the account, and read the verdict.

  • Step 1. Export the account’s IDL for each version to v1.json and v2.json (see IDL / JSON Input).
  • Step 2. Run diff against both files, selecting the account by name.
  • Step 3. Read the per-field verdict and the summary line.
terminal
layoutd diff v1.json v2.json --account UserState

See it live

The interactive terminal below runs the real UserState example — a bool field inserted in the middle of the struct. Switch between the diff, check, and gen tabs to see each command’s output for the same change.

This is the on-screen example

V1 is { authority, balance, bump }; V2 inserts is_active at index 1. Because the insert shifts every following offset, layoutd classifies it as DANGER — old accounts would be misread without a migration.

Live output

See every finding, live.

V1 · UserState

#[account]
pub struct UserState {
pub authority: Pubkey, // 0
pub balance: u64, // 32
pub bump: u8, // 40
}

V2 · UserState

#[account]
pub struct UserState {
pub authority: Pubkey, // 0
+ pub is_active: bool, // 32
pub balance: u64, // 33
pub bump: u8, // 41
}
running…layoutd v0.1 · borsh · deterministic

What the verdict means

Each field is labelled SAFE, REVIEW, or DANGER. To turn this into a CI gate, run layoutd check — it exits non-zero on unacknowledged danger. To generate the migration scaffold, run layoutd gen.