๐ ๏ธ Build and deploy your first iApp โ
Reading time ๐ 10 min
Time to build
Build an iApp that can process protected data in a secure environment using the iExec iApp generator tool. This tool helps you create, test, and deploy iApp with just a few commands.
If you wanna explore and deep dive in the command-line tool. You can check the iApp-CLI (Command Line Interface) GitHub repository. Follow the instructions carefully for a smooth development experience.
๐ Prerequisites โ
Before getting started, make sure you have:
Don't worry. All secrets used in this tutorial stay on your machine and aren't shared with anyone. You'll only need them to run the iapp run
command.
๐ Types of iApp you can build โ
iExec enables you to build various types of Privacy-preserving applications. Here are some popular use cases:
๐ง Web3 mail โ
Send privacy-preserving emails to registered Ethereum account holders without knowing or storing their email addresses. Github | Documentation
๐ฌ Web3 telegram โ
Send privacy-preserving Telegram messages without knowing or storing their Telegram handles. Github | Documentation
๐ Content delivery โ
Transfer, sell or rent protected content to authorized users. Github | Documentation
These are just a few examples, the possibilities are endless. Want to explore iApp Generator? Check out our documentation and see what you can build!
๐พ Installation (Win / Mac / Linux) โ
First, you need to install the iapp
package. Open your terminal and run:
npm i -g @iexec/iapp
yarn global add @iexec/iapp
pnpm add -g @iexec/iapp
bun add -g @iexec/iapp
You can check if the installation was successful by running:
#checking the version
iapp --version
#checking the available commands
iapp --help
๐ ๏ธ Bootstrap your iApp โ
To initialize the working directory for developing your iApp, use the iapp init
command. This command sets up the necessary project structure and files.
mkdir iexec-test
cd iexec-test
iapp init
You will be prompted with the following message:
_ _ (_) / \ _ __ _ __ | | / _ \ | '_ \| '_ \ | |/ ___ \| |_) | |_) | |_/_/ \_\ .__/| .__/ |_| |_|
We recommend selecting "Hello World" to quickly discover how iApp works. Use advanced only if you are familiar with iExec.
- An iApp project is setup with the selected language
- An ethereum wallet has been created (we use it to sign the iApp creation onchain)
- A new folder has been created, it contains a very simple application, with the main code being located in
src/app.js
orsrc/app.py
๐งช Test your iApp โ
To test your iApp, run the iapp test
command. This will build a Docker image and run your application locally to simulate the TEE environment. You'll see the following steps:
The iapp test
command uses your local Docker to build and execute the app, simulating how it will run in the iExec network's TEE environment.
Common Issues:
- If you get Error: Docker daemon is not accessible
: Make sure Docker is installed and running.
- If you get Error: Failed to locate iApp project root
: Ensure you are in your project folder before proceeding.
๐งฉ Using arguments โ
You can pass arguments to your iApp using the --args
option. This allows you to provide necessary inputs during runtime (you can use your name for example).
iapp test --args your-name
๐ Using protected data โ
You can pass a protectedData that you are authorized to process to your iApp using the --protectedData
option.
Since nothing is actually deployed during testing, we use Protected Data mocks to test the app. Using --protectedData
default will provide your app with the default protectedData mock.
iapp test --protectedData default
You can check how args and protectedData are processed in src/app.js
or src/app.py
๐ Deploy your iApp โ
Deploy your iApp on the iExec protocol.
Once you have your token, you can deploy your iApp.
____ _ | _ \ ___ _ __ | | ___ _ _ | | | |/ _ \ '_ \| |/ _ \| | | | | |_| | __/ |_) | | (_) | |_| | |____/ \___| .__/|_|\___/ \__, | |_| |___/
๐ Make sure to save your iApp address after deployment - you'll need it later.
You can find your iApp address in the iexec-app.json
file in your project folder.
โ ๏ธ If you encounter issues during deployment, make sure the Docker BuildKit feature is enabled and supports AMD64 architecture:
docker buildx inspect --bootstrap | grep -i platforms
The output should include linux/amd64
in the list of supported platforms. If not, update to the latest Docker Desktop version which includes these requirements.
โ ๏ธ If you set the wrong Docker username, you can change it by editing the iapp.config.json
file
๐ Run your iApp โ
Now you can run your application:
iapp run <my-iapp-address>
To sum up the process, we take the iApp and wrap it in the iExec framework, allowing it to run securely in a Trusted Execution Environment (TEE) for confidential computing. To learn more, check out the advanced iApp build documentation.
๐ Congratulations! You've successfully deployed and run your first iApp on iExec. This is a significant milestone - your application is now ready to securely process confidential data in a trusted environment.
๐ฏ Key takeaways โ
- ๐ iApp: Special applications that run in TEEs to process protected data
- ๐ ๏ธ iApp CLI: Command-line tool for building, testing, and deploying iApp
- ๐ Protected Data: Can be integrated and processed securely in your iApp
- โ๏ธ Deployment: Apps are deployed on iExec protocol to run in trusted environments
Next up: Alice will learn how to authorize the iApp and Bob to access and use her protected data.