📥 Run iApp with inputs
When an iApp requires additional data or parameters to function, you can provide various types of inputs to customize its behavior and enable processing. This guide covers all the different ways to run an iApp with inputs using the DataProtector turnkey toolkit.
Choosing Between Toolkit
DataProtector SDK Toolkit: Always requires protected data. Best for Node.js/frontend projects and production environments. Offers programmatic control, integration, error handling, and batch operations.
iApp Generator CLI Toolkit: No protected data required to run an iApp. Perfect for testing, development, and quick prototyping. Provides immediate execution without coding.
Possible of Inputs
iExec supports several types of inputs for iApp executions:
- Protected Data: Encrypted data processed within the TEE
- Arguments: Command-line arguments passed to the application
- Input Files: URLs to public files that the app can download
- Secrets: Sensitive data like API keys stored securely
Adding Protected Data
With DataProtector Toolkit
When working with protected data that contains multiple files, you can specify which file to process.
// Process protected data with specific path
const result = await dataProtectorCore.processProtectedData({
protectedData: '0x123abc...',
app: '0x456def...',
path: 'data/input.csv',
});
The processProtectedData
function will automatically download and decrypt the results for you. Nevertheless, if you want to retrieve results from a completed task, you can do so as follows:
// Retrieve the result
const taskResult = await dataProtectorCore.getResultFromCompletedTask({
taskId: taskId,
});
With iApp Generator Toolkit
_____ _ | ____|_ _____ ___ _ _| |_ ___ | _| \ \/ / _ \/ __| | | | __/ _ \ | |___ > < __/ (__| |_| | || __/ |_____/_/\_\___|\___|\__,_|\__\___|
Adding Command-Line Arguments
With DataProtector Toolkit
Command-line arguments are passed as a string to the iApp and are visible on the blockchain.
// Process protected data with arguments
const result = await dataProtectorCore.processProtectedData({
protectedData: '0x123abc...',
app: '0x456def...',
args: '--input-path data/input.csv --output-format json --verbose',
});
With iApp Generator Toolkit
_____ _ | ____|_ _____ ___ _ _| |_ ___ | _| \ \/ / _ \/ __| | | | __/ _ \ | |___ > < __/ (__| |_| | || __/ |_____/_/\_\___|\___|\__,_|\__\___|
Adding Input Files
With DataProtector Toolkit
Input files are URLs to public files that the iApp can download during execution.
// Process protected data with input files
const result = await dataProtectorCore.processProtectedData({
protectedData: '0x123abc...',
app: '0x456def...',
inputFiles: [
'https://raw.githubusercontent.com/user/repo/main/config.json',
'https://example.com/public-data.csv',
],
});
With iApp Generator Toolkit
_____ _ | ____|_ _____ ___ _ _| |_ ___ | _| \ \/ / _ \/ __| | | | __/ _ \ | |___ > < __/ (__| |_| | || __/ |_____/_/\_\___|\___|\__,_|\__\___|
Adding Secrets
With DataProtector Toolkit
Secrets are sensitive data like API keys, passwords, or tokens that are stored securely and made available to the iApp as environment variables.
// Process protected data with secrets
const result = await dataProtectorCore.processProtectedData({
protectedData: '0x123abc...',
app: '0x456def...',
secrets: {
1: 'openai-api-key',
2: 'database-password',
},
});
With iApp Generator Toolkit
_____ _ | ____|_ _____ ___ _ _| |_ ___ | _| \ \/ / _ \/ __| | | | __/ _ \ | |___ > < __/ (__| |_| | || __/ |_____/_/\_\___|\___|\__,_|\__\___|
Next Steps
Now that you understand how to add inputs to iApp executions:
- Check out our How to Pay for Executions guide