Giter Club home page Giter Club logo

subxt-workshop's Introduction

Subxt Workshop (Polkadot Decoded 2022)

Getting Started

Install Rust

Follow the Substrate docs.

Download Polkadot

curl "https://github.com/paritytech/polkadot/releases/download/v0.9.18/polkadot" --output /usr/local/bin/polkadot --location

Instructions

Run the Polkadot node in a separate terminal:

polkadot --dev --tmp

> 2022-06-23 21:43:57 Parity Polkadot    
> 2022-06-23 21:43:57 ✌️  version 0.9.18-99cd17ddb2-x86_64-linux-gnu    
> 2022-06-23 21:43:57 ❤️  by Parity Technologies <[email protected]>, 2017-2022    
> 2022-06-23 21:43:57 📋 Chain specification: Development    
> ...

Run the test suite:

cargo test

Notice the test failures, your task is to implement the helper functions. The files in the tests/ directory are ranked in order of difficulty.

  1. Exercise 01 - Get the block number for a given block_hash.
  2. Exercise 02 - Get the free balance of an account.
  3. Exercise 03 - Sum the total frozen balance.
  4. Exercise 04 - Fetch the first n accounts from storage.
  5. Exercise 05 - Return the embedded RuntimeVersion.
  6. Exercise 06 - Transfer an amount from the signer to dest.
  7. Exercise 07 - Estimate the fees for an extrinsic using a custom RPC.
  8. Exercise 08 - Make multiple transfers in the same call.
  9. Exercise 09 - Create a spending proposal and check the deposit.
  10. Exercise 10 - Listen and approve multisig operations.

Other Notes

Refresh Metadata

This is only required if you change the node / runtime.

cargo install subxt-cli
subxt metadata -f bytes > polkadot_metadata.scale

Examine Metadata

Verbose but helpful expansion of the generated Rust code.

cargo install cargo-expand
cargo expand

Credits

Thanks to all subxt / substrate maintainers and contributors.

subxt-workshop's People

Contributors

gregdhill avatar

Stargazers

 avatar

Watchers

Alexei Zamyatin avatar  avatar  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.