Phala Network is a TEE-Blockchain hybrid architecture implementing Confidential Contract. This repo includes:
node/: the main blockchain built on Substratephost/: the bridge daemon to connect the blockchain and
pRuntime
The blockchain is the central compoent of the system. It records commands (confidential contract invocation), serve as the pRuntime registray, runs the native token and on-chain governance modules.
pHost is a daemon program that connects the blockchain and the pRuntime. It passes the block data from the chain to pRuntime and passes pRuntime side effects back to the chain.
Related repos:
.
├── LICENSE
├── README.md
├── node Blockchain node
├── pallets
│ └── phala Phala pallet
├── phost The bridge deamon "pHost"
├── pruntime pRuntime, the TEE kernel
├── ring Patched ring with wasm support
├── runtime Phala Substrate Runtime
└── scripts
├── console.sh Helper script to build & run the blockchain
└── init.sh
Plase refer to plibra-grant-docker. It includes both the blockchain and pRuntime.
Expand
bash
curl https://sh.rustup.rs -sSf | sh
bash
cd node
sh ./scripts/init.sh
bash
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
./llvm.sh 10
Make sure you have Rust and LLVM-10 installed.
cargo build --release
The build script enforces LLVM-9 or newer is used. LLVM-9 is needed because of the wasm port of rust
crypto library, ring. We have to compile the C code into wasm while keeping the compatibility with
the current rustc.
Launch two local dev nodes Alice and Bob:
bash
cd node
./scripts/console.sh start alice
./scripts/console.sh start bob
$HOME/tmp/(alice|bob)./scripts/console.sh purgeRun pHost (please start pRuntime first):
bash
cd phost
./target/release/phost
You can launch the full stack (semi-automatically) by:
tmuxp load ./scripts/tmuxp/three-nodes.yaml
Or a 4-node testnet-poc2 setup:
CHAIN=poc2 tmuxp load ./scripts/tmuxp/four-nodes.yaml
tmuxp is a convinient tool that can bring up a tmux session with the preconfigured commands running in panes. To play with tmuxp, it also need a tmux installed.
$ claude mcp add phala-blockchain \
-- python -m otcore.mcp_server <graph>