Use Pink Extension

Introduction

All the unique capabilities of Phat Contract is implemented in pink-extension. Informally speaking:

$ Phat\ Contract = ink! + Pink\ Extension $

It is worth noting that the Phat Contract is not a trivial extension of ink! contract since all these extra functions only work under the off-chain computation.

Pink Extension Functions

FunctionalityFunction NameQuery SupportTransaction Support
Internet Accesshttp_request
Cryptogetrandom
ecdsa_sign_prehashed
ecdsa_verify_prehashed
sign (ecdsa/ed25519)
sign (sr25519)
verify
derive_sr25519_key
get_public_key
Volatile Cachecache_set
cache_set_expire
cache_get
cache_remove
Misclog
is_running_in_command

Refer to our Phat Hello World contract to see how you can import these functions to your contract.

Crate Recommendations

The pink-extension contains the fundmental functions of 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 services with S3-API support. Your candidates include:

Cross-chain (Ethereum) Operations

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

pink-web3 provides the cross-chain operation support for Ethereum.

Other Crates

  • fat-contract-examples contains the official examples of Phat Contract. The examples are up-to-date, and may use some not-yet-released features;
  • awesome-fat-contracts collects the learning materials and some Phat Contract examples from previous hackathon submissions.

Edit this page on GitHub