vol. iv · issue 06
The Driver's Seata quarterly by satyajeet sindhiyani
18 may 2026 · bengaluru
← writing/zk-fhe·Apr 2, 2026

1–5 MB of WASM, only when someone connects a wallet.

dynamic import for cofhe-sdk/web. static for the chain definitions. don't ship a megabyte to readers who'll never sign a tx. quiet packaging win.
tl;drdynamic import for cofhe-sdk/web. static for the chain definitions. don't ship a megabyte to readers who'll never sign a tx. quiet packaging win.

dynamic import for cofhe-sdk/web. static for the chain definitions. don't ship a megabyte to readers who'll never sign a tx. quiet packaging win.

The cofhe-sdk/web entrypoint includes WASM binaries for the FHE operations. On load, these weigh somewhere between 1 and 5 MB depending on what gets pulled in. That's a meaningful chunk to add to initial page load, and most visitors to AlphaEngine are reading about the protocol — they're not connecting wallets on the first visit.

The solution is a two-entrypoint split:

  • @alphaengine/sdk/web — the full entrypoint with WASM, loaded dynamically only on wallet connect
  • @alphaengine/sdk/chains — chain definitions, token lists, static config, loaded statically at build time
// Static — always needed
import { CHAINS, TOKENS } from "@alphaengine/sdk/chains";

// Dynamic — only when wallet is connected
const { cofhe } = await import("@alphaengine/sdk/web");

The chain definitions need to be available immediately for things like displaying APY, strategy lists, and protocol stats. The FHE operations only matter once someone is actually trying to interact with a strategy.

This is a quiet packaging win because nothing about the user experience changes — the app still works — but the 1-5 MB never touches users who don't need it. In a content-first page with an optional web3 layer, that's the right trade.

written with sonnet 4.6view source session →