Coder Social home page Coder Social logo

sekmet / phala-blockchain Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phala-network/phala-blockchain

0.0 0.0 0.0 23.77 MB

The Phala Network Blockchain, pRuntime and the bridge.

Home Page: https://phala.network

License: Apache License 2.0

Rust 67.93% Shell 0.55% Assembly 24.81% C 3.17% Go 0.60% C++ 0.10% Perl 1.38% Batchfile 0.08% Python 0.76% Dockerfile 0.11% Makefile 0.27% Ruby 0.05% JavaScript 0.20% RenderScript 0.01%

phala-blockchain's Introduction

Phala Blockchain

Funded by the web3 foundation

Rust

Phala Network is a TEE-Blockchain hybrid architecture implementing Confidential Contract. This repo includes:

  • node/: the main blockchain built on Substrate
  • phost/: the bridge daemon to connect the blockchain and pRuntime

Overview

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:

  • phala-docs: The central repo for documentations.
  • phala-pruntime: The cotract executor running inside TEE enclaves.
  • phala-polka-apps: The Web UI and SDK to interact with confidential contract. Based on polkadot.js.
  • plibra-grant-docker: The W3F M2 docker build with the blockchain, pHost and pRuntime.

File structure

.
├── 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

Docker bulid

Plase refer to plibra-grant-docker. It includes both the blockchain and pRuntime.

Native Build

Dependencies

Expand
  • Rust

    curl https://sh.rustup.rs -sSf | sh
  • Substrate dependecies:

    cd node
    sh ./scripts/init.sh
  • LLVM 10

    wget https://apt.llvm.org/llvm.sh
    chmod +x llvm.sh
    ./llvm.sh 10

Build the blockchain and bridge

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.

Run

  1. Launch two local dev nodes Alice and Bob:

    cd node
    ./scripts/console.sh start alice
    ./scripts/console.sh start bob
    • The datadir is at $HOME/tmp/(alice|bob)
    • Can be purged by ./scripts/console.sh purge
    • The WebUI can connect to Alice at port 9944.
  2. Run pHost (please start pRuntime first):

    cd phost
    ./target/release/phost

Run with tmuxp

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.

phala-blockchain's People

Contributors

h4x3rotab avatar jasl avatar goldenfiredo avatar krhougs avatar shelvenzhou avatar dependabot[bot] avatar sekmet avatar chenyuxiaodhr avatar jeffanthony avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.