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:
- Takes 10% of ETH balance
- Wraps to WETH
- Swaps half for USDC
- Approves both tokens to Uniswap V3
- 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
| Feature | Multicall | Brevity |
|---|---|---|
| Variables | No | Yes |
| Math | No | Yes |
| Flow control | No | Yes (if/goto) |
| Sandboxing | No | Yes |
| Metatransactions | No | Yes |
| Flash loans | Complex | 1 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
- On-Chain Agents — Brevity is a natural execution environment for AI agents doing DeFi; scripts are small enough to generate programmatically
- DeFi Institutional Transition — Guardrail/sandbox mode fits compliance requirements for institutional DeFi access
- Smart Contract Security (2026 State) — Sandboxing and call hooks provide security properties missing from freehand Solidity
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?