Giter Site home page Giter Site logo

play-substrate's Introduction

Play Substrate

A few simple pallets for learning and demo the capability of Substrate blockchain framework.

Runtime Modules

Disclaimer: these modules are for learning purpose, you should never use them in production.

  • Template Pallet, A simple module to experience simple storage data type, error handling, test and benchmark structure.
  • Proof of Existence Pallet, A simple module to store a claim (BoundedVec<u8>), revoke it, and transfer the claim to someone else. This pallet includes,
    • busisness logic to create/revoke/transfer a claim.
    • unit test of logic
    • benchmark of weights used for each dispatchables.
  • Data Type Pallet, It helps with better understanding what Rust types are supported in Substrate blockchain development.
  • Coin Flip Game Pallet, Outdated
  • Benchmark Demo, Deprecated, you can find similar code in Proof of Existence pallet.
  • Offchain Worker
    • Offchain worker - send unsigned transaction (outdated)
    • Offchain worker - send signed transaction (outdated)
  • Genesis Config Pallet, Outdated
  • Custome Weight, Outdated

Getting Started

Install Dependencies

Before you start developing with Substrate, you need to prepare your environment by following the doc.

Compile and Run

# compile the code into binary
cargo build --release

# start the compiled binary with local dev network
./target/release/node-template --dev

Connect with Front-end

Once the node template is running locally, you can connect it with Polkadot-JS Apps front-end to interact with your chain. Click here connecting the Apps to your local node template.

Test the code

# test only one pallet
cargo test -p pallet-poe

# test all the pallets
cargo test

Benchmark

Compile the node with runtime-benchmarks feature,

cargo build --release --features runtime-benchmarks

Run the benchmark for Proof of Existence pallet,

./target/release/node-template benchmark pallet --chain dev --execution wasm --wasm-execution compiled --pallet pallet_poe --extrinsic "*" --steps 20 --repeat 10 --output ./pallets/poe/src/weights.rs --template .maintain/frame-weight-template.hbs

Show all the available benchmarks,

./target/release/node-template benchmark pallet --chain dev --pallet "*" --extrinsic "*" --repeat 0

play-substrate's People

Contributors

kaichaosun avatar shawntabrizi avatar joshorndorff avatar riusricardo 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.