Build your first application with Scone framework
In this tutorial, you will learn how to build and run a Confidential Computing application with the Scone TEE framework.
Before going any further, make sure you managed to Build your first application.
Prerequisites:
Docker 17.05 or higher on the daemon and client.
iExec SDK 8.0.0 or higher. Install the iExec SDK
Familiarity with the basic concepts of Intel® SGX and SCONE framework.
In order to follow this tutorial, you will need to register a free SCONE Account to access SCONE build tools and curated images from the SCONE registry.
Once your account is activated, you need to request access to the SCONE build tools for iExec.
Prepare your application
For demo purposes, we omitted some development best practices in these examples.
Make sure to check your field's best practices before going to production.
Before going further, your <docker-hub-user>/hello-world:1.0.0
image built previously is required.
If you missed that part, please go back to Build your first application.
For this tutorial, you can reuse the same directory tree or create a new one.
To create a new directory tree, execute the following commands in ~/iexec-projects/
.
Update chain json
Make sure your chain.json
content is as follows:
If you start from a new firectory tree, you will need to replay the following steps from Build your first application:
Write the app Javascript or Python source code in
src/
As we mentioned earlier, the advantage of using SCONE is the ability to make the application Intel® SGX-enabled without changing the source code. The only thing we are going to do is rebuilding the app using the Trusted-Execution-Environment tooling provided by SCONE.
SCONE provides TEE conversion tooling (Python, Java, ..) plus eventually TEE base images for other languages (NodeJs).
Build the TEE docker image
We will use the following script to wrap the sconification process, copy the sconify.sh
script in the current directory:
Run the sconify.sh
script to build the Scone TEE application:
Push your image on DockerHub:
Congratulations, you just built your Scone TEE application.
You may have noticed the tee-debug
flag in the image name, the built image is actually in TEE debug mode, this allows you to have some debug features while developping the app.
Once you are happy with the debug app, contact us to go to production!
Test your app on iExec
At this stage, your application is ready to be tested on iExec. The process is similar to testing any type of application on the platform, with these minor exceptions:
Deploy the TEE app on iExec
TEE applications require some additional information to be filled in during deployment.
Edit iexec.json
and fill in the standard keys and the mrenclave
object:
See Create your identity on the blockchain to retrieve <your-wallet-address>
value.
See Deploy your app on iExec to retrieve your image <checksum>
.
Run your TEE image with SCONE_HASH=1
to get the enclave fingerprint (mrenclave):
Deploy the app with the standard command:
Run the TEE app
Specify the tag --tag tee,scone
in iexec app run
command to run a tee app.
One last thing, in order to run a TEE-debug app you will also need to select a debug workerpool, use the debug workerpool debug-v8-learn.main.pools.iexec.eth
.
You are now ready to run the app
You noticed we used debug-v8-learn.main.pools.iexec.eth
instead of an ethereum address, this is an ENS name.
The ENS (Ethereum Name Service) protocol enables associating decentralized naming to ethereum addresses.
Remember, you can access task and app logs by following the instructions on page Debug your tasks.
Next step?
In this tutorial, you learned how to leverage your application with the power of Trusted Execution Environments using iExec. But according to your use case, you may need to use some confidential data to get the full potential of the Confidential Computing paradigm. Check out next chapters to see how:
Last updated