Skip to content

Latest commit

 

History

History
122 lines (76 loc) · 4.08 KB

File metadata and controls

122 lines (76 loc) · 4.08 KB

Build From Template

There are a couple templates that we offer to allow you to get started without any heavy lifting. The steps to get started are simple and easy to test in a few minutes.

{% hint style="info" %}

Before You Start

Make sure you have Docker Desktop or OrbStack started before you begin. {% endhint %}

{% tabs %} {% tab title="next.js Template" %}

Installation

Clone the template repo.

git clone https://github.com/Phala-Network/nextjs-viem-tee-sim-template.git

Build and Deploy Locally

Build the docker image.

docker build -t my-dapp:latest .

Now that the docker image is built, let's start testing against the TEE Simulator. First we must pull the latest TEE Simulator in docker, and run it with the following commands.

docker pull phalanetwork/tappd-simulator:latest
docker run --rm -p 8090:8090 phalanetwork/tappd-simulator:latest

With the simulator up and running, we can now start our docker app to test out the functionality.

docker run --rm -p 3000:3000 my-dapp:latest

Now we can go to http://localhost:3000 and see our deployed application.

Call the APIs

We can test to see if our functions work by calling the API calls with

We should see the results similar to the following screenshots.

/api/tdxQuote

/api/account/address

/api/signMessage

/api/signTypedData

/api/sendTransaction

{% endtab %}

{% tab title="Python Template" %}

Installation

Clone the template repo.

git clone https://github.com/Phala-Network/python-tee-sim-template.git

Build and Deploy Locally

Build the docker image.

docker build -t my-dapp:latest .

Now that the docker image is built, let's start testing against the TEE Simulator. First we must pull the latest TEE Simulator in docker, and run it with the following commands.

docker pull phalanetwork/tappd-simulator:latest
docker run --rm -p 8090:8090 phalanetwork/tappd-simulator:latest

With the simulator up and running, we can now start our docker app to test out the functionality.

docker run --rm -p 3000:3000 my-dapp:latest

Now we can go to http://localhost:3000 and see our deployed application.

/

Call the APIs

We can test to see if our functions work by calling the API calls with

We should see the results similar to the following screenshots.

/derivekey

/tdxquote

{% endtab %} {% endtabs %}

Conclusion

The last 2 tutorials were key to understanding the basics of deploying a Docker app on a TEE Server. Now you are ready to start building on Dstack! For more info on the design of Dstack, check out the Design Documents.