Git Product home page Git Product logo

substrate-tutorials's Introduction

Exercises to learn substrate

Who is this tutorial for?

This tutorial is for developers willing to learn the basics of Substrate development and broaden their skillsets through real-world use cases.

You will need a solid grasp of the Rust programming language before you start to learn Substrate.

Some good entry points to learning Rust πŸ“š

Β Β Β As officially referred to here, the best paths to get started with Rust are:

Β Β Β And of course, you should always challenge yourself with a side project or two.

What is Substrate?

Substrate can be described as a blockchain framework β€” specifically, a framework for building customized blockchains. It is built on the Rust programming language, which makes use of novel design patterns to enable the development of code that is safe and fast.

To give some context, Polkadot is a layer-0 protocol and multichain network laying the foundation for the future of Web3. Substrate is the primary blockchain SDK used by developers to create the parachains that make up the Polkadot network.

How to train?

  • fork this repository
  • clone it on your machine
  • code until all tests pass

If you want to run your pallet in a real runtime, you can easily edit the substrate-node-template and add your pallet to its runtime.

What's in those exercises?

We designed the exercises to teach you:

  • how to use the numerous features of Substrate
  • some good Substrate practices
  • some blockchain core principles

If you are stuck, you can always check the solution branch. It's not cheating, just learning πŸ§‘β€πŸŽ“

Thanks to our sponsors

This tutorial is made possible thanks to a grant from the Web3 Foundation. Thanks a lot to them!

substrate-tutorials's People

Contributors

a-moreira avatar andreymgn avatar asiniscalchi avatar charmstr avatar gdnathan avatar gflow33 avatar tdelabro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

substrate-tutorials's Issues

Build fails due to old substrate-node-template version

machine: aarch64-darwin

Just forked and cloned the repo and tried to the run the tests:

$ cargo t
...
   Compiling k256 v0.10.4
   Compiling num-rational v0.4.1
   Compiling num-complex v0.4.2
   Compiling approx v0.5.1
   Compiling rawpointer v0.2.1
   Compiling frame-support-procedural-tools v4.0.0-dev (https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.22#616d33ea)
   Compiling matrixmultiply v0.3.2
   Compiling nalgebra-macros v0.1.0
   Compiling primitive-types v0.11.1
error[E0603]: module `group` is private
   --> /Users/afm/.cargo/git/checkouts/substrate-7e08433d4c370a21/616d33e/frame/support/procedural/tools/src/syn_ext.rs:50:53
    |
50  |                 let syn::group::$name { token, content } = syn::group::$parse(input)?;
    |                                                                 ^^^^^ private module
    |
note: the module `group` is defined here
   --> /Users/afm/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.107/src/lib.rs:308:1
    |
308 | mod group;
    | ^^^^^^^^^

error[E0603]: module `group` is private
   --> /Users/afm/.cargo/git/checkouts/substrate-7e08433d4c370a21/616d33e/frame/support/procedural/tools/src/syn_ext.rs:50:14
    |
50  |                 let syn::group::$name { token, content } = syn::group::$parse(input)?;
    |                          ^^^^^ private module
    |
note: the module `group` is defined here
   --> /Users/afm/.cargo/registry/src/github.com-1ecc6299db9ec823/syn-1.0.107/src/lib.rs:308:1
    |
308 | mod group;
    | ^^^^^^^^^

For more information about this error, try `rustc --explain E0603`.
error: could not compile `frame-support-procedural-tools` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

--

I've seen this error before when building older versions of Substrate.
I can fix this by upgrading version to polkadot-v0.9.28 in the exercises.

Renaming storage type

The storage Account, is confusing as it is an amount of type u128 that is stored and binded to an AccountId.

Exercises ideas

Here is a list of ideas for new exercises.

  • Genesis config
  • Runtime benchmark and weight: we need to teach how to write and run the runtime benchmarks along with all the different way a weight can be calculated for an extrinsic
  • Offchain workers
  • Imbalances

404 Links in Exercises 0 and 7

Unable to test individual exercises via script on non-aarch64 machines

Sending build context to Docker daemon  2.121GB
Step 1/3 : FROM tdelabro/rusty-crewmates-substrate-tutorials:latest
 ---> 23262fd19c33
Step 2/3 : ADD ./exercises/ex00-writing-tests/  /home/substrate-tutorials/./exercises/ex00-writing-tests/
 ---> Using cache
 ---> 12d2b8623cde
Step 3/3 : CMD ["cargo", "test", "--manifest-path", "/home/substrate-tutorials/Cargo.toml"]
 ---> Using cache
 ---> de7d38fc8bcb
Successfully built de7d38fc8bcb
Successfully tagged substrate-test-exercise:latest
WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
docker: Error response from daemon: failed to create endpoint sharp_meitner on network bridge: failed to add the host (vethbfda3cd) <=> sandbox (veth9f069ae) pair interfaces: operation not supported.

I've tried different altering the run_one_excersice_tests.sh script with different --platform switches but no avail...I guess this script was only intended for people with M1 Macs? 0.0

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.