Allow invoking ephemeral contracts #1456
Replies: 2 comments 3 replies
|
I agree with what @dmkozh said in the thread:
And yes, I think that developers should be able to orchestrate a set of invocations atomically in a simple way without having to upload contracts and think about lifetimes at all. (Changing the title a bit to match the requirement) |
|
Reviving this with numbers, since the thread stalled before it had any. Uploading Wasm on mainnet today, at protocol 27:
~3.5 XLM is the floor for any contract, however trivial, and ~99.9% of it is rent on the instantiated module's in-memory size. The cleanest demonstration is a pair of real transactions from 2026-07-16: the same 28,784-byte Wasm uploaded twice, 29 minutes apart, For contrast, carrying those same bytes through a transaction and discarding them costs about 0.036 XLM in bandwidth and history, and no transaction can spend more than 0.028 XLM on CPU at any size. Why I think this is worth doing, and not just a fee complaint. The floor doesn't make one-shot logic expensive, it makes it categorically absent. Every contract on Stellar today has to be a business — something reused enough to amortize permanent residency in every validator's memory. So we have never seen what Stellar looks like with contracts that are closer to a sentence than a building: a single escrow written for one deal between two parties, settlement logic that exists for one afternoon, a hand-rolled atomic sequence that isn't worth productizing. That isn't a class of thing people tried and abandoned; it's a class of thing nobody has ever been able to try. The 3.5 XLM floor is a tax on experimentation, and it lands hardest on exactly the uses we'd learn the most from. The agent case sharpens it. Agents composing on-chain actions will generate novel, situation-specific logic constantly, and first-time bytecode can never amortize — every composition pays full freight for 120 days of residency it will use for one ledger. "Deploy a permanent contract first" is not a step that survives in that loop. One distinction I'd draw that the original thread didn't. There are two goals here and they may want different answers:
I care about (B). If (A) gets solved separately I'd still want (B). On mechanism, @dmkozh's suggestion in this thread still looks like the right one to me — Wasm in the transaction, a reserved export that fires at execution time the way Temporary |
Uh oh!
There was an error while loading. Please reload this page.
Original discussion on Discord
As far as I’m aware contract code and contract instances must be persistent entries. Would it be possible to allow for these to be temporary entries? I’ve already noticed a few occasions where I’m deploying and invoking an ephemeral contract. Either for a test I really want to execute on mainnet or more legitimately there’s a function I want to run once or at least really infrequently such that redeploying a new contract or wasm later on would be acceptable.
Idk if others feel the same or have additional use cases but here are a few that come to my mind:
Temporary entries are significantly cheaper than persistent and being able to leverage that for code and contracts I think would incentivize more experimentation and exploration of use cases we've never seen on chain before due to it's typical permanence and subsequent high costs.
All reactions