CHAINWRIGHTPROGRAM STUDIO

INSIDE CHAINWRIGHT / SOURCE TO EXECUTION

Build it.
Test the rules.

Write code for Solana or Ethereum-style chains, try the rules without a wallet, and keep a project you can reopen.

Try a working game example.

Open the compact player-stats example. Run it to save a player’s stats, check the saved values, and reject a caller who lacks permission. Compare its gas use with the same rules stored in a wider record.

Make the first run.

  1. Open the studio. Choose Solana or EVM, then pick Authority counter.
  2. Select a component to inspect the signer, program, state and runtime.
  3. For Solana, choose Compile TypeScript for fresh C/IDL or Build & run SBF for a fresh native artifact and Agave scenarios. For EVM, choose Build & run EVM to compile and execute your contract on a fresh Anvil chain. Solidity bytecode and TypeScript C/IDL compile in your browser. Both Build & run actions send your source to an isolated runner; no wallet is needed.
  4. Inspect the successful change, the rejected caller and the overflow. A failed check is a result to investigate, not something the studio hides.
  5. Export the project, change the source, then reopen the original. The packet preserves its source, target and result summary.
Run the counter ↗

Build native Solana programs.

Open the counter, directed escrow or rent-backed vault, edit the TypeScript and choose Build & run SBF. The TypeScript compiler and LLVM link your exact source into a downloadable SBF v0 program. Agave 2.3.13 runs fresh scenarios with synthetic accounts, returning logs, account output and compute units. Inspect generated C and Anchor-compatible IDL alongside the artifact. Download the typed TypeScript client and original build manifest. C/IDL-only compilation remains in your browser.

Use the file selector to edit the entry and up to eleven flat TypeScript modules. Import a supplied module with ./name or ./name.ts. Set a public program address for the build, or leave it empty for an automatic synthetic address. The native runner accepts one operation at a time. Build allowances and time limits keep it responsive; if it is busy, your source stays available. Neither lane requires a wallet.

What compilation produces.

Solana: the Solana compiler accepts a restricted TypeScript language, generates C and an Anchor-compatible IDL, then invokes the retained LLVM toolchain to build native SBF v0. The source and compiler versions stay attached to the artifact.

EVM: Solidity 0.8.30 compiles a single contract for the Paris EVM target, with the optimizer enabled at 200 runs. Inspect its ABI, storage layout, creation bytecode, runtime opcodes and compiler gas estimates.

Each workspace supports one fixed entry file and up to eleven supplied modules, with at most 60,000 source characters in total. Solana uses flat .ts modules and EVM uses flat .sol modules alongside Program.sol. EVM needs exactly one deployable contract in its entry file. External imports, filesystem paths and externally linked libraries are refused. Compiler diagnostics name the issue. You can compile and inspect a changed interface; the Scenario Lab accepts custom calls shaped by your compiled interface. Null selects the example checks. Use Generate from interface after a native build to edit a complete plan.

What runs, exactly.

Native Solana scenarios start an isolated Agave 2.3.13 runtime with your compiled SBF program and fresh synthetic accounts. Each scenario runs through simulateTransaction from the same genesis. Its account output, logs, errors and compute use come from that runtime. The runner has no external network access. No visitor wallet is used.

EVM scenarios launch Anvil1.8.6 on a fresh isolated chain. The constructor executes before ABI-driven calls run sequentially against the deployed contract. Add constructor: {args: […], value: "0"} to a custom scenario for ABI-typed deployment arguments, including tuples, strings, bytes and payable synthetic value. A reverted constructor stops the suite. Inspect return values, reverted calls, storage assertions, transaction receipts and measured gas. Immutable fields are patched by the constructor; the result lists the compiler-declared ranges and compares every other runtime byte exactly. Native Solana and EVM jobs have no external network access.

All actors and value in these runs are synthetic. No visitor wallet or live-chain transaction is used. The browser instruction interpreter remains available in the source package; server execution uses the full Anvil EVM.

Use Stop to cancel the current compiler or runtime operation. Changing any source file, program setting or scenario invalidates its previous live build and result. Your source remains available.

Give a pool its own logic.

The Dynamic LP fee hook example implements Uniswap v4’s beforeSwap callback. It returns a 0.30% LP fee below 1,000,000 raw input units, and 0.80% at or above that threshold. Raw units are not a dollar value: token decimals and asset identity matter.

Only the configured PoolManager may call it. The pool key must name this hook and use the exact dynamic-fee flag 0x800000. Its return value combines the fee with the override flag 0x400000, and returns zero hook currency delta. This example supports exact-input requests; exact-output requests are refused.

v4 encodes callback permissions in the hook address. This constructor requires its low 14 bits to equal 0x0080, meaning beforeSwap only. The EVM runner mines a bounded CREATE2 salt, executes the original hook constructor at a permission-valid address, and checks a second constructor attempt at an invalid address. The callback uses a synthetic PoolManager caller. Full PoolManager swaps and liquidity lifecycle integration remain separate work.

The studio checks both fee branches, caller access, the pool flag, hook identity, exact-output refusal and address permissions. It does not execute an entire pool swap or establish liquidity, routing or profitability. The measured comparison reports the effect of making its fixed manager immutable, including the bytecode trade-off.

Inspect the v4 hook ↗

Read efficiency correctly.

Open the measured before-and-after comparisons for EVM authority checks, hook deployment and native Solana compute, with exact source, scenarios and recorded receipts.

Solana compute units are returned by the actual SBF simulation. A whole-scenario total can include account initialization and calls to other programs. Read the per-instruction log before comparing it with a standalone instruction benchmark.

EVM compiler gas estimates are Solidity’s static estimates. “Infinite” means the compiler cannot supply a finite estimate for that path. Measured EVM gas comes from Anvil transaction receipts. The total includes synthetic deployment and test calls, including getters sent as transactions; it is separate from the compiler estimate and does not measure mainnet costs.

Artifact size measures bytes. It is useful for comparing builds, but it is not a safety or execution-speed score. Meaningful comparisons hold source behavior, checks, runtime and inputs constant.

Compare equivalent behavior, runtime settings and inputs. The studio connects inspection, dual-lane execution, traces and portable projects so you can evaluate the result yourself.

Keep an original.

The version3 project packet contains every exact source file, public program setting, target, example, custom scenario and compact result record. Version1 and version2 packets migrate explicitly. Every build and execution is bound to the full workspace fingerprint; execution also binds the canonical scenario fingerprint. SHA-256 fingerprints identify the content; they do not prove that an imported result came from a trusted runtime.

Opening a malformed or mismatched packet preserves your current work. An imported result is displayed as a saved record. Compile and run the retained source again to produce a fresh result.

Source autosave stays in this browser. Native working files are removed when an operation closes; build results remain available for up to an hour. Export projects and results to keep them, and download native artifacts separately. Reopening a project preserves its source and saved summaries; it does not resume a server job.

Carry the interface with the program.

Typed clients expose instruction or ABI encoders, return types and account interfaces. The Solana client uses @solana/kit; the EVM client uses viem2.56.0. Install dependencies in your own project to use a downloaded client; downloading does not grant signing or deployment authority.

Import an Anchor0.30+ IDL to download a TypeScript source skeleton. Its function bodies are intentionally left for you to implement. Compare binary accepts a local file and checks it against the current artifact; it does not fetch or attest a deployed program. Solana permits trailing zero padding, matching the native artifact comparison rules.

Beyond the compiler.

We will build a typed cross-chain program graph, reproducible execution twins, an agent-driven adversarial test lab and a release rail that carries build and execution evidence. We will explore intent-native programs with explicit cost and permission limits. These are future roadmap capabilities.

Explore the roadmap ↗

Built with inspectable foundations.

The instrument geometry, site design, account-inspection interface, EVM instruction sandbox, scenario adapters and project workflow are original Chainwright work.