iExec: Using iExec and Tee Worker to Create Apps that Use Datasets Stored on Filebase
Learn how to use iExec and Tee Worker to create apps that use datasets stored on Filebase.
Last updated
Learn how to use iExec and Tee Worker to create apps that use datasets stored on Filebase.
Last updated
The iExec network enables decentralized docker app deployment and monetization on the blockchain by connecting cloud resource sellers with cloud resource buyers and encourages an ecosystem of decentralized, autonomous, privacy-preserving applications.
Read below to learn how to use iExec and its Tee Worker Application to create apps that use datasets stored on Filebase.
npm i -g iexec
iexec wallet create
You will be prompted to set a password on this wallet file. Take note of this password since there is no way to recover it if forgotten.
mkdir ~/iexec-projects
cd ~/iexec-projects
iexec init --skip-wallet
iexec storage init --chain viviani
iexec app init
The default app is the public docker image iexechub/python-hello-world
.
iexec app deploy --chain viviani
iexec app show --chain viviani
Since we’re running on the testnet, we can get some test RLC with the command:
iexec wallet get-RLC --chain viviani
iexec wallet show --chain viviani
iexec app run --args APP_NAME --watch --chain viviani
Replace APP_NAME
with your desired Application name.
iexec task show TASK_ID --download my-result --chain viviani
Replace TASK_ID
with the Task ID value from the last command’s output.
unzip my-result.zip -d my-result
cat my-result/result.txt
For private datasets and assets, this method is not recommended, so we’ll now switch to using Filebase for our private storage backend.
iexec dataset init --encrypted
This command makes 3 new directories:
datasets/encrypted
datasets/original
.secrets/datasets
A new section will be appended to the iexec.json
file called ‘datasets’.
echo "Hello Filebase!" > datasets/original/filebase-test-dataset.txt
iexec dataset encrypt
Take note of the checksum value that is returned from this command.
This command created the file datasets/encrypted/filebase-test-dataset.txt.enc
. Let’s upload this file to Filebase.
Either method will require an IPFS bucket which must be created from the Web Console.
If you don’t have an account already, sign up, then log in.
Select ‘Create Bucket’ in the top right corner to create a new bucket.
Bucket names must be unique across all Filebase users, be between 3 and 63 characters long, and can contain only lowercase characters, numbers, and dashes.
Once uploaded, they will be listed in the bucket.
Take note of this CID, since we will use it in the next step.
iexec.json
file, navigate to the dataset section, and edit the following lines:Replace the IPFS_CID
with the IPFS CID from the uploaded dataset in your Filebase bucket.
iexec dataset deploy --chain viviani
To get the encryption key for this dataset and push it to the testnet, use the following commands:
Note: This workflow is fine for debugging purposes on the testnet, but is not recommended to store secrets for production environments.
sed -i 's|"viviani": {},|"viviani": { "sms": "<https://v7.sms.debug-tee-services.viviani.iex.ec>" },|g' chain.json
iexec dataset push-secret --chain viviani
First, make a new directory for this project, initiate iExec inside this directory, and create some empty files that we’ll need later.
mkdir my-tee-dataset-app && cd my-tee-dataset-app
iexec init --skip-wallet
mkdir src
touch src/app.py
touch Dockerfile
touch sconify.sh
src/
folder, open the new file called app.py
and input the following code:sconify.sh
file and input the following code:sconify.sh
script to build the TEE app:./sconify.sh
iexec app init --tee
docker run -it --rm -e SCONE_HASH=1 python-dataset-app:tee-debug
Take note of this, we will use it in the next step.
iexec.json
file to add the following configuration details:Replace the ENCLAVE_FINGERPRINT
value with the enclave fingerprint you took note of in the last step.
iexec app deploy --chain viviani
iexec app run APP_ADDRESS --tag tee --dataset DATASET_ADDRESS --workerpool 0xe6806E69BA8650AF23264702ddD43C4DCe35CcCe --watch --chain viviani
Replace the APP_ADDRESS
value with your TEE app address, and the DATASET_ADDRESS
with the address of your dataset from Step 25.
Your app is now deployed using your encrypted dataset stored on Filebase!