Skip to content

QuantumFusion-network/qf-polkavm-sdk

Repository files navigation

QF Network PolkaVM SDK

GitHub crates.io docs.rs
GitHub contributors GitHub commit activity GitHub last commit
License
Twitter URL

The SDK simplifies the development of native Rust smart contracts on QF Network. Smart contract functionality in QF Network is implemented using pallet-revive from Polkadot SDK / Substrate. See pallet-revive-uapi for reference documentation on the API available to smart contract developers.

To contribute to this project, please read the Contributing section.

Getting started

To create your first project using this SDK, see examples/increment-counter/README.md.

Features

Existing and planed features.

  • Simplified smart contract project compilation
  • Essentials: allocator, panic handler
  • export macro which simplifies call and deploy definitions
  • Improved storage layer API (typed / structs-based, instead of key-value API of the pallet-revive-uapi)
  • JavaScript / TypeScript client library generation
  • Contract address prediction, see #26.
  • Examples
  • Deployment and testing tools

Compile example

To compile a smart contract we need to install a correct version of polkatool (it should match chain's pallet-revive version) and run a script that configures environment and invokes it with correct arguments.

  1. Install polkatool

    cargo install --git https://github.com/paritytech/polkavm.git --tag v0.21.0 polkatool
  2. Build a smart contract from examples/increment-counter

    ./build_polkavm.sh increment-counter
  3. The *.polkavm binary for the deployment should be available at the following path

    output/increment-counter.polkavm

Debugging

Run the node with pallet-revive logs and historical state.

qf-node --dev -lerror,runtime::revive::strace=trace,runtime::revive=debug --state-pruning archive

See also https://github.com/paritytech/polkadot-sdk/blob/598feddb/substrate/frame/revive/README.md#host-function-tracing.

Contributing

We welcome contributions of all kinds! Whether you're reporting or fixing a bug, adding a feature, or improving documentation, your help is greatly appreciated. For a bug or vulnerability report please open a new issue.

For code contributions please follow these steps:

  1. Fork the repository and create a new branch following the format your-github-name/descriptive-branch-name (e.g., qf-polkavm-sdk/fix-123).
  2. Make smaller commits with clear messages to simplify reviewer's work.
  3. Submit a pull request targeting main branch and provide a concise description of your changes.

By contributing, you agree to adhere to our Contributor Covenant Code of Conduct, which fosters a respectful and inclusive environment.

We appreciate your support and look forward to your contributions! 🚀

About

Smart contracts SDK for QF Network

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors 5