⚡ Run an iApp
There are multiple ways to execute an iApp on the iExec network. An iApp can be:
- Self-sufficient - Basic execution without additional inputs
- Data-dependent - Requires protected data, secrets, input files, or command-line arguments
This guide covers the basic execution methods. For advanced features like protected data, arguments, and input files, see the dedicated guides.
When to Use Each Method
- iApp Generator CLI: For developers who have built their own iApp
- iExec Library: For JavaScript applications and web3 integration
- iExec CLI: For quick testing and automation scripts
Method 1: Using the iApp Generator CLI
The iApp Generator CLI provides a streamlined way to execute iApp, especially for developers who have built their own iApp.
Note: For installation instructions, see the iApp Generator Getting Started guide.
Terminal
$ iapp run 0x1f80DCebc2EAAff0Db7156413C43B7e88D189923 --chain arbitrum-mainnet
_____ _ | ____|_ _____ ___ _ _| |_ ___ | _| \ \/ / _ \/ __| | | | __/ _ \ | |___ > < __/ (__| |_| | || __/ |_____/_/\_\___|\___|\__,_|\__\___|
Method 2: Using the iExec SDK Library
The iExec SDK provides a modular JavaScript interface for executing iApp.
ts
// Create & Sign a request order
const requestorderToSign = await iexec.order.createRequestorder({
app: '0x456def...', // The iApp address
category: 0,
});
const requestOrder = await iexec.order.signRequestorder(requestorderToSign);
// Fetch app orders
const appOrders = await iexec.orderbook.fetchAppOrderbook(
'0x456def...' // Filter by specific app
);
if (appOrders.orders.length === 0) {
throw new Error('No app orders found for the specified app');
}
// Fetch workerpool orders
const workerpoolOrders = await iexec.orderbook.fetchWorkerpoolOrderbook({
workerpool: '0xa5de76...', // Filter by specific workerpool
});
if (workerpoolOrders.orders.length === 0) {
throw new Error('No workerpool orders found for the specified workerpool');
}
// Execute the task
const taskId = await iexec.order.matchOrders({
requestorder: requestOrder,
apporder: appOrders.orders[0].order,
workerpoolorder: workerpoolOrders.orders[0].order,
});
Method 3: Using the iExec CLI
The iExec CLI is perfect for quick executions and automation scripts.
bash
# Execute an iApp
iexec app run 0x456def...
Next Steps
- Discover how to run an iApp with inputs
- Understand how to pay for executions