Skip to content

📥 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:

  1. Protected Data: Encrypted data processed within the TEE
  2. Arguments: Command-line arguments passed to the application
  3. Input Files: URLs to public files that the app can download
  4. 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.

ts
// 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:

ts
// Retrieve the result
const 
taskResult
= await
dataProtectorCore
.
getResultFromCompletedTask
({
taskId
:
taskId
,
});

With iApp Generator Toolkit

Terminal
$ iapp run 0x1f80DCebc2EAAff0Db7156413C43B7e88D189923 --chain arbitrum-mainnet --protectedData 0x123abc...
  _____                     _       
 | ____|_  _____  ___ _   _| |_ ___ 
 |  _| \ \/ / _ \/ __| | | | __/ _ \
 | |___ >  <  __/ (__| |_| | ||  __/
 |_____/_/\_\___|\___|\__,_|\__\___|
                                    

Adding Command-Line Arguments

With DataProtector Toolkit

Command-line arguments are passed as a string to the iApp and are visible on the blockchain.

ts
// 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

Terminal
$ iapp run 0x1f80DCebc2EAAff0Db7156413C43B7e88D189923 --chain arbitrum-mainnet --args '--input-path data/input.csv --output-format json'
  _____                     _       
 | ____|_  _____  ___ _   _| |_ ___ 
 |  _| \ \/ / _ \/ __| | | | __/ _ \
 | |___ >  <  __/ (__| |_| | ||  __/
 |_____/_/\_\___|\___|\__,_|\__\___|
                                    

Adding Input Files

With DataProtector Toolkit

Input files are URLs to public files that the iApp can download during execution.

ts
// 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

Terminal
$ iapp run 0x1f80DCebc2EAAff0Db7156413C43B7e88D189923 --chain arbitrum-mainnet --inputFile https://raw.githubusercontent.com/user/repo/main/config.json https://example.com/public-data.csv
  _____                     _       
 | ____|_  _____  ___ _   _| |_ ___ 
 |  _| \ \/ / _ \/ __| | | | __/ _ \
 | |___ >  <  __/ (__| |_| | ||  __/
 |_____/_/\_\___|\___|\__,_|\__\___|
                                    

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.

ts
// 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

Terminal
$ iapp run 0x1f80DCebc2EAAff0Db7156413C43B7e88D189923 --chain arbitrum-mainnet --requesterSecret 1=openai-api-key 2=database-password
  _____                     _       
 | ____|_  _____  ___ _   _| |_ ___ 
 |  _| \ \/ / _ \/ __| | | | __/ _ \
 | |___ >  <  __/ (__| |_| | ||  __/
 |_____/_/\_\___|\___|\__,_|\__\___|
                                    

Next Steps

Now that you understand how to add inputs to iApp executions: