Deploy Docker Apps in TEEs with Phala - ETHGlobal Bangkok 2024
ETHGlobal·Thu, Oct 9, 2025, 12:00 AM
Join us for a workshop with Shelven Zhou & Joshua Waller from Phala Network titled, "Deploy Docker Apps in TEEs with Phala." Learn about TEEs (Trusted Execution Environment) and how Phala's dstack SDK allows you to deploy docker apps within a TEE. We will also show how to make remote attestations, derive keypairs, and interact onchain with a local deployment. ETHGlobal Bangkok 2024 was a 3-day hackathon that took place November 15 to 17, 2024, and brought together the most skilled web3 developers, designers and product builders from all around the globe for a weekend-long adventure to advance the Ethereum ecosystem! ----------------- Follow us: https://x.com/ethglobal Check us out: https://ethglobal.com/ Email us at: hello@ethglobal.com
Transcript
Hello everyone. I'm Shelvin from Phala Network and today I'm going to present some advances in the world of TE. So advances in the world of TE. So , how do you make a smooth transition from Web 2 to Web 3 with TE? Yes.
Phala is a 5-year-old project that has been working on TE for a long time, and we now manage the world's largest decentralized TE network , where all the hardware comes from our community and has been running stably for about 5 years. Yes, and recently there has been an evolution in the world of TE compared to the past, such as Intel SGX, to what I called the first generation of TE I called the first generation of TE ; The latest TE changes the game due to three interesting features. First, better performance. In the previous world, when using Intel SGX, there was a memory limitation that has now been completely eliminated; Previously you suffered a 25% overhead, and now the cost of running programs in TE is almost negligible. Second, I would say usability.
Currently, solutions such as AWS Nitro, Intel TDX, or AMD SEV provide virtualization support at the system image level . This means you can move your program to run on TE without any modifications run on TE without any modifications . All you need to do is Dockerize it and leave the rest of the work to us. Yes. The third part is GPU support.
Late last year, Nvidia announced the world's first GPU with support for TE. It's the H100 series and now it has the H200 series with more memory. I believe this is crucial for using TE in more serious scenarios, such as running AI models or ZK circuits within TE. Yes, and what we're presenting here is a TE SDK called Dstack. It is a Flashbots X project produced jointly by Phala and Flashbots.
It has four main characteristics. First, support for Docker images. Simply create your own Docker Compose file and we'll run it directly in TE. Second, it is equipped with remote attestation APIs and a web interface for displaying the chain of trust. This way, any user can easily verify if the application is actually running within the TE.
The third is equipped with automatic IHTTP, which means that every application deployed on the TEE will have a domain and all TLS certificates generated and managed entirely on the TEE. Therefore, the end user can use their existing TLS-based solutions to connect to their application. The final difference from the previous part is that we will replace the current hardware-based root of trust with a decentralized root of trust controlled by a smart contract. This means that your application data is safe even if a TEE node goes down, because the state and data are stored elsewhere. This way, you can start a new instance of TEE to resume execution.
Yes, this is an interesting part that works thanks to this technological stack. It was created by Professor Andrew Miller of the Bash Bot team, who used this battery to build it. I would say that it differs from other AI agents in that the entire stack is controlled by the machine. Imagine: from X's account, the email that controls that account, to all the AI agents and their API keys; Everything is used there. They all run within the TEE.
Now we can see that these are real AI agents, controlled by the machine and trustworthy. Yes. And this will unlock many interesting use cases . Finally, we have just published the world's first benchmark on TEE GPUs. This is to show whether it is useful or not.
The overall conclusion is that the average cost overrun is less than 9%. Which, from my point of view, is quite good. Yes. Next, my colleague Joshua will show you how to use stack E. Thank you.
Good. What I'll do is show you an application that's deployed on our lab server right now , just to give you an idea. Here is a Next.js application. Which I have accessed publicly.
You can go to this link if you wish as well. What I can do is derive an ECDSA key pair here. This is an account that is within the TEE. From there, I can start signing messages. And we can see the transaction signature here, which you can verify.
They can sign typed data. Well, I actually use the VM SDK, some of the examples they had, and I created a test template that you can clone to get started quickly. I also sent some funds to this wallet so I could execute a transaction; I sent 420 gray to an account I had just transferred to, to the TEE account that was derived. In addition, another key feature is that remote certification can also be performed . In this case .
In this case , I created a remote certification with some random data. From there, I click here and it should generate the quotes. Here is my quote. They can copy it. Go to the remote certification browser.
Stick it on. Verify. Here you can see that this is running in a TEE environment with the TEE simulator, which is what we allow you to use for local development. They would receive a message that said "not verified". But we can also do some additional checks, because they don't want to rely solely on our block explorer or take our word for it.
You can go to the chain and verify it directly with the Automata verifier. You can see that we are verifying the chain. They can also choose the different networks they support. Hmm. The next part I'll show you is another implemented application, a Jupyter notebook so you can see that we can support any language you want to build in, and so you can start to be more creative.
Since they can connect to the socket, which is the tap T socket, they now have access to these two functions: TDX quote, and the parameters they would pass are the report data would pass are the report data . By the way, this Jupyter notebook itself is running inside the... I'll zoom in here so people can see it. Yes, you can run this here and get a quote. Here I have one, and another key feature is the derived key.
So you also have this derived key function , where you define your path, you can define your root of trust and then enter the salt from the subject. And every time you generate this, I think it should generate the same key here generate the same key here , so you can derive a key and then take it to generate, for example then take it to generate, for example , an ECDSA key or say ED25519, or any curve you want to choose. But yes, that's the power you have when you create, containerize your applications, and then run them on a TEE. Um and then run them on a TEE. Um , some other things you could start with.
I've created a small reference sheet here, which you can access at bit.ly/destacks-cheatsheet. But anyway, here's how to get started with the local simulator. You can clone the repository and have the same Next.js application.
Also, I can zoom in on the image here for anyone zoom in on the image here for anyone , too. And it will show you how to get started in just a few steps, and you'll immediately have a working application, capable of generating local remote attestations and deriving key pairs from there as well. One of the interesting things we just packaged, but that we want to see if any developers want to take advantage of, is that we created a repository called AI 16Z TEE. Here 's a Dockerfile and you can build your own AI agent that can run autonomously and be able to post on Twitter or reply on Discord, either by voice or text. You can choose any language model through the Red Pillar API and you can also connect it to Telegram, in addition to using the derived key to generate wallet accounts and thus start making on-chain transactions autonomously with these agents.
So you can really be creative; You have a repository here in the guide for you to review and start working on however you like, but I wanted to save some time instead of going into the demo to see if there are any questions from the audience. Oh yes any questions from the audience. Oh yes , so if you're going to follow a network, the question was whether there's any template or reference code to get started and understand how to build, for example, a model within a TEE. If you go to the follow network repository, here we have some templates under the TEE sim templates. So this is like the TEE simulator.
We have a Python template, a Red Pill template, and a Next.js application. But, if you have any examples where you want to run a model, please come to our booth. We're here on this back wall to guide you and tell you how to get started quickly with this too. Because we have our entire engineering team available to answer your questions available to answer your questions .
Automatic transcript — names and jargon may be misspelled.