Phala Network Docs
  • Home
    • 👾Phala Network Docs
  • Overview
    • ⚖️Phala Network
      • 💎Phala Cloud
      • 🥷Dstack
      • 🔐GPU TEE
    • 💎PHA Token
      • 🪙Introduction
      • 👐Delegation
        • Delegate to StakePool
        • What is Vault
        • What is Share
        • WrappedBalances & W-PHA
        • Examples of Delegation
        • Use Phala App to Delegate
        • Estimate Your Reward
      • 🗳️Governance
        • Governance Mechanism
        • Join the Council
        • Voting for Councillors
        • Apply for Project Funding
        • Phala Treasury
        • Phala Governance
        • Setting Up an Account Identity
  • Phala Cloud
    • 🚀Getting Started
      • Sign-up for Cloud Account
      • Start from Cloud UI
      • Start from Cloud CLI
      • Start from Template
    • 🟧Launch an Eliza Agent
    • 📦Create CVM
      • Create CVM with Docker Compose
      • Create CVM with Private Docker Image
      • Set Secure Environment Variables
      • Access Your Applications
      • Setting Up Custom Domain
      • Debug Your Application
      • Deployment Cheat Sheet
    • ⚙️CVM Management
      • Upgrade Application
      • Resize Resources
      • Check Logs
      • Private Log Viewer
    • 🔄Deploy Docker App in TEE
      • Expose Service Port
      • Generate RA Report
      • Access Database
      • Create Crypto Wallet
    • 🛳️Setup a CI/CD Pipeline
    • 🛠️Phala Cloud CLI Reference
      • phala
        • auth
        • cvms
        • docker
        • simulator
    • Production Checklist
    • ❓FAQs
    • 🔍Troubleshooting
    • 📖Glossary
    • 📋References
    • 🔒Use Cases
      • TEE with AI
      • TEE with FHE and MPC
      • TEE with ZK and ZKrollup
  • Dstack
    • Overview
    • Getting Started
    • Hardware Requirements
    • Design Documents
      • Decentralized Root-of-Trust
      • Key Management Protocol
      • Zero Trust HTTPs (TLS)
    • Acknowledgement
  • LLM in GPU TEE
    • 👩‍💻Host LLM in GPU TEE
    • 🔐GPU TEE Inference API
    • 🏎️GPU TEE Benchmark
  • Tech Specs
    • ⛓️Blockchain
      • Blockchain Entities
      • Cluster of Workers
      • Secret Key Hierarchy
  • References
    • 🔐Setting Up a Wallet on Phala
      • Acquiring PHA
    • 🌉SubBridge
      • Cross-chain Transfer
      • Supported Assets
      • Asset Integration Guide
      • Technical Details
    • 👷Community Builders
    • 🤹Hackathon Guides
      • ETHGlobal Singapore
      • ETHGlobal San Francisco
      • ETHGlobal Bangkok
    • 🤯Advanced Topics
      • Cross Chain Solutions
      • System Contract and Drivers
      • Run Local Testnet
      • SideVM
    • 🆘Support
      • Available Phala Chains
      • Resource Limits
      • Transaction Costs
      • Compatibility Matrix
      • Block Explorers
      • Faucet
    • ⁉️FAQ
  • Compute Providers
    • 🙃Basic Info
      • Introduction
      • Gemini Tokenomics (Worker Rewards)
      • Budget balancer
      • Staking Mechanism
      • Requirements in Phala
      • Confidence Level & SGX Function
      • Rent Hardware
      • Error Summary
    • 🦿Run Workers on Phala
      • Solo Worker Deployment
      • PRBv3 Deployment
      • Using PRBv3 UI
      • PRB Worker Deployment
      • Switch Workers from Solo to PRB Mode
      • Headers-cache deployment
      • Archive node deployment
    • 🛡️Gatekeeper
      • Collator
      • Gatekeeper
  • Web Directory
    • Discord
    • GitHub
    • Twitter
    • YouTube
    • Forum
    • Medium
    • Telegram
  • Legacy
    • Information
    • ⚒️Phala SDK
    • 👨‍🚀Builders Program
    • 🥷AI Agent Contract
      • WapoJS Functions
      • Phala Agent Gateway
  • AI Agent Contract (Legacy)
    • 👩‍💻Getting Started
      • Build Your First AI Agent Contract
      • Build An Agent to Transact Onchain
      • Build Your AI Agent Contract with OpenAI
      • Build Your AI Agent Contract with LangChain
      • Integrate with 3rd Party API with HTTP Request
      • Run a Local Testnet With Docker
      • AI Agent Contract Templates
    • 🧙‍♂️Examples
      • Create a Weather Agent w/ Function Calling
    • ⛓️Supported Chains
    • FAQ
  • Agent Wars (Legacy)
    • 📜Introduction
    • 💸Tokenomics
    • ▶️Getting Started
      • Wallet Setup & Get PHA
      • Buy and Sell Keys
    • 🧑‍🏫Tutorial
Powered by GitBook
LogoLogo

Participate

  • Compute Providers
  • Node
  • Community
  • About Us

Resources

  • Technical Whitepaper
  • Token Economics
  • Docs
  • GitHub

More

  • Testnet
  • Explorer
  • Careers
  • Responsible Disclosure

COPYRIGHT © 2024 PHALA.LTD ALL RIGHTS RESERVED. May Phala be with you!

On this page
  • Basic Requirements
  • SGX Function
  • Device Configuration
  • OS Requirements
  • Deployment of Components
  • Preparations
  • Document Editing
  • Program Execution
  • Status Check
  • Node Check
  • Pherry Check
  • pRuntime Check

Was this helpful?

Edit on GitHub
  1. Compute Providers
  2. Run Workers on Phala

Solo Worker Deployment

PreviousRun Workers on PhalaNextPRBv3 Deployment

Last updated 1 month ago

Was this helpful?

Currently, there is no one-click deployment script for workers on Phala Network. Computation providers need to run docker compose manually for solo worker deployment.

Basic Requirements

SGX Function

Running Phala worker requires SGX-capable CPU. Please choose a device that supports SGX and enable SGX in the BIOS.

Device Configuration

Solo workers on Phala need to run 3 components: Node, pherry, and pRuntime. The requirements for each component are as follows:

Components
RAM Space
Harddisk Space
Remark

Node

4GB+

900GB+ NVME

harddisk requirement increasing, 2t will be best

pherry

2GB

0

-

pRuntime

2GB

500MB

increase slowly

Totally

8GB+

2TB

-

The number of cores of the worker needs to be 4 or more, the stronger the CPU computing power of the worker, the better the rewards in reward calculation. For details, please refer to:

OS Requirements

We strongly recommend that you use Ubuntu 22.04.2 LTS, download link: https://ubuntu.com/download/server

The desktop version of the OS is less stable than Server version, so we strongly recommend using the server version.

And please make sure that the kernel version is linux-image-5.15.0-82-generic or above, the intel-microcode should be 20230808 or above.

If you do not want to update the current Ubuntu system version, please be sure to check the kernel version. Because pRuntime will use the SGX driver built into the kernel.

After the OS is installed, we strongly recommend that you remotely connect and deploy the worker through SSH or other methods. This will help you with document input and maintenance.

Deployment of Components

Preparations

After installing the OS above, first install the necessary Docker program.

sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
sudo apt install docker-compose

Then create a folder locally, and create a docker-compose document within it.

mkdir phala-deployment
cd ./phala-deployment
touch docker-compose.yml

Document Editing

Edit the docker-compose document using the following commands:

vim ./docker-compose.yml 

After entering, you will access the document.

At this point, enter a and you will start editing the document. Paste the following content into the document. (Please note that the file content remains consistent and the indentation alignment of each line is consistent with this document)

version: "3"
services:
  node:
    image: phalanetwork/phala-node-with-launcher:latest
    container_name: node
    hostname: node
    restart: always
    ports:
     - "9944:9944"
     - "9945:9945"
     - "30333:30333"
     - "30334:30334"
    environment:
     - NODE_NAME=PNODE
     - NODE_ROLE=MINER
     - PARACHAIN_EXTRA_ARGS=--max-runtime-instances 32 --runtime-cache-size 8 --rpc-max-response-size 256
     - RELAYCHAIN_EXTRA_ARGS=--max-runtime-instances 32 --runtime-cache-size 8 --rpc-max-response-size 256
    volumes:
     - /var/phala/node-data:/root/data

  phala-pherry:
    image: phalanetwork/phala-pherry-dcap:25031701
    container_name: phala-pherry
    hostname: phala-pherry
    restart: always
    entrypoint:
      [
        "/root/pherry",
        "--parachain",
        "--mnemonic={gas fee memory seed}",
        "--substrate-ws-endpoint=ws://{node ip}:9945",
        "--collator-ws-endpoint=ws://{node ip}:9944",
        "--pruntime-endpoint=http://{pruntime ip}:8000",
        "--operator={owner address}",
        "--fetch-blocks=512",
        "--fast-sync",
        "--auto-restart"
      ]

  phala-pruntime:
    image: phalanetwork/phala-pruntime-v2-dcap-with-handover:25022401
    container_name: phala-pruntime
    hostname: phala-pruntime
    ports:
    - "8000:8000"
    devices:
    - /dev/sgx_enclave:/dev/sgx_enclave
    - /dev/sgx_provision:/dev/sgx_provision
    environment:
    - EXTRA_OPTS=--cores={core_num} --checkpoint-interval=3600
    - ROCKET_ADDRESS=0.0.0.0
    volumes:
    - /var/phala/pruntimev2:/opt/pruntime/data

Some parameters need to be customized by yourself, including:

  • In phala-pherry, replace {gas fee memory seed} in “–mnemonic={gas fee memory seed}” with the mnemonic seed of the gas fee account. For example:

    • “–mnemonic=a b c d e … h”

  • In phala-pherry, replace the {node ip} with your own node’s IP in both “–substrate-ws-endpoint=ws://{node ip}:9945” and “–collator-ws-endpoint=ws://{node ip}:9944”; Replace {pruntime ip} in “–pruntime-endpoint=http://{pruntime ip}:8000” with the IP of your own pruntime worker; If you are running these components on the same device, the easiest way is to replace them all with 127.0.0.1. For example:

    • “–substrate-ws-endpoint=ws://127.0.0.1:9945”

    • “–collator-ws-endpoint=ws://127.0.0.1:9944”

    • “–pruntime-endpoint=http://127.0.0.1:8000”

  • In phala-pherry, replace {owner address} in “–operator={owner address}” with the Phala network address of the mining pool’s main account. For example:

    • “-operator=446u…WewDEZyv”

  • In phala-pruntime, change –cores={core_num} to the number of cores of your machine, such as –cores=4.

After entering, complete the following steps to finish the text editing and save successfully.

1、Click "esc"
2、Enter ":wq"
3、Click "Enter",quit the editing page

Program Execution

Inside the newly created folder, run docker-compose, and the essential components for Solo worker will run successfully.

sudo docker-compose up -d

Status Check

Node Check

Enter the following command to get the last 100 lines of node log information

sudo docker logs node --tail 100

If you have changed the component name through customizing docker-compose.yml, please replace “node” to your customized name in the command.

A typical node log in sync will look like this:

2021-09-15 13:33:27 [Relaychain] ⚙️  Syncing 10.4 bps, target=#9236775 (20 peers), best: #9227955 (0xa897…4f36), finalized #9227895 (0x1d6d…1527), ⬇ 1.7MiB/s ⬆ 657.8kiB/s
2021-09-15 13:33:27 [Parachain] ⚙️  Syncing 40.4 bps, target=#400531 (1 peers), best: #396657 (0xb898…6c02), finalized #396443 (0xf470…2f54), ⬇ 378.7kiB/s ⬆ 1.6kiB/s

Determine whether the parachain and relaychain are synchronizing normally by judging the height of the “target”, “best”, and “finalized”.

  • Polkadot chain (relaychain) produces a block every 6 seconds.

  • Phala chain (parachain) produces a block every 12 seconds.

Pherry Check

Enter the following command to get the most recent 100 lines of Pherry log information:

sudo docker logs phala-pherry --tail 100

If you have changed the component name through customizing docker-compose.yml, please replace “phala-pherry” to your customized name in the command.

A typical pherry log will look like this:

[2023-05-10T11:18:38.733183Z INFO  pherry] get_block: Got block Some(8347280) hash 0x921c…c876
[2023-05-10T11:18:38.734430Z INFO  pherry] get_block: Got block Some(8347281) hash 0x66ca…de13
...
[2023-05-10T11:18:38.835415Z INFO  pherry] fetching parachain header 9257
[2023-05-10T11:18:38.835652Z INFO  pherry] fetching parachain header 9258
...
[2023-05-10T11:18:38.900188Z INFO  phactory_api::pruntime_client] Response: 200 OK
[2023-05-10T11:18:38.900338Z INFO  pherry] ..req_sync_para_header: SyncedTo { synced_to: 9414 }
[2023-05-10T11:18:38.900342Z INFO  pherry] batch syncing from 9229 to 9414 (186 blocks)
[2023-05-10T11:18:38.900345Z INFO  pherry] fetch_storage_changes (9229-9232)
[2023-05-10T11:18:38.905124Z INFO  pherry::prefetcher] prefetching (9233-9236)
[2023-05-10T11:18:38.905130Z INFO  pherry] fetch_storage_changes (9233-9236)
...
[2023-05-10T11:18:39.203944Z INFO  pherry] fetch_storage_changes (9415-9416)
[2023-05-10T11:18:39.209291Z INFO  phactory_api::pruntime_client] Response: 200 OK
[2023-05-10T11:18:39.209617Z WARN  pherry] Cannot find justification within window (from: 8347137, to: 8347327)
[2023-05-10T11:18:39.214032Z INFO  phactory_api::pruntime_client] Response: 200 OK
[2023-05-10T11:18:39.214046Z INFO  pherry] pRuntime get_info response: PhactoryInfo {
        initialized: true,
        registered: false,
        genesis_block_hash: Some(
            "...",
        ),
        public_key: Some(
            "...",
        ),
        ecdh_public_key: Some(
            "...",
        ),
        headernum: 8347137,
        para_headernum: 9415,
        blocknum: 9415,
        state_root: "...",
        dev_mode: false,
        pending_messages: 0,
        score: 0,
        gatekeeper: Some(
            GatekeeperStatus {
                role: None,
                master_public_key: "",
            },
        ),
        version: "2.0.1",
        git_revision: "...",
        memory_usage: Some(
            MemoryUsage {
                rust_used: 1973339,
                rust_peak_used: 9071307,
                total_peak_used: 328859648,
            },
        ),
        waiting_for_paraheaders: false,
        system: Some(
            SystemInfo {
                registered: false,
                public_key: "...",
                ecdh_public_key: "...",
                gatekeeper: Some(
                    GatekeeperStatus {
                        role: None,
                        master_public_key: "",
                    },
                ),
                number_of_clusters: 0,
                number_of_contracts: 0,
                max_supported_consensus_version: 0,
                genesis_block: 0,
            },
        ),
        can_load_chain_state: false,
    }
[2023-05-10T11:18:39.222654Z INFO  pherry] try to sync blocks. next required: (relay_header=8347137, para_header=9415, body=9415), relay finalized tip: 17850681, buffered: 191
[2023-05-10T11:18:39.223867Z INFO  pherry] get_block: Got block Some(8347328) hash 0xd305…04ff
[2023-05-10T11:18:39.226657Z INFO  pherry] get_block: Got block Some(8347329) hash 0x27f2…bc9a

You can search for issues in these logs and confirm whether the synchronization is going normally. Also, you can obtain the worker’s public key and the real-time calculated P-value (score) from them.

pRuntime Check

Enter the following command to get the most recent 100 lines of pRuntime log information:

sudo docker logs phala-pruntime --tail 100

If you have changed the component name through customizing docker-compose.yml, please replace “phala-pruntime” to your customized name in the command.

A typical pRuntime log in sync will look like this:

2023-05-10T11:55:38.478826Z  INFO phactory::prpc_service: State synced
2023-05-10T11:55:38.479089Z  INFO phactory::storage::storage_ext: Got 17 messages from OutboundMessages    
2023-05-10T11:55:38.479330Z  INFO phactory::prpc_service: Dispatching block=440838
2023-05-10T11:55:38.482465Z  INFO phactory::prpc_service: State synced
2023-05-10T11:55:38.482647Z  INFO phactory::storage::storage_ext: Got 11 messages from OutboundMessages    
2023-05-10T11:55:38.482825Z  INFO pruntime::runtime: pRPC returned code=200 size=4
2023-05-10T11:55:38.482881Z  INFO prpc_measuring: POST /prpc/PhactoryAPI.DispatchBlocks cost 18221 microseconds, status: 200   

You can determine whether the synchronization is proceeding normally by checking the synchronized height and progress.

🦿
Gemini Tokenomics