Multi-party Workflows
One of the Engine’s most powerful features is its ability to orchestrate multiple (signed) workflows within a single transaction, creating complex multi-party workflows while maintaining security and atomicity. Traditional blockchain transactions execute linearly from start to finish. Intentify introduces a novel execution paradigm where multiple intents can be bundled together and executed in a coordinated manner within the same transaction.
Execution Control with vm.continue()
Workflows can explicitly pause their execution and delegate control to subsequent workflow using the vm.continue() instruction. This creates a sophisticated execution flow where:
- Workflow A begins execution and performs its initial operations
- When Workflow A calls
vm.continue(), execution pauses and Workflow B begins - Workflow B can also call
vm.continue()to pass control to Workflow C, and so on - After the final script completes, control returns in reverse order, allowing each script to perform post-execution checks
Execution Flow Diagram
The following sequence diagram illustrates how multiple workflows interact within a single transaction:
Diagram Explanation
-
Initial Execution: Workflow A starts execution and performs its initial operations (checking conditions, recording state, etc.)
-
Control Transfer: When Workflow A calls
vm.continue(), it pauses its execution and transfers control to Workflow B. Workflow A becomes inactive while Workflow B takes over. -
Cascading Execution: Workflow B executes its logic and can also call
vm.continue()to pass control to Workflow C. This pattern can continue for any number of scripts in the bundle. -
Final Workflow: Workflow D (the last in the chain) executes without calling
vm.continue(), completing its operations entirely. -
Resume in Reverse: After Workflow D finishes, control returns to Workflow B, which resumes execution from where it left off. Workflow B can now perform post-execution checks (like verifying that conditions are still met).
-
Final Resume: Finally, Workflow A resumes execution, typically to perform its own post-execution validation (such as checking that balances have been restored or requirements have been met).
Enabling Intent-Based Interactions
This execution paradigm fundamentally enables intent-based interactions by allowing multiple parties to express their requirements as separate scripts that execute together atomically. Each participant can define their own conditions and validation logic while trusting that the system will either satisfy everyone’s requirements or fail completely.
The power of this approach becomes evident in complex scenarios like multi-party atomic swaps, where several participants each have different tokens and specific exchange rates they’re willing to accept. Rather than requiring a centralized coordinator, each party can submit their own script expressing their intent, and the engine orchestrates the execution to satisfy all parties simultaneously. Similarly, p2p flashloans demonstrate how liquidity providers can express their lending terms while borrowers specify their repayment conditions, with both sides guaranteed that their requirements will be met.
This composability extends to complex DeFi strategies that span multiple protocols, cross-protocol arbitrage opportunities that require precise timing and validation, and conditional transactions where subsequent actions depend on the success of earlier operations. Each script maintains its own security model and validation logic, ensuring that participants retain full control over their conditions while benefiting from atomic execution guarantees.
The execution flow represents a fundamental shift from simple transaction execution to programmable transaction orchestration. By enabling multiple independent scripts to coordinate their execution through controlled pause-and-resume cycles, the system opens new possibilities for decentralized application design where user intent can be expressed directly as executable code, eliminating the need for trusted intermediaries while maintaining security and atomicity.