EIP-7833 · Stagnant · Core · 2024-12-06
EIP-7833: Scheduled function calls
Proposes an OFFERCALL opcode so a contract can schedule its own function for the next block by burning an ETH offer, with block producers required to run the top offers before user transactions.
What problem does it solve?
Smart contracts never run by themselves. Something outside the chain must send a transaction: a keeper bot, an oracle updater, a liquidation bot. That brings problems:
- Timing. Network delays or congestion can make the trigger arrive late, and for things like liquidations or rebalancing, late can mean losses.
- MEV. Block producers decide ordering, so they can delay, front-run or sandwich the very transaction that would correct a market.
- Infrastructure. Every protocol needs off-chain bots, which add cost and centralization.
EIP-7833 proposes letting contracts schedule calls inside the protocol, so a function can act like an on-chain bot.
How it works
- A new opcode,
OFFERCALL, lets a contract offer an amount of ETH in exchange for having a given function called in the next block. - Nodes collect all offers, sort them by amount, and keep only the top N. The others are discarded.
- Executing the kept scheduled calls becomes a block validity rule: they run before any user transactions, in ranked order.
- The offered ETH is burned, not paid to the producer, so a producer cannot schedule calls that just pay itself back.
OFFERCALLfails if the contract does not hold enough ETH or the offer is not high enough to make the top N.
A function that calls OFFERCALL on itself each time it runs keeps running every block. If one offer fails, the loop stops and the bot is "dead" until someone calls it manually again, presumably with a higher offer.
Sample code
The spec's own example, written in hypothetical Solidity syntax (no compiler supports offercall):
contract Bot {
uint256 offerPerCall;
constructor(uint256 _offer) {
offerPerCall = _offer;
offercall(update, offerPerCall); // ignite: schedule first run for next block
}
function setOffer(uint256 _offer) external {
offerPerCall = _offer;
}
function update() external {
// ... do the scheduled work (rebalance, liquidate, update price) ...
// reschedule itself for the following block; if this fails, the bot stops
offercall(update, offerPerCall);
}
}
Things to know
- Status is Stagnant. The proposal is brief: the opcode number, gas cost, the value of N, how arguments are passed, what
msg.sendera scheduled call sees, and what happens if a scheduled call reverts are all unspecified, and there is no reference implementation. - Mandatory execution at the start of every block is a significant consensus change. It also eats into block space before any user transaction, and running scheduled calls continuously costs ETH every block.
- The authors flag centralization risk: wealthy contracts could dominate the top-N slots.
- The example has no access control on
setOffer; a real contract would restrict it. - Today the same need is met off-chain by keeper networks and searchers. Forced-inclusion ideas such as inclusion lists (EIP-7547) attack the censorship side of the problem differently.