Cointime

Download App
iOS & Android

Bundle Compression

Contract accounts aren’t just better, they’re also cheaper.

Background…

The future of Ethereum is contract accounts on rollups.

Together, contract accounts (also known as “account abstraction”) and rollups represent a fundamental upgrade & enable real-world use of the chain:

  • Fast, cheap transactions.
  • Secure accounts built on best-practice cryptography.
  • Better recovery, including easy-to-use passkey backups. No seed phrase.

EOAs and L1 are settlement infrastructure. The future is 4337 on L2. The problem, so far, was that 4337 on L2 was expensive.

Making 4337-on-L2 efficient

The main cost on L2 is calldata. 4337 can use a lot of that. For example, see Ansgar’s breakdown of what Vitalik later called the “infamous 1600-byte transfer”: a 4337 bundle containing a single Daimo USDC transfer.

We fix this using bundle compression.

The BundleBulker contract is simple and permissionless. Any bundler can register their own IInflator to compress bundles however they want. A good default is the PerOpInflator, which concatenates individually compressed ops. Each bundler (Pimlico, ThirdWeb, Alchemy, etc) can deploy their own PerOpInflator instance, with the beneficiary (op fee recipient) set accordingly. PerOpInflator is similarly permissionless: any app can register their own IOpInflator with arbitrary, app-specific userop compression.

For an example, check out DaimoOpInflator. What it is doing, specifically?

  • Packing. The Solidity ABI encoding was designed for L1, where computation is expensive, not for L2, where computation is effectively free and calldata is expensive. A single boolean argument takes 32 bytes… structs are encoded in a luxuriously expansive way.
  • Templating. Parts of the op that don’t change are templated in. In our case, callGasLimit, verificationGasLimit, and the WebAuthn (passkey) JSON envelope.
  • Stateful compression. We replace the 40 byte (from address, to address) with a ~10 byte (from name, to name) using our existing onchain name registry. We could further optimize by using an index instead of a name.

The important thing is that this setup is permissionless. Any app can write their own inflator and start using it.

Results

Results so far, using a simple ERC20 token transfer as our benchmark.

Bytes per transferJust the op1-op bundle10-op bundle
EOA transaction · example179179179
Naive 4337 · example140816231429
Bundle compression · example127343149

Below: a 4337 bundle containing a single USDC transfer, before and after compression. In both cases, I’ve highlighted the op. The rest is the bundle fixed overhead.

The highlighted op is smaller than an EOA ERC-20 transfer.

Each bundle will contain many of these, amortizing the fixed overhead & making contract wallets more efficient than legacy wallets.

Questions

  • What about rollup compression?

Bundle compression is complementary to rollup compression. Both are useful.

Rollups compress calldata before settling to L1, but this is limited on its own. Stateful compression is hard to achieve. Bundle compression is at the app layer and lets you do application-specific templating and stateful lookups.

Together, this lets us approach the goal state of very compact transactions.

  • Why use 4337 at all, if we’re calling into another contract that sits in front of the EntryPoint?

Three reasons.

  • Standard ops. Userop explorer, ops identified by ophash, everything inter-”op”-erable. If you use bespoke AA, you get no observability or devtools. Note that a userop explorer will show the uncompressed op, —it’ll just have a lower preVerificationGas = lower cost.
  • Censorship resistance. Bundler down or not serving you? Your wallet can send the uncompressed op to the standard 4337 mempool, paying a few cents more fee for guaranteed inclusion.
  • Security. Stick with the battle-tested EntryPoint contract. See below.
  • What if there’s a vulnerability in my inflator?

The inflator contract is, unavoidably, not beautiful to look at. You’re writing a byte-packed encoding, plus templating and lookups.

The great news is that the inflator contract has no security responsibilities. This is because your wallet still signs over the uncompressed op. The EntryPoint contract and your 4337 wallet’s validateUserOp function work exactly as before. If there’s any issue in the inflator contract, it can only cause liveness problems (reverted, invalid ops), not security errors. It’s neatly compartmentalized as an optional optimization.

In fact, this separation of responsibilities makes your wallet more secure. The gross bit-packing goes in one place—the security-critical validation logic goes in another, which can written in entirely idiomatic Solidity.

  • Doesn’t state diff fix this?

State diffs are an elegant theoretical optimization for zkrollups: just prove that you have a block of valid transactions resulting in a given diff. The transactions themselves, and their calldata, are not posted! For a transfer, the diff is just (-10 for alice, +10 for bob). No compression needed.

We’re unlikely to see this in a production, real, stage2 rollup. A state-diff-only permissionless rollup is a scary construct. It raises the spectre of undiagnosable hacks, both of the rollup itself and applications on top. Say a block shows up that drains a defi protocol. You might never learn what the bug was! The transaction was never published, only the final state diff (minus $500m for contract 0x…, plus $500m for bob) and a proof that some valid set of transactions produced this diff. Similarly for proving-system bugs.

TLDR; production rollups will post calldata for the forseeable future.

Comments

All Comments

Recommended for you

  • UBS Group increased its stake in Strategy by 3.23 million shares, bringing its total holdings to 5.76 million shares.

     according to CoinDesk, that Switzerland's largest bank UBS Group increased its holdings by 3.23 million shares in the Bitcoin reserve company Strategy, bringing its total holdings in Strategy to 5.76 million shares (valued at $805 million).

  • Wintermute: This bear market may end faster than previous ones, and the market will most likely recover in the second half of the year.

    Wintermute posted on X stating that it is clear we are already in a bear market, and in fact, it has lasted for some time—especially judging by the performance of altcoins, the extreme concentration of rebounds, and market sentiment on X. However, what makes this bear market different is that it was not triggered by structural collapses like FTX, Luna, or 3AC, but rather driven by macroeconomic conditions and cyclical trend changes, representing a relatively natural deleveraging process, with the core driving forces being changes in positions, risk appetite, and market narratives.

  • BTC breaks through $79,000

    the market shows BTC breaking through $79,000, currently at $79,014.62, with a 24-hour increase of 3.04%. The market is highly volatile, please manage your risk accordingly.

  • The US spot Bitcoin ETF saw a net inflow of $562.62 million yesterday.

    according to Trader T monitoring, the US spot Bitcoin ETF had a net inflow of $562.62 million yesterday.

  • ETH falls below $2,300

     the market shows that ETH has fallen below $2300, currently at $2299.76, with a 24-hour increase of 1.65%. The market is highly volatile, please manage your risks accordingly.

  • BTC breaks through $79,000

    market shows BTC breaking through $79,000, currently at $79,010, with a 24-hour increase of 2.66%. The market is highly volatile, please manage your risk accordingly.

  • The Chicago Board Options Exchange plans to relaunch binary options in order to enter the prediction market.

    Chicago Board Options Exchange (Cboe) is in early discussions with retail brokers and market makers to relaunch binary options contracts, aiming to compete in the rapidly growing prediction markets. Kalshi and Polymarket reached a trading volume of $17 billion in January, setting a monthly record high. Cboe had launched the product in 2008 but subsequently withdrew it, and is now seeking to reposition the product as a starting point for retail investors entering the options market through compliant design. The plan will be regulated by the SEC or CFTC.

  • BTC falls below $75,000

     the market shows BTC falling below 75,000 USD, currently at 74,991 USD, a 24-hour decline of 4.9%, with significant market fluctuations, please manage your risk accordingly.

  • BTC falls below $75,000

     the market shows BTC falling below $75,000, currently at $74,968.02, a 24-hour decline of 4.83%. The market is highly volatile, please manage your risk accordingly.

  • BTC falls below $77,000

    the market shows BTC falling below $77,000, currently at $76,980.12, a 24-hour decline of 2.28%. The market is highly volatile, please manage your risk accordingly.