Skip to content

๐Ÿง‘โ€๐Ÿญ Build your iApp โ€‹

๐Ÿงฐ Initialize your iApp โ€‹

The iApp (iExec Application) Generator CLI simplifies the setup of your iApp by guiding you through a step-by-step initialization process. This ensures your iApp is correctly configured and compatible with iExec's confidential computing environment.

๐Ÿ— Define your Project โ€‹

Terminal
$ iapp init
  _    _                
 (_)  / \   _ __  _ __  
 | | / _ \ | '_ \| '_ \ 
 | |/ ___ \| |_) | |_) |
 |_/_/   \_\ .__/| .__/ 
           |_|   |_|    

Follow the prompts to specify:

  • Project name โ€“ Creates a folder for your project files.
  • Language โ€“ Choose between JavaScript, Python, etc.
  • Project mode โ€“ Choose Basic (Hello-World setup) or Advanced mode.

โš™ Configure โ€‹

You'll set up:

  • Arguments (Args) โ€“ Public parameters for your iApp.
  • Input Files โ€“ Files dynamically downloaded during execution. These can come from a specific URL.
  • Requester Secrets โ€“ Confidential authentication strings.
  • Protected Data โ€“ Encrypted data accessible only inside the TEE.
  • App Secret โ€“ Immutable secret provisioned by the iApp owner.

For more details and to learn how to use them in your application, refer here Inputs and Outputs

๐Ÿš€ Build your iApp โ€‹

After initialization, the following essential files and directories are generated:

  • iapp.config.json
  • src/app.js (JavaScript) or src/app.py (Python)
  • Dockerfile
  • Directories:
    • input/
    • output/
    • cache/

To modify your main application logic open:

sh
src/app.js  # For JavaScript
src/app.py  # For Python

INFO

๐Ÿ’ก The src/ directory contains the core logic of your iApp. Implement your algorithms and data processing here.

๐Ÿ› ๏ธ CLI Commands Reference โ€‹

iapp init โ€‹

Purpose: Initialize a new iApp project
Usage: iapp init [options]
What it does: Creates project structure, configuration files, and basic templates through interactive prompts.

iapp test โ€‹

Purpose: Test your iApp locally before deployment
Usage: iapp test [options]
Options:

  • -v, --version [boolean] โ€“ Show version number
  • --args <string> โ€“ Arguments accessible inside the iApp (use quotes to group)
  • --protectedData <string> โ€“ Specify the protected data mock name (default or custom via iapp mock)
  • --inputFile <string> โ€“ One or multiple input files (public URLs) available inside the iApp at $IEXEC_INPUT_FILE_NAME_*
  • --requesterSecret <array> โ€“ Key-value requester secrets (index=value) available inside the iApp at $IEXEC_REQUESTER_SECRET_*

iapp deploy โ€‹

Purpose: Deploy your iApp to the iExec network
Usage: iapp deploy [options]
Options:

  • --chain <string> โ€“ Specify the blockchain network for deployment (e.g., goerli, mainnet)

iapp run <iAppAddress> โ€‹

Purpose: Execute your deployed iApp on a worker node
Usage: iapp run <iAppAddress> [options]
Positional arguments:

  • <iAppAddress> โ€“ Address of the deployed iApp to run

Options:

  • --args <string> โ€“ Arguments accessible inside the iApp (use quotes to group)
  • --protectedData <string> โ€“ Specify the protected data mock name (default or custom via iapp mock)
  • --inputFile <string> โ€“ One or multiple input files (public URLs) available inside the iApp at $IEXEC_INPUT_FILE_NAME_*
  • --requesterSecret <array> โ€“ Key-value requester secrets (index=value) available inside the iApp at $IEXEC_REQUESTER_SECRET_*
  • --chain <string> โ€“ Specify the blockchain network to run the iApp on (e.g., goerli, mainnet)

iapp debug <taskId> โ€‹

Purpose: Retrieve detailed execution logs from worker nodes
Usage: iapp debug <taskId> [options]
Positional arguments:

  • <taskId> โ€“ The ID of the task to debug

Options:

  • --chain <string> โ€“ Specify the blockchain network of the task (e.g., goerli, mainnet)

iapp mock <inputType> โ€‹

Purpose: Create mocked input for testing purposes
Usage: iapp mock <inputType> [options]
Positional arguments:

  • <inputType> โ€“ Type of input to mock (e.g., default, custom)

Options:

  • --args <string> โ€“ Arguments to use in the mock data
  • --protectedData <string> โ€“ Protected data mock name to use
  • --inputFile <string> โ€“ Input files to mock
  • --requesterSecret <array> โ€“ Requester secrets to mock

iapp wallet <action> โ€‹

Purpose: Manage wallet-related operations
Usage: iapp wallet <action> [options]
Positional arguments:

  • <action> โ€“ Wallet action to perform (e.g., balance, address, sign)

Options:

  • --chain <string> โ€“ Specify the blockchain network (e.g., goerli, mainnet)
  • --data <string> โ€“ Data to sign (for sign action)

Advanced Options Chain Not Supported โ€‹

EXPERIMENTAL_TDX_APP=true โ€‹

Purpose: Enable experimental Intel TDX support
Usage: Set as environment variable before running commands
Example: EXPERIMENTAL_TDX_APP=true iapp test

Available with:

  • iapp test
  • iapp deploy
  • iapp run <app-address>

TDX Chain Not Supported

๐Ÿงช While TEE iApp are based on intel SGX technology by default, iApp has an experimental support for intel TDX applications.

TDX mode is enabled by setting the environment variable EXPERIMENTAL_TDX_APP=true.

โš ๏ธ Keep in mind: TDX mode is experimental and can be subject to instabilities or discontinuity.

๐Ÿš€ Next Steps โ€‹

Your iApp is now running on iExec!

Once your application is stable and functional, you can learn how to manage access to your iApp