Use Rust Crates

What Crates Can Be Used

Not every Rust crate can be used in Phat Contract. This is because the contracts are running inside the ink! runtime, which is different from operating systems like Linux. In general, there are two requirements:

  • The crate has no_std support (learn more about the differences between std and no_std);

  • The crate is in Pure Rust and does not require pre-compiled libraries.

Crate Recommendations

The pink-extension contains the fundamental functions of the Phat Contract. There are also many useful crates and repositories which make developing Phat Contract easy.

Use Storage Services

pink-s3 enables you to store data to any storage service with S3-API support. Such storage service providers include:

Cross-chain Operations

With its confidentiality and HTTP request support, you can safely store like an ETH account in Phat Contract and use it to operate an Ethereum RPC node to do any cross-chain operations. Such a pattern can be easily extended to support other blockchains.

  • pink-web3 provides the basic cross-chain operation support for EVM-compatible chains;

  • subrpc provides the basic support for Substrate-based chains;

  • stateful-rollup enables reliable cross-chain request processing based on the crates above.

Other Crates

  • phat-contract-examples contains the official examples of Phat Contract. The examples are up-to-date, and may use some not-yet-released features;

  • awesome-phat-contracts collects the learning materials and some Phat Contract examples from previous hackathon submissions.

Last updated

Logo

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