eez:on
Run a block of commands on another EEZ chain synchronously from the current one. Every call the block produces goes out through the target's cross-chain proxy and executes on the other side atomically with this transaction; helpers, conditions and loops inside evaluate on that chain. Creates each missing proxy first and estimates the gas the composed calls need.
⚗️ Experimental — available at next.evmcrispr.com.
Smart blocks: cannot be nested. Cross-chain execution changes account and chain; it cannot run inside a single-account smart batch.
Syntax
Section titled “Syntax”eez:on <chain> <block>Arguments
Section titled “Arguments”| Name | Type | Evaluation | Description |
|---|---|---|---|
chain | chain | Build time | EEZ chain the block runs on (chiadoX, or its chain id) |
block | block | Build time | Commands whose calls execute on that chain (exec, if, loop, other modules' commands) |
Examples
Section titled “Examples”# From L1, set a value on a rollup contract in one atomic transactionswitch gnosisChiadoeez:on chiadoX ( exec 0x000000000000000000000000000000000000bEEF setValue(uint256) 42)How it works
Section titled “How it works”An EEZ rollup and its L1 share one sequencer, so a call can cross between them inside a single transaction. On the sending chain every remote contract has a deterministic cross-chain proxy; calling the proxy with ordinary calldata runs the call on the other side, and the return value (or revert) comes back in the same transaction.
eez:on interprets its block as if the script had switched to the target chain, then brings every call it produced back home as a call through that target's proxy:
- Everything inside evaluates on the target chain:
execencodes against contracts there,@token,@balanceand::reads resolve there, and so do the conditions ofifandloop. Other modules' commands work too, as long as they produce plain contract calls. @senderinside the block is the caller's own cross-chain proxy on the target chain, which is what contracts there see asmsg.sender.@mestays the connected wallet.- Each distinct target gets its proxy created with a preceding transaction if nobody has yet; the calls follow, one sending-chain transaction each. To make several of them atomic, run the command through a Safe,
safe:execute $safe ( eez:on chiadoX ( … ) ): one transaction, several cross-chain entries, from the Safe's proxy over there. A wallet batch,batch ( eez:on … ), cannot carry the fee each cross-chain call pays for its settlement, and is refused. Abatchinside the block is refused: it would only describe the sending wallet, which the block is not about. - Gas comes from the composer's quote when the transaction is sent: it composes the call, every hop included (the sending chain itself cannot estimate a cross-chain call). Each remote leg is also simulated on the other chain when the block is built, as the other chain will see it (from your proxy there): a leg that would revert stops the script before anything is sent, with the reason — a failed assertion by its message — and that simulation plus the protocol overhead is the gas limit used when no quote comes back. A leg that crosses chains again (a call to a proxy over there) cannot be simulated and gets a fixed budget. Pass
--gason the inner command to set the limit yourself;--valueand--fromon the inner command pass through as well. - Each call is priced by the chain's composer just before it is signed: a cross-chain call pays for its settlement through its priority fee, about 0.0005 xDAI on ChiadoX and 0.00015 ETH on RollupX; a quote above 0.01 xDAI or 0.003 ETH is not used. A far leg that would revert once composed cannot be priced, and the composer refuses the transaction before anything is mined: the error gives the composer's own reason, from its gas estimate, or says it could not price the call just then and to try again. The pre-flight above catches what can be simulated and names the reason; a revert deeper than one hop only shows up this way.
- Blocks nest:
eez:on chiadoX ( eez:on gnosisChiado ( … ) )goes L1 → L2 → L1 and comes back in the same transaction, through the proxy of a proxy. The inner block's calls are routed on the rollup first, then routed again from the sending chain; a proxy the inner block needs on the rollup is created first by a plain transaction there (the wallet switches to the rollup and back), since a cross-chain call cannot create one. Inside a Safe's block, where the wallet cannot switch, it must exist already: the error names theeez:deploy-proxyto run. Each extra hop adds the sending chain's overhead to the fallback estimate. The devnet composes at least six hops. - Not allowed inside the block:
switchand contract deployments. - A cross-chain transaction composes only when it reaches the chain's EEZ composer (its gateway): EVMcrispr routes it there when it submits the transaction itself, while a browser wallet broadcasts through its own RPC for the chain, so that RPC must be the composer: the
chiadoXandrollupXnetworks it adds from EVMcrispr already do; for Chiado and mainnet addhttps://chiadox.eez.dev/composer/l1orhttps://rollupx.eez.dev/composer/l1as the chain's RPC. Ordinary transactions go through either. - A receipt on the sending chain means the cross-chain effect was applied atomically; the rollup's state reflects it a few seconds later.
- A contract on the current chain whose code calls a proxy needs no special command: a plain
execreaches across the same way.
See Also
Section titled “See Also”- eez:deploy-proxy — create the proxy explicitly
- @eez:proxy — resolve the proxy address without calling
- @eez:on — read the other chain from the script