Compiler Infrastructure for Solana

Write Anchor.
Ship Pinocchio or Native.

Anvil parses Anchor into a typed IR and emits idiomatic Pinocchio or Native Rust — with a byte-equal gate that checks the output against the Anchor reference under LiteSVM, so you know when a port is deploy-safe.

Open Workbench
Differential-tested. AI patches gated by byte-equal.
Anchor
IR
Pinocchio
+ NATIVE
79%
Avg CU vs Anchor
0
Byte divergences
6
Real-world programs
How it works

Five stages from Anchor source to verified emit.

01
Provide Anchor

Paste raw source, select a GitHub repo, or upload local files. No refactoring required.

#[account]
pub struct Counter {
    pub authority: Pubkey,
    pub count: u64,
}
02
Generate IR

Tree-sitter AST parser extracts accounts, constraints, and logic into a typed SolanaIR.

kind:    state
field:   count: u64
field:   authority: Pubkey
seeds:   [b"counter", auth]
size:    8 + 32 + 8
03
Target Emit

Transpile the IR into idiomatic Pinocchio or Native Rust with full multi-file support.

pub fn process(
    accounts: &[AccountInfo],
    data: &[u8],
) -> ProgramResult {
    ...
}
04
Differential Gate

Anchor reference and Anvil emit run the same scenario in LiteSVM. Account bytes and lamport ledgers must match exactly.

anchor1f 00 00 00 00 …
anvil1f 00 00 00 00 …
match✓ identical
05
CU Analysis

Cost tables map original Anchor operations to low-level syscalls.

anchor12,400 CU
anvil4,200 CU
savings−66%
Verified against

Byte-equal across 6 real-world programs.

Each program runs the identical scenario in LiteSVM under both the Anchor reference binary and the Anvil emit. Account bytes and lamport ledgers must match exactly — divergence fails the build.

ANCHOR REFERENCE
account[0]: 1f 00 00 00 …
account[1]: a3 5e 0c b9 …
lamports: 2,039,280
logs: 3 entries
COMPARE
ANVIL EMIT
account[0]: 1f 00 00 00 …
account[1]: a3 5e 0c b9 …
lamports: 2,039,280
logs: 3 entries
6
Real-world programs
0
Byte divergences
11
Demos byte-equal
36/36
program-examples cargo green
ESCROW Match
anchor-escrow-2025/make_offer

Escrow PDA + token vault init

account byteslamports
EVENTS Match
coral-events

emit! event log byte-equal

account byteslamports
ACCOUNTS Match
favorites

Account init + #[max_len] strings

account byteslamports
STATE Match
account-data

Multi-field state writes

account byteslamports
PDA Match
pda-rent-payer

PDA-as-payer create_account

account byteslamports
COUNTER Match
page-visits

Counter increment + clock read

account byteslamports
Compiler playground

Select a program, pick a target, compile.

All 4 demo programs are live. For full power — paste source, upload a file or folder, or point Anvil at a GitHub repo — use the Workbench.

Program
Target Framework
1
Load fixture
GET /demo/:name
2
Parse IR
Anchor → SolanaIR
3
Emit code
IR → Rust
4
Complete
Code ready
Click “Compile” to generate Pinocchio code
Compute unit analysis

Counter — savings per instruction

ESTIMATEDheuristic — see scripts/measure-cu.ts for measured numbers
INSTRUCTION
ANCHOR
PINOCCHIO
NATIVE
initialize
79% saved
75% saved
520 CU
108 CU
130 CU
increment
79% saved
74% saved
290 CU
62 CU
75 CU
decrement
79% saved
74% saved
290 CU
62 CU
75 CU
reset
79% saved
74% saved
265 CU
55 CU
68 CU
TOTAL
1365
CU total
287
CU total
79% saved
348
CU total
75% saved
Status

What's shipped vs what's next.

Working today
Verifiable, deterministic, in the repo.
Shipped
Verification
  • 6 real-world programsbyte-equal against Anchor under LiteSVM
  • 11 demo programsbyte-equal end-to-end via auto-scenario
  • 36/36 program-examplescargo green on both Pinocchio + Native
  • AI patches gatedby byte-equal — divergent fixes auto-rejected
Compiler & tooling
  • Anchor 0.29–1.0 parserToken-2022 (25 ext), InterfaceAccount runtime dispatch, zero_copy, literal discriminator override
  • Multi-file outputlib.rs, state.rs, instructions/, helpers
  • GitHub ingestionpaste any public repo URL and compile
  • AI refinementSonnet 4.6 — cost-capped, validation-error gated
Coming up
Next quarter, in priority order.
Coming up
  • 01Devnet deploy verificationlive transaction round-trip on real validators
  • 02Token-2022 end-to-end emissionextension-aware account layout + CPIs
  • 03Corpus expansionSquads, Streamflow, Phoenix byte-equal
  • 04IDE plugininline CU previews on Anchor source
  • 05Automated regression sweep50+ real-world repos on every commit
Driven by user feedbackOpen issues