API reference

Instructions, the Step shape, and the plan wire format.

The full instruction and type surface exposed by the client. Program id on devnet:

A2kR2uTGLYfCqimqF4piRDh7aHfLRDf4gBg8LvmfMLrz

Instructions

The program exposes two instructions. Both use the Anchor global namespace discriminator. The account order below is the exact order the client builds in ptbvm.ts; writability is marked w.

InstructionAccounts (in order)Data
init_registersregisters PDA (w), payer (signer, w), system programdisc("global", "init_registers") (8 bytes, no args)
executeregisters PDA (w), authority PDA (w), payer (signer, w), then every pooled account in intern order (each w if any step needs it writable)disc("global", "execute") + the serialized plan (see the wire format below)
init_registers is idempotent and runs once per owner; execute runs a whole plan as one atomic transaction.

Discriminators

Both instructions use an 8-byte discriminator derived from the Anchor namespace: the first 8 bytes of sha256("global:<name>"). The client exposes disc("global", name) to build them, and u64le(n) to encode a little-endian u64 argument.

Plan wire format

compile() serializes the plan after the execute discriminator as:

u32   stepCount
repeat per step:
  u16   programIndex
  u32   accountCount
  repeat per account:
    u8    source        // 0 Pool, 1 Register, 2 Authority
    u16   index
    u8    isSigner
    u8    isWritable
  u32   dataLen
  bytes data
  u32   spliceCount
  repeat per splice:
    u16   offset
    u8    register
    u8    width
  u8    captureInto?    // 0 = none, else 1 + slot
  u8    capturePubkey
  u8    signed
  u8    obligation      // 0 None, 1 Open, 2 Close
  u64   obligationTag

Account sources

FieldTypeNote
Pool (0)fixed pubkeyA concrete account, interned into the account pool by index.
Register (1)captured pubkeyAn account whose pubkey a prior step captured into a register.
Authority (2)authority PDAThe plan's authority PDA, used when a step is signed.

In this section

  • Error reference: Every failure mode and what triggers it.
  • Limits: The achievable subset: what pipes, what does not, and why.