Async L1 State Transitions (research update)

Infra for Reversible Txs, Virtual L2s, Crosschain Multiblock Flashloans, et al

TLDR: Blockchains = SINGLE slot atomicity. We intend to make it MULTI.
Consequences? Reversible Txs, multiblock flashloans, higher tx throughput on L1 aka L1 Scalability (solved w/ offchain hi-compute with fully trustless L1 rollbacks if offchain does fraud, across as many blocks needed to check for frauds), L1 enshrined L2s.


Sharing a quick update on one of our deep R&D streams at Smart Transactions. So we have been working on async contracts that are multiblock. Because by default the block/slot serves as the window/limit for async state transition. The moment you extend that to more than the current block, one could argue, in many ways, the essence of a slot/block gets questioned. What is even a slot/block if atomicity could be decoupled from block production mechanics/politics? // So we are introducing a new primitive: Time Capsules or TimeCap in short. // This is to be the new atomicity window. Before you open a TimeCap, you the user/dApp has to declare the closing condition for the TimeCap, such that it must be haltable under any circumstances. The closing condition could be as simple as num-of-slots or some condition as price level from an Oracle or more complex condition as long as it is a haltable one.

(In case you are wondering, TimeCap[s] have some interesting parallels to Rust’s async paradigm, around the concept of Future)

Once that closing conditions come through, either the TimeCap gets a full rollback on errors/hacks, or it finalizes on the chain. Please remember, all of these transitional state changes that are multiblock are of course all on L1.

But of course even before the closing condition comes through, TimeCap will be reverted if in any of the state transition, there’s error or hack detected. This is regular atomicity behavior. So for a 10 slot duration TimeCap, if in the 6th slot, something bad happens, abort immediately and rollback all of it.

One TimeCap is structured as a DAG of transactions such that all of their side-effects can be are strictly are contained within those transactions in the DAG. The DAG does not have, and will not, in almost all cases, all of the transactions of a block, but just the ones to be side-effected. Here’s the kicker, the side-effect need to be considered not just for the current block (which is the case now), but across multiple blocks. So even if a transaction is not being side-effecting or getting side-effected in a particular slot, once it has been, it will remain in the DAG. Will remain for the entire duration of the TimeCap.

Transactions, or more properly speaking, intents, can explicitly make references to other intents, just like a hypertext, intents can link to other intents. We map it in our Hyper Intent Markup Language, HIML.

Why markup? Because it forces the intent specifying from dApps and users to be declarative (as constraints on desired outcomes) and not procedural (as step-by-step instructions). So the intents come with the state they want to transition to eventually rather than how they want to get there. That *how*, finding it out, is the job of Searching (MEV-style search paths for exec, symb exec of intents, fuzz values to see which stick, we even call it ‘MEV Mining’).

Our solvers MEV mine the incoming intents to discover the implicit links (Solana like) between Intents and draws them out in the construction of the DAG: which intents need which others as references to exec, with the before-after relations in terms of ordering. These dependencies between intents could be multi-block, and that is the real innovation here: how to construct the DAG for intents that reference values from later slots? You can think of it as Lazy Eval of intents.

Why markup? Because it forces the intent specifying from dApps and users to be declarative (as constraints on desired outcomes) and not procedural (as step-by-step instructions).

Mind you, all of this has been solved or is solvable for a single slot duration, look at Flash Loans for example. The whole challenge is extending it to multiple blocks (and multiple chains thereafter; imagine a crosschain multi slot atomicity — the kind of apps and services we can built, all trustless but with 100% rollback guarantee).

Fundamental problems driving us mad:

  1. L2 sans L2 / L2 but on L1 / Virtual L2: Transitional State Changes but all of it always and only on L1. Not L2 or any other sandbox, how to sandbox on L1 coz we can not use L2s as the whole point was extending the base atomicity. We can cal it a Virtual Sandbox or even a Virtual L2 (is this what folks call Enshrined L2? I don’t think so).
  2. Reverts w/o revertor: Reverts must be possible but without any centralized actor, The Revertor. We are inventing Trustless Reverts.
  3. Side-effects Prevention: side-effects should be declared to all other transactions/contracts who are not part of the DAG that defines the TimeCap, so anyone outside a TimeCap does not depend on a state transition foolishly, too much risk for them unless of course they want to (as part of their strategy) to take that risk, maybe they can mitigate it, or maybe just they can digest the loss if there be, its their problem essentially. So every transaction in a TimeCap should be clearly markable as Side-effectable, or put it in risk terms, all state transitions inside a TimeCap are Transitional (being inside some kind of a virtual sandbox) till the moment the TimeCap collapses.
  4. Inclusion order ≠ Exec order: Txs sent in a certain vs. how they should be executed is based on their dependencies with each other. If a before tx references value from a later tx, then the later gets eval’ed first — could even be that the before-after spread is across multiple blocks (actually, within the same block is already solvable coz of the default single slot atomicity of blockchains). We are using MEV to resolve tx exec ordering.
  5. Finalizing Already-Settled States: The whole point of a TimeCap becomes moot if someone can just exit their funds from the TimeCap BEFORE the closing of the TimeCap. Coz only on closing, is the decision taken to revert or not. Locks locks locks, could be a escrow style lock, where the TimeCap itself is one of the actors that always needs a signature for any fund to be released. In some ways, how funds need to be bridged to a L2, we do have the locking funds in a TimeCap, but locks where state transition is allowed for as long as none of the transition leads to release of funds or send funds to an exchange. There is always the risk of OTC under the table deals, even changing of hands (privKey trade with cold hard cash), nothing can be done onchain to prevent that, no illusions about that.
  6. Lazy Eval for State transition whose inputs are not available (such as for intents that refer to future intents as reference values passed from a later slot to a previous one). Wake up state intents to be evaluated only (as/when) enough of the referenced values are available to do so. To be as lazy as possible, eval till the last moment is the logic behind the TimeCap being the very final frontier with which all intents must have to be evaluated, else force a rollback.
  7. All References Resolvable Within a TimeCap: Basically, time flows back and forth, in a non-linear way, inside a TimeCap (just as the case for flash loans within a single block, we intend to extend flash loans to multiblock and crosschain in a trustless way tho). But all such references of later-before reference values passing ought to be resolvable within the TimeCap they are part of, strictly no leaks of references. The DAG should strictly enforce this.
  8. State Reset w/o Reverts: When rollbacks, the original account balances must be preserved. But only for all the transitions inside the DAG of the TimeCap. Its as if the side-effect was used to side-effect all of the state back to zero, where the TimeCap started. Good thing that blockchains, unlike classical computing, naturally keeps Snapshots which is the idea of a slot (block production: every 12 sec snapshotting for Ethereum, and every 400ms for Solana). So at whichever block the timecap was opened, we just use the balances for all the accounts inside the TimeCap, and reset the values back to that. This will be done by the smart contract controlling/managing the TimeCap, so not like any actor (or TimeCap Operator) is responsible for signing such as reset. Think of this like a Git Reset and not Git Revert. The latter would be way too expensive to do onchain. We do Resets exploiting the natural snapshotting at the heart of blockchain being about chain of blocks or chain of snapshots.

With all of the above, each TimeCap starts acting as a virtual block. In fact when more and more dApps start using TimeCap[s] to the point of it being the standard, the real blockchain will be more as an underlying infra used by TimeCaps[s] while dApps never having to care about which chain they are interacting with, as their state transitions will all get virtualized. Then in the future, we will be working on async block production: produce blocks only as/when necessary based on transaction traffic (high traffic, faster slots), intents exec orderings referencing (lazy eval of intents based on their dependencies), and security budget (coz market conditions dictate base gas price).

transaction traffic X security budget needed. Blockchains → TimeChain as in Chain of TimeCaps.

Nakamoto did call blockchains as timechains , the above is from his BTC code back in the day

How to test if our TimeCap indeed works? With an dApp of course — for a use case simple enough to use and understand but paradoxically hard to implement. Introducing: Crosschain multiblock Flash Loans. Soon onchain near you, powered by STXN.

But first on the infra level, we will have the most basic feature of “Reversible Transactions” — Reversible WITHOUT block reorgs. Once you have declared a TimeCap before sending a tx, as long as the tx is within that TimeCap, you can always reverse it. Never breaking immutability, still rollback of particular transactions beyond the current block made possible as long as all of these transactions are within a TimeCap declared beforehand. Much like you have to bridge your funds to an L2 first to then be able to use it, same with declare TimeCap first and then reversibility is unlocked. A crucial difference though: unlike L2s, TimeCap are not eternal, they are ephemeral by necessity, no TimeCap could be started without being able tl specify a strictly enforceable haltability criteria. No halts, no TimeCap[s], no reversibility.

So on the infra: Reversible Transactions, Immutable Chains.

a snippet from our internal working specs

Leave a Reply