Skip to content

Leechael/fat-contract-examples

 
 

Repository files navigation

Fat Contract Examples

This repo provides examples that demonstrate Phala fat contract features.

Environment Preparation

An operating system of macOS or Linux systems like Ubuntu 18.04/20.04 is recommended for the workshop.

  • For macOS users, we recommend to use the Homebrew package manager to install the dependencies
  • For other Linux distribution users, use the package manager with the system like Apt/Yum

The following toolchains are needed:

  • Rust toolchain
    • Install rustup, rustup is the "package manager" of different versions of Rust compilers: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    • This will install rustup and cargo
  • Ink! Contract toolchain
    • Install binaryen with
      • Homebrew for macOS: brew install binaryen
      • Apt for Ubuntu: sudo apt install binaryen
      • or download the release and put it under your $PATH
    • Install dylint-link toolchain: cargo install cargo-dylint dylint-link
    • Install contract toolchain: cargo install cargo-contract --force
    • For macOS M1 chip users: rustup component add rust-src --toolchain nightly-aarch64-apple-darwin
  • Install frontend toolchain

Check your installation with

$ rustup toolchain list
# stable-x86_64-unknown-linux-gnu (default)
# nightly-x86_64-unknown-linux-gnu

$ cargo --version
# cargo 1.58.0 (f01b232bc 2022-01-19)

$ cargo contract --version
# cargo-contract 0.17.0-unknown-x86_64-linux-gnu

$ node --version
# v17.5.0

$ yarn --version
# 1.22.17

Build

Clone this repo and go to any subdirectory then make, or cargo contract build --release if there isn't a Makefile.

For example:

git clone https://github.com/Phala-Network/fat-contract-examples.git
cd fat-contract-examples/mqtt-broker
make
cd ../logging
cargo contract build --release

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 72.9%
  • JavaScript 21.3%
  • Makefile 5.3%
  • Shell 0.5%