### Phala Cloud Getting Started Source: https://docs.phala.network/network/references/community-builders Guides for getting started with Phala Cloud, including setup and initial configuration. ```APIDOC Phala Cloud: Getting Started: https://docs.phala.network/phala-cloud/getting-started/overview ``` -------------------------------- ### Phala Cloud Getting Started Source: https://docs.phala.network/phala-cloud/what-is/what-is-phala-cloud Provides links to resources for getting started with Phala Cloud, including a quick start guide for deploying applications, exploring the platform, and running LLMs in GPU TEE environments. ```markdown Getting Started New to Phala Cloud? You can start here: ## [Quick Start Deploy your first secure application in minutes ](https://docs.phala.network/phala-cloud/getting-started/overview) ## [Phala Cloud Platform Explore the complete cloud platform features ](https://docs.phala.network/phala-cloud/cvm/overview) ## [Confidential AI Run LLMs in GPU TEE environments ](https://docs.phala.network/phala-cloud/gpu/confidential-ai/gpu-tee/llm-in-tee) ``` -------------------------------- ### Phala Cloud Quick Start Steps Source: https://docs.phala.network/phala-cloud/getting-started/overview This section details the essential steps for new users to get started with Phala Cloud. It includes creating an account, deploying a CVM, and verifying TEE proofs. ```APIDOC Phala Cloud Getting Started: 1. Create Your Phala Cloud Account (1 minute) - Visit the registration page: https://cloud.phala.network/register - Establishes a secure cloud environment and grants access to TEE-powered infrastructure. 2. Deploy Your First CVM (2-3 minutes) - Deploy your first Confidential Virtual Machine (CVM). - Recommended: Start with a pre-configured Jupyter Notebook to explore TEE features. - Alternative: Use the Cloud CLI for deployment (See: https://docs.phala.network/phala-cloud/phala-cloud-cli/start-from-cloud-cli). Next Steps: - Explore Advanced CVM configurations: https://docs.phala.network/phala-cloud/cvm/create-with-docker-compose - Review Security best practices: https://docs.phala.network/phala-cloud/security-and-privacy/security-architecture - Investigate Performance optimization: https://docs.phala.network/phala-cloud/references/performance-report ``` -------------------------------- ### Dstack Getting Started Source: https://docs.phala.network/network/references/community-builders Instructions for getting started with the Phala Dstack. ```APIDOC Dstack: Getting Started: https://docs.phala.network/dstack/getting-started ``` -------------------------------- ### Phala Cloud Getting Started Source: https://docs.phala.network/network/references/support/resource-limits Instructions on how to get started with the Phala Cloud platform for secure and efficient deployment. ```APIDOC Phala Cloud: get_started(): description: Guide to begin using the Phala Cloud platform. url: https://docs.phala.network/phala-cloud/getting-started/overview ``` -------------------------------- ### Clone and Build DStack Project Source: https://docs.phala.network/dstack/getting-started Clones the meta-dstack repository recursively, creates a build directory, and runs the initial host configuration script. It also guides on customizing the build configuration. ```shell git clone https://github.com/Dstack-TEE/meta-dstack.git --recursive cd meta-dstack/ mkdir build cd build ../build.sh hostcfg # This outputs the following message: # Config file ../build-config.sh created, please edit it to configure the build vim ./build-config.sh ``` -------------------------------- ### Install Dependencies (Ubuntu 24.04) Source: https://docs.phala.network/dstack/getting-started Installs essential build tools and WireGuard for Ubuntu 24.04, and sets up the Rust programming language environment. ```shell # for Ubuntu 24.04 sudo apt install -y build-essential chrpath diffstat lz4 wireguard-tools xorriso # install rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` -------------------------------- ### Phala Cloud Account Creation Guide Source: https://docs.phala.network/phala-cloud/getting-started/sign-up-for-cloud-account This documentation outlines the process for creating an account on Phala Cloud. It serves as a quick guide for new users to get started with the platform. ```APIDOC Create Account: Description: Quick guide for how to signup for Phala Cloud account. Steps: 1. Navigate to the Phala Cloud signup page. 2. Fill in the required account details (e.g., email, password). 3. Verify your email address. 4. Complete any additional verification steps if prompted. Related: - Getting Started Overview: https://docs.phala.network/phala-cloud/getting-started/overview - CVM Deployment: https://docs.phala.network/phala-cloud/getting-started/start-from-cloud-ui ``` -------------------------------- ### Attestation API Quickstart Guide Source: https://docs.phala.network/phala-cloud/attestation/overview This section provides a quickstart guide for interacting with the Phala Cloud Attestation API. It outlines the process of obtaining and verifying attestation reports. ```APIDOC Attestation API Quickstart Guide: This guide covers the essential steps for using the Phala Cloud Attestation API to verify the integrity of your Trusted Execution Environment (TEE). Key Concepts: - Remote Attestation (RA): A process to verify that an application is running in a genuine TEE. - Attestation Report (Quote): A cryptographically signed document containing evidence about the TEE environment. - Quoting Enclave: A special enclave responsible for signing attestation reports. Workflow: 1. Request Attestation Report: Your application or a client initiates a request to the Phala Cloud backend to generate an attestation report. 2. Report Generation: The TEE environment, specifically the Quoting Enclave, generates a report containing measurements and configuration details. 3. Report Signing: The Quoting Enclave signs the report using its private key. 4. Report Verification: A remote verifier (e.g., your client application) receives the report and verifies its signature and contents against trusted sources (e.g., Intel's attestation services). Key Fields in TDX Attestation Report: - tee_tcb_svn: Trusted Computing Base Software Guard Extensions Security Version Number. - mr_seam: Measurement of the SEAM (Security, Attestation, and Measurement) module. - mr_signer_seam: Measurement of the signer of the SEAM module. - seam_attributes: Attributes of the SEAM module. - td_attributes: Attributes of the Trusted Domain (TD). - xfam: Extended Feature Attribute Mask. - mr_td: Measurement of the Trusted Domain (TD). - mr_config_id: Measurement of the TD configuration ID. - mr_owner: Measurement of the TD owner. - mr_owner_config: Measurement of the TD owner configuration. - rt_mr0 to rt_mr3: Runtime measurements for different components. - report_data: Arbitrary data provided by the user during report generation. Verification Process: To verify an attestation report, you will typically need to: 1. Obtain the public key of the Quoting Enclave. 2. Verify the signature of the report using the public key. 3. Validate the fields within the report against your expected values (e.g., expected `mr_td`, `rt_mr` values). 4. Consult Intel's TDX Attestation Service or similar trusted sources to confirm the authenticity of the hardware and TEE components. Refer to the CVM Dashboard → Attestation page for visual inspection of these fields. ``` -------------------------------- ### Install Dstack SDK for Golang Source: https://docs.phala.network/dstack/local-development Provides the command to install the Dstack SDK for Golang using the go get command, allowing Go applications to integrate with the Dstack API. ```bash go get github.com/Dstack-TEE/dstack/sdk/go ``` -------------------------------- ### Run DStack Components Source: https://docs.phala.network/dstack/getting-started Starts the three core components of the DStack: dstack-kms, dstack-gateway, and dstack-vmm, each with its respective configuration file. ```shell 1. Run `./dstack-kms -c kms.toml` 2. Run `sudo ./dstack-gateway -c gateway.toml` 3. Run `./dstack-vmm -c vmm.toml` ``` -------------------------------- ### Phala Cloud CLI Installation Source: https://docs.phala.network/phala-cloud/getting-started/start-from-cloud-cli Instructions for installing the Phala Cloud CLI globally using npm, or using npx/bunx for direct execution. This snippet shows the commands to get the CLI ready for use. ```bash # Skip build install globally npm install -g phala # use npx phala npx phala # or use bunx bunx phala ``` -------------------------------- ### Phala Cloud CI/CD Workflow Example Source: https://docs.phala.network/phala-cloud/be-production-ready/ci-cd-automation/setup-a-ci-cd-pipeline This is a conceptual example of a CI/CD workflow for Phala Cloud, likely used in a GitHub Actions `.yml` file. It outlines steps for building and publishing Docker images and deploying to Phala Cloud. ```yaml # Example GitHub Actions workflow for Phala Cloud CI/CD name: Phala Cloud CI/CD on: push: branches: [ main ] pull_request: branches: [ main ] jobs: build-and-deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push Docker image uses: docker/build-push-action@v4 with: context: . push: true tags: your-dockerhub-username/your-app:latest - name: Deploy to Phala Cloud uses: phala-network/phala-cloud-action@v1 # Hypothetical action with: docker_image: your-dockerhub-username/your-app:latest api_key: ${{ secrets.PHALA_CLOUD_API_KEY }} ``` -------------------------------- ### Download Guest Image Source: https://docs.phala.network/dstack/getting-started Downloads a specific version of the guest image from the release page. ```shell # This will download the guest image from the release page. ../build.sh dl 0.5.2 ``` -------------------------------- ### Install Dependencies Source: https://docs.phala.network/network/references/hackathon-guides/ethglobal-san-francisco Installs project dependencies using Yarn. ```bash yarn ``` -------------------------------- ### Verify Simulator Setup Source: https://docs.phala.network/dstack/local-development Commands to verify that the simulator's socket files have been created and that the DSTACK_SIMULATOR_ENDPOINT environment variable is correctly set. ```bash ls *.sock ``` ```bash echo $DSTACK_SIMULATOR_ENDPOINT ``` -------------------------------- ### View Build Artifacts Source: https://docs.phala.network/dstack/getting-started After configuring `build-config.sh`, this command re-runs the host configuration to generate build artifacts, which are then listed. ```shell ../build.sh hostcfg # If everything is okay, you should see the built artifacts in the `build` directory. $ ls certs images dstack-kms kms.toml run dstack-vmm vmm.toml dstack-gateway gateway.toml ``` -------------------------------- ### Generate Ethereum and Solana Wallets with dstack SDK Source: https://docs.phala.network/phala-cloud/phala-cloud-cli/start-from-cloud-cli This example shows how to generate an Ethereum account and a Solana keypair using the dstack Python SDK. It requires installing the SDK with all dependencies using `pip install "dstack-sdk[all]"`. ```python # First, run `pip install "dstack-sdk[all]"` to get the right dependencies. # Let’s write some code to get an ETH and SOL account. ``` -------------------------------- ### Build Script Execution Source: https://docs.phala.network/dstack/getting-started Illustrates the command to re-run the build script after configuring Certbot and Cloudflare settings. ```shell ../build.sh ``` -------------------------------- ### Build Guest Image from Source Source: https://docs.phala.network/dstack/getting-started Builds the guest image from source using the Yocto meta layer. This process can be time-consuming. ```shell # This will build the guest image from source using the yocto meta layer. This will take a while. ../build.sh guest ``` -------------------------------- ### Configuring Guest CID Pool in vmm.toml Source: https://docs.phala.network/dstack/getting-started Shows how to configure the CID start and pool size in the `vmm.toml` file to resolve guest CID conflicts. This configuration is used when building dstack from scratch or when upgrading from older versions. ```toml [cvm] cid_start = 33000 cid_pool_size = 1000 ``` -------------------------------- ### Initialize Next.js Development Environment Source: https://docs.phala.network/phala-cloud/getting-started/explore-templates/start-from-template Initializes the development environment for the Phala Cloud Next.js starter by installing dependencies with yarn and copying the example environment file. ```shell yarn cp env.local.example .env.local ``` -------------------------------- ### Install DCAP Driver Source: https://docs.phala.network/network/compute-providers/run-workers-on-khala/troubleshooting If your system encounters issues with the DCAP driver, this command manually installs the 'isgx' driver, which is a prerequisite for running `sudo phala start`. ```bash sudo phala install isgx ``` -------------------------------- ### Phala Cloud CLI Setup and Usage Source: https://docs.phala.network/phala-cloud/getting-started/start-from-cloud-cli This section covers the essential steps to set up and use the Phala Cloud CLI. It includes logging into your Phala Cloud account, generating API keys for authentication, launching a Jupyter Notebook within a CVM, and interacting with TEE native functions. It also details the installation of the Dstack SDK and the process of generating wallets for Ethereum and Solana. ```bash phala login phala api-key generate phala cvm launch --template jupyter phala call tee-native --function phala install dstack-sdk phala wallet generate --chain ethereum phala wallet generate --chain solana ``` -------------------------------- ### Example Container Log Response Source: https://docs.phala.network/dstack/getting-started Provides an example of the JSON response format when retrieving container logs with specific parameters like 'text' and 'timestamps' enabled. ```json {"channel":"stdout","message":"2024-09-29T03:05:45.209507046Z Initializing Rust backend...\n"} {"channel":"stdout","message":"2024-09-29T03:05:45.209543047Z Calling Rust function: init\n"} {"channel":"stdout","message":"2024-09-29T03:05:45.209544957Z [2024-09-29T03:05:44Z INFO rust_prover] Initializing...\n"} {"channel":"stdout","message":"2024-09-29T03:05:45.209546381Z [2024-09-29T03:05:44Z INFO rust_prover::groth16] Starting setup process\n"} ``` -------------------------------- ### Phala Cloud CLI Setup and Usage Source: https://docs.phala.network/phala-cloud/phala-cloud-cli/start-from-cloud-cli This section covers the essential steps to set up and use the Phala Cloud CLI. It includes logging into your Phala Cloud account, generating API keys for authentication, launching a Jupyter Notebook within a CVM, and interacting with TEE native functions. It also details the installation of the Dstack SDK and the process of generating wallets for Ethereum and Solana. ```bash phala login phala api-key generate phala cvm launch --template jupyter phala call tee-native --function phala install dstack-sdk phala wallet generate --chain ethereum phala wallet generate --chain solana ``` -------------------------------- ### Dstack API TDX Quote Response Example Source: https://docs.phala.network/dstack/local-development An example JSON response structure for the Get TDX Quote functionality of the Dstack API, illustrating the fields returned for application ID, instance ID, certificates, TCB information, and more. ```json { "app_id": "", "instance_id": "", "app_cert": "", "tcb_info": "", "app_name": "my-app", "public_logs": true, "public_sysinfo": true, "device_id": "", "mr_aggregated": "", "os_image_hash": "", "key_provider_info": "", "compose_hash": "" } ``` -------------------------------- ### Phala Cloud CLI Simulator Examples Source: https://docs.phala.network/phala-cloud/references/phala-cloud-cli/phala/simulator Illustrates how to use the `phala simulator` command for various tasks, including displaying help, starting the TEE simulator with different configurations (Docker or native), and stopping the simulator. ```bash # Display help phala simulator --help ``` ```bash # Start the TEE Simulator # default uses docker phala simulator start --port 8090 # run on the native host machine phala simulator start --type native ``` ```bash # Stop the TEE Simulator # default uses docker phala simulator stop --port 8090 ``` -------------------------------- ### Eliza Agent Resource Recommendations Source: https://docs.phala.network/phala-cloud/getting-started/explore-templates/launch-an-eliza-agent Recommended hardware resources for running an Eliza agent to ensure optimal performance. ```APIDOC Recommended Resources: vCPUs: 2 RAM: 4GB ``` -------------------------------- ### Run Local Phala Testnet Source: https://docs.phala.network/network/references/hackathon-guides/ethglobal-singapore Command to start a local Phala Network testnet using npm. Ensure Docker is installed and running. ```bash npm run dev ``` -------------------------------- ### Get Verification Collateral Source: https://docs.phala.network/phala-cloud/attestation/api-quickstart Retrieve the cryptographic collateral that Phala Cloud uses for quote verification. This data is essential for verifying quotes independently. ```cURL curl "https://cloud-api.phala.network/api/v1/attestations/collateral/9540fda5e6416c9d02bae726b146be58bee3caccfe7f874dbc68c808a13b1139" ``` ```APIDOC GET /api/v1/attestations/collateral/{checksum} Retrieves the cryptographic collateral used for quote verification. Parameters: - checksum (path): The unique identifier (SHA256 hash) of the quote. Returns: - An object containing collateral information required for verification. ``` -------------------------------- ### Installing Khala Solo Scripts Source: https://docs.phala.network/network/compute-providers/run-workers-on-khala Guide for deploying and managing worker nodes on the Phala Network using solo scripts. It covers prerequisites such as hardware, BIOS, and operating system setup. ```bash #!/bin/bash # This is a placeholder for installation commands. # Actual commands would be provided in the documentation. echo "Prerequisites checked. Proceeding with installation..." ``` -------------------------------- ### Initialize Python Development Environment Source: https://docs.phala.network/phala-cloud/getting-started/explore-templates/start-from-template Sets up a virtual environment using venv, activates it, installs project dependencies from requirements.txt, and copies the example environment file to .env. ```bash python -m venv venv source venv/bin/activate python -m pip install -r requirements.txt cp env.example .env ``` -------------------------------- ### Runtime Bridge Startup Process and Dependencies Source: https://docs.phala.network/network/compute-providers/run-workers-on-khala/deployment-guide-for-prbv2 Explains the startup sequence and interdependencies of Runtime Bridge services, including peer discovery mechanisms, data synchronization, and requirements for services like Redis and Data Providers. ```APIDOC Startup Process & Dependencies: - Data Providers & Lifecycle Managers discover each other via libp2p. - Initialization: Connects to blockchain, analyzes chainIdentity from parachain. - libp2p initialized with identity key and chainIdentity. - Peer discovery: mDNS and configured bootstrap nodes. - Data Provider: Starts standalone TCP server for blob syncing (performance). - Lifecycle Manager: Connects to Redis server for trade queue. - Requirements: - 1 Lifecycle Manager and 1 Trader accessing the same Redis server. - Trader must use the same identity key as Lifecycle Manager for decryption. - Lifecycle Manager does not require a Data Provider to start; waits for discovery. - HA setup for Data Providers is possible (can be stopped while Lifecycle Manager runs). - Redis persistence: Data in Redis should not be persisted; states are rebuilt from blockchain and pRuntime. - Error Handling: Restart Lifecycle Manager, Trader, and Redis server together on errors. ``` -------------------------------- ### Phala Cloud Navigation Source: https://docs.phala.network/phala-cloud/gpu/confidential-ai/gpu-tee/llm-in-tee Provides navigation links to various sections of the Phala Cloud documentation, covering getting started, TEEs, user guides, use cases, and more. ```markdown [Phala home page](https://docs.phala.network/) [discord](https://discord.gg/phala-network)[github](https://github.com/Phala-Network)[linkedin](https://linkedin.com/company/phala-network)[x](https://x.com/PhalaNetwork) Phala Cloud [Getting Started](https://docs.phala.network/phala-cloud/getting-started/overview)[TEEs, Attestation & Zero Trust Security](https://docs.phala.network/phala-cloud/attestation/overview)[Phala Cloud User Guides](https://docs.phala.network/phala-cloud/phala-cloud-user-guides/create-cvm/overview)[Be Production Ready](https://docs.phala.network/phala-cloud/be-production-ready/overview)[Use Cases](https://docs.phala.network/phala-cloud/use-cases/overview)[References](https://docs.phala.network/phala-cloud/references/overview)[Confidential AI](https://docs.phala.network/phala-cloud/gpu-tee/llm-in-tee)[FAQs](https://docs.phala.network/phala-cloud/faqs) Dstack [Overview](https://docs.phala.network/dstack/overview)[Local Development](https://docs.phala.network/dstack/local-development)[Getting Started](https://docs.phala.network/dstack/getting-started)[Hardware Requirements](https://docs.phala.network/dstack/hardware-requirements)[Acknowledgement](https://docs.phala.network/dstack/acknowledgement)[FAQs](https://docs.phala.network/dstack/faqs)[Design Documents](https://docs.phala.network/dstack/design-documents) Confidential AI [LLM in GPU TEE](https://docs.phala.network/phala-cloud/gpu/confidential-ai/gpu-tee/llm-in-tee)[GPU TEE Inference API](https://docs.phala.network/phala-cloud/gpu/confidential-ai/gpu-tee/inference-api)[Benchmark](https://docs.phala.network/phala-cloud/gpu/confidential-ai/gpu-tee/benchmark)[FAQs](https://docs.phala.network/phala-cloud/gpu/confidential-ai/gpu-tee/faqs) Network [Tech Specs](https://docs.phala.network/network/tech-specs)[References](https://docs.phala.network/network/references)[Compute Providers](https://docs.phala.network/network/compute-providers) [Powered by Mintlify](https://mintlify.com/preview-request?utm_campaign=poweredBy&utm_medium=referral&utm_source=phalanetwork-1606097b) ``` -------------------------------- ### Clone Phala Cloud Python Starter Source: https://docs.phala.network/phala-cloud/getting-started/explore-templates/start-from-template Clones the Phala Cloud Python starter repository to begin development. This command downloads the repository with a single commit history to save time and disk space. ```bash git clone --depth 1 https://github.com/Phala-Network/phala-cloud-python-starter.git ``` -------------------------------- ### Interact with Local Phala Testnet API Source: https://docs.phala.network/network/references/hackathon-guides/ethglobal-singapore Examples of making GET and POST requests to the local Phala testnet API using curl. Demonstrates querying data and sending JSON payloads. ```bash # GET request curl http://127.0.0.1:8000/local # GET request with URL queries curl http://127.0.0.1:8000/local?query1=one&query2=two # POST request curl http://127.0.0.1:8000/local -X POST -H 'content-type: application/json' -d '{"foo": "bar"}' ``` -------------------------------- ### Phala TEE Docker SDK - Remote Attestation (Python) Source: https://docs.phala.network/network/references/hackathon-guides/ethglobal-bangkok Provides an example of performing a remote attestation using the TappdClient in Python. This function is used to get a TDX quote for specified data. ```python # Tappd Client client = TappdClient(endpoint) # Remote Attestation get_remote_attestation = client.tdx_quote('data_string') ``` -------------------------------- ### Linux Setup and Simulator Execution Source: https://docs.phala.network/phala-cloud/getting-started/explore-templates/start-from-template This snippet demonstrates how to download, extract, and run the tappd-simulator on a Linux system. It involves using wget to download the archive, tar to extract it, changing the directory, and executing the simulator with a specified socket path. ```bash wget https://github.com/Leechael/tappd-simulator/releases/download/v0.1.4/tappd-simulator-0.1.4-x86_64-linux-musl.tgz tar -xvf tappd-simulator-0.1.4-x86_64-linux-musl.tgz cd tappd-simulator-0.1.4-x86_64-linux-musl ./tappd-simulator -l unix:/tmp/tappd.sock ``` -------------------------------- ### CI/CD Pipeline Setup Source: https://docs.phala.network/phala-cloud/faqs Provides a link to documentation on setting up a CI/CD pipeline for Phala Cloud instances, enabling automated deployment and management workflows. ```APIDOC CI/CD Pipeline Setup: https://docs.phala.network/phala-cloud/be-production-ready/ci-cd-automation/setup-a-ci-cd-pipeline ``` -------------------------------- ### Display Help Source: https://docs.phala.network/phala-cloud/references/phala-cloud-cli/phala/overview Displays general help information for the phala CLI. ```bash phala --help ``` -------------------------------- ### Get Stored Quote Details Source: https://docs.phala.network/phala-cloud/attestation/api-quickstart Retrieve full details about any quote stored in Phala Cloud using its checksum. This API endpoint returns a JSON object containing header, body, verification status, upload time, and checksum. ```cURL curl "https://cloud-api.phala.network/api/v1/attestations/view/9540fda5e6416c9d02bae726b146be58bee3caccfe7f874dbc68c808a13b1139" ``` ```APIDOC GET /api/v1/attestations/view/{checksum} Retrieves detailed information about a stored quote. Parameters: - checksum (path): The unique identifier (SHA256 hash) of the quote. Returns: - An object containing quote details, including header, body, verified status, uploaded_at, and checksum. ``` -------------------------------- ### Phala Cloud CLI Installation Source: https://docs.phala.network/phala-cloud/phala-cloud-cli/start-from-cloud-cli Instructions for installing and using the Phala Cloud CLI. It can be installed globally using npm, or executed directly using npx or bunx. ```bash # Skip build install globally npm install -g phala # use npx phala npx phala # or use bunx bunx phala ``` -------------------------------- ### Phala Cloud Overview and Features Source: https://docs.phala.network/index Provides an introduction to Phala Cloud, highlighting its capabilities for AI developers including confidential computing, verifiable results, privacy protection, easy deployment, and cost-effectiveness. It also links to guides for getting started and exploring core concepts. ```APIDOC Phala Cloud: Description: Confidential AI native Neocloud solution providing a secure environment for running AI applications. Features: - Confidential AI Computing: Run LLMs and AI models in GPU TEE with hardware-level security. - Verifiable Results: Cryptographic proof of genuine and unmodified AI computations. - Privacy Protection: Complete confidentiality for models, data, and algorithms. - Easy Deployment: Deploy existing Docker applications with zero code changes. - Cost Effective: Web2 pricing model with transparent, second-level billing. Getting Started: - Quick Start: Deploy your first secure application. - Phala Cloud Platform: Explore complete cloud platform features. - Confidential AI: Run LLMs in GPU TEE environments. Core Concepts: - Trusted Execution Environment (TEE): Learn how TEE provides hardware-level security. - Key Management: Secure cryptographic key generation and management. - Dstack SDK: Developer tools for building on Phala Cloud. ``` -------------------------------- ### Install Project Dependencies Source: https://docs.phala.network/network/references/hackathon-guides/ethglobal-bangkok Installs the necessary project dependencies using Yarn. Ensure you have Node.js and Yarn installed before running this command. ```bash yarn ``` -------------------------------- ### Build and Run Phala Dstack Simulator Source: https://docs.phala.network/dstack/local-development Instructions for installing Rust, cloning the Dstack repository, building the TEE simulator, and running it. The simulator creates socket files for TEE service interfaces. ```bash # Install rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Clone the repository git clone https://github.com/Dstack-TEE/dstack.git # Build the simulator cd dstack/sdk/simulator ./build.sh # Run the simulator ./dstack-simulator # The simulator will create the following socket files: # tappd.sock // Legacy TEE service interface (recommended) # dstack.sock // New TEE service interface (in development) # external.sock # guest.sock ``` -------------------------------- ### PRBv2 Deployment Guide - Archived Source: https://docs.phala.network/network/compute-providers/run-workers-on-khala Archived deployment guide for PRBv2, providing historical context for worker node setup. ```bash # Archived commands for PRBv2 deployment. ``` -------------------------------- ### Launch Jupyter Notebook Demo Source: https://docs.phala.network/phala-cloud/getting-started/start-from-cloud-cli Demonstrates how to launch a Jupyter Notebook environment on Phala Cloud using the `phala demo` command. It shows the command execution and the expected output, including CVM details and access instructions. ```bash phala demo ``` ```bash phala demo ⟳ Verifying your credentials... ✓ ✓ Logged in as hashwarlock ✔ Select a template to deploy: Jupyter Notebook ✓ Selected template: Jupyter Notebook ✔ Enter a name for your CVM: Jupyter-Notebook ℹ Preparing to deploy your CVM... ⟳ Preparing CVM configuration... ✓ ⟳ Creating your demo CVM... ✓ ✓ Demo CVM created successfully! 🎉 │ CVM ID │ 3751 \ │ Name │ Jupyter-Notebook \ │ Status │ creating \ │ App ID │ app_ecc21474f89b47a8e33ecd4e53a0ed744fff4eb2 \ │ App URL │ https://cloud.phala.network/dashboard/cvms/app_ecc21474f89b47a8e33ecd4e53a0ed744fff4eb2 \ │ Template │ Jupyter Notebook \ │ Resources │ 2 vCPUs, 2GB RAM, 20GB Storage \ │ Jupyter Token │ e4d13458163d6b8314a9d976a55600ad \ │ Access Instructions │ Access your Jupyter notebook using the token above. Go to 'Network' tab to see the public URL. \ ✓ Your demo is being created. You can check its status with: phala cvms get app_ecc21474f89b47a8e33ecd4e53a0ed744fff4eb2 ``` -------------------------------- ### Headers-cache Deployment Guide Source: https://docs.phala.network/network/compute-providers/run-workers-on-phala/archive-node-deployment Instructions for deploying the headers-cache service on the Phala Network. This guide explains the setup for caching headers. ```en https://docs.phala.network/network/compute-providers/run-workers-on-phala/headers-cache-deployment ``` -------------------------------- ### Install Net-Tools Source: https://docs.phala.network/network/compute-providers/run-workers-on-phala/prb-worker-deployment This command installs the 'net-tools' package, which provides the 'ifconfig' utility for network interface configuration. ```bash sudo apt install net-tools ``` -------------------------------- ### Launch dstack-gateway Source: https://docs.phala.network/dstack/getting-started This section describes how to launch the dstack-gateway service. It requires executing the gateway with administrator privileges and a configuration file. After launching, users can access the web portal to verify the dstack-gateway's Let's Encrypt account, whose private key is secured within the TEE. ```shell sudo ./dstack-gateway -c gateway.toml ``` -------------------------------- ### Install Docker Compose Source: https://docs.phala.network/network/compute-providers/run-workers-on-phala/prb-worker-deployment Installs Docker and Docker Compose on an Ubuntu system, which are necessary for deploying Phala Network workers. This includes updating the system and installing the required packages. ```bash sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y sudo apt install docker-compose ``` -------------------------------- ### Phala Cloud Deployment Source: https://docs.phala.network/network/compute-providers/run-workers-on-khala/solo-scripts-guidance/installing-phala-mining-tools Information and guides related to deploying and using Phala Cloud services. ```bash # Conceptual command for interacting with Phala Cloud (e.g., deploying a service) # phala-cloud deploy --service my-compute-task ``` -------------------------------- ### Verify Quote File Size and Content Source: https://docs.phala.network/phala-cloud/attestation/api-quickstart Shell commands to check the size and initial content of a quote file. TDX quotes are typically 4-6KB, while SGX quotes vary. `hexdump -C` displays the file's content in hexadecimal and ASCII, helping to identify if it starts with binary data as expected. ```shell # TDX quotes are typically 4-6KB # SGX quotes vary but usually 2-8KB ls -la quote.bin ``` ```shell # Should start with binary data, not text hexdump -C quote.bin | head -5 ``` -------------------------------- ### CVM Deployment Guide Source: https://docs.phala.network/phala-cloud/getting-started/start-from-cloud-ui This documentation outlines the process for deploying a TEE application on Phala Cloud. It requires prior completion of the account sign-up process. The guide details the steps involved in the deployment. ```APIDOC CVM Deployment: Description: This guide will walk you through deploying a TEE app step by step. Prerequisites: Sign-up for Cloud Account (https://docs.phala.network/phala-cloud/getting-started/sign-up-for-cloud-account) Steps: Follow the instructions provided in the guide to deploy your TEE application. ``` -------------------------------- ### Update System and Install Dependencies Source: https://docs.phala.network/network/compute-providers/run-workers-on-khala/troubleshooting Before reinstalling the mining script, it's recommended to update your system packages and install necessary tools like wget and unzip. ```bash sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y sudo apt install wget unzip cd ~ ``` -------------------------------- ### Dstack Components Overview Source: https://docs.phala.network/dstack/getting-started This documentation entry provides an overview of the core components within the Dstack architecture, explaining the function of each service in managing and securing confidential applications within TEEs. ```APIDOC Dstack Components: dstack-vmm: Description: A service running in a bare TDX host to manage Confidential Virtual Machines (CVMs). Role: Manages the lifecycle and execution environment of CVMs on the host. dstack-gateway: Description: A reverse proxy designed to forward TLS connections to CVMs. Role: Facilitates secure external communication with applications running inside CVMs, handling TLS termination. dstack-kms: Description: A Key Management Service (KMS) server. Role: Generates and manages cryptographic keys necessary for CVMs, ensuring secure data handling and operations. dstack-guest-agent: Description: A service operating within a CVM. Role: Serves containers' key derivation and attestation requests, enabling secure operations and verification of the TEE environment. meta-dstack: Description: A Yocto meta layer. Role: Used for building CVM guest images, providing a structured way to manage the software stack for the TEE environment. ``` -------------------------------- ### Download and Run DStack Simulator Source: https://docs.phala.network/phala-cloud/getting-started/explore-templates/start-from-template Downloads the DStack simulator for macOS or Linux, extracts the archive, and runs the simulator. The simulator listens on a Unix socket for communication. ```bash # Mac wget https://github.com/Leechael/tappd-simulator/releases/download/v0.1.4/tappd-simulator-0.1.4-aarch64-apple-darwin.tgz tar -xvf tappd-simulator-0.1.4-aarch64-apple-darwin.tgz cd tappd-simulator-0.1.4-aarch64-apple-darwin ./tappd-simulator -l unix:/tmp/tappd.sock # Linux wget https://github.com/Leechael/tappd-simulator/releases/download/v0.1.4/tappd-simulator-0.1.4-x86_64-linux-musl.tgz tar -xvf tappd-simulator-0.1.4-x86_64-linux-musl.tgz cd tappd-simulator-0.1.4-x86_64-linux-musl ./tappd-simulator -l unix:/tmp/tappd.sock ``` -------------------------------- ### Install Dstack SDK for JavaScript Source: https://docs.phala.network/dstack/local-development Installs the Dstack SDK for JavaScript using npm, which provides client-side access to the Dstack API for TEE functionalities. ```bash npm install @phala/dstack-sdk ``` -------------------------------- ### Download and Install Phala Mining Scripts Source: https://docs.phala.network/network/compute-providers/run-workers-on-khala/troubleshooting This sequence downloads the latest mining scripts, unzips them, cleans up the downloaded archive, navigates into the script directory, and then executes the installation. ```bash wget https://github.com/Phala-Network/solo-mining-scripts/archive/refs/heads/main.zip unzip main.zip rm -r main.zip #cleaning up the installation cd solo-mining-scripts-main/ #note this depends on your current directory sudo ./phala.sh install ```