Brevity: Interpreted EVM Scripting Language

Brevity is a Solidity-like scripting language that transpiles to call-data and runs on a general-purpose on-chain interpreter contract. It enables composable, atomic multi-step DeFi workflows in a single transaction without deploying new smart contracts. (→ [[ethdenver]])

Core Idea

Where Solidity programs are stored in the code area, Brevity scripts live in call data. This distinction has three consequences:

  • No deployment required: new logic runs without a new contract, saving ~10× the gas (4–16 gas/byte call data vs. 200 gas/word code storage).
  • One-shot atomic execution: the entire script succeeds or reverts as a unit.
  • AI-friendly: Claude Code can read the Brevity README and write compilable scripts; the simplicity of the language makes it a strong candidate for agent-driven DeFi.

Language Primitives

  • Single variable type: a 32-byte word (mirrors EVM internal representation — everything is a word anyway).
  • Function selectors: define once (approve(address,uint256)), call by symbol thereafter.
  • Control flow: if/else, goto (enabling loops), arithmetic operators matching Solidity.
  • Call types: CALL (state-changing), STATICCALL (view-only).
  • Preprocessor constants: symbol substitution, not stored in compiled output.
  • Brevity never modifies storage directly — all persistent effects happen through the calls it makes.

The Brevity Robot Pattern

A personal Brevity interpreter is a minimal clone-able contract (~100k gas to deploy; a few cents on mainnet). It:

  • Holds the user’s tokens
  • Executes scripts on command
  • Allows the owner to withdraw assets at will
  • Supports meta-transactions so the owner doesn’t need ETH to pay gas (only USDC needed)

Key Features

Flash Loans Made Trivial

Traditional flash loans require a callback with bytes and a complex coding pattern. In Brevity:

#flash_loan 1 USDC
// ... do something
// return coins

A directive at the top of the script wraps the entire program in the callback.

Sandboxing & Guardrails

A hook fires at every outbound call. This allows:

  • Restricting calls to a whitelist of registered protocols (useful for brokerages offering DeFi to customers)
  • Metering inflows/outflows (enabling revenue sharing)
  • Policy enforcement not possible in freehand Solidity

Metatransactions

EIP-2771-style metatransactions allow a third party to pay gas on behalf of the interpreter owner. Additionally, Brevity scripts can be sent cross-bridge and execute on the other side as the owner.

Gas Savings

Running a one-off arbitrage in Brevity costs ~50% less gas than deploying a dedicated Solidity contract and running it.

Example: 5-Step Uniswap Position in One TX

A script that:

  1. Takes 10% of ETH balance
  2. Wraps to WETH
  3. Swaps half for USDC
  4. Approves both tokens to Uniswap V3
  5. Mints a liquidity position — and reverts if the LP token is not received

…is ~10 lines of Brevity. Each step would otherwise require a separate transaction.

Comparison to Multicall

FeatureMulticallBrevity
VariablesNoYes
MathNoYes
Flow controlNoYes (if/goto)
SandboxingNoYes
MetatransactionsNoYes
Flash loansComplex1 directive

Target Use Cases

  • Consumer DeFi: abstract multi-step workflows behind a GUI; users click, Brevity handles atomicity
  • AI finance: Claude Code and other LLMs write Brevity scripts to hunt arbitrage or rebalance portfolios
  • Brokerage middleware: offer DeFi to customers with guardrails, compliance-friendly call whitelists, and metered revenue capture
  • Ethereum devs: pack maximum logic into callbacks (bridges, flash loans, arbitrage)

Connections

Open Questions

  • Can the Brevity interpreter be formally verified, or does the interpreter contract itself become a critical security surface?
  • Will the GUI tooling reach sufficient polish for non-developer users?
  • How does Brevity interact with account abstraction (EIP-4337/7702) — could it replace session keys for some use cases?