Polkadot Blockchain Academy

Cambridge 2022

This repository contains all student materials for the Cambridge 2022 Polkadot Blockchain Academy.

Table of contents

Student Informational Materials

An assortment of key student information documents for the Academy exist in th ./materials/0-Student-Life/ directory.

Shared Notes

Th class has shared, collaborative, and curated lesson notes accessible here:

PBA Cambridge 2022 - Shared Notes

Please use commenting mode to add your notes per class (this can be anonymous, use a private tab 😉). Feel free to add comments on anything here as well in a comment element (highlight text, ctrl+alt+m) too.

Some ideas of things to include in these notes:

  • Useful links, related to the lesson
  • References
  • Ideas that come to mind
  • Questions you had
  • Feedback about the lesson
  • Suggestions to improve

Lesson slides with Reveal.js

If this is your first time using reveal.js, we encourage you to explore the official demo to see what sort of things you can do with it! The Academy slides created using reveal-md: a tool built with reveal.js to allow for Markdown only slides, with a few extra syntax items to make your slides look and feel awesome with very little effort.

Slides Quick Start

You will want an HTTP server to display the slides. There are many to choose from, here we suggest using a JavaScript one managed by Yarn.

Have nvm and yarn already installed? All you need to do is execute this from the top level directory of this repository:

# Ensure you have the right node
nvm i
# For yarn 3, you need to enable some node features
corepack enable
# Install Dependencies
yarn
# Run a slide server watching for file changes
yarn start

This should open a new tab with a listing of all slide decks to choose from. Please start with the "How to use Reveal slides" guide to see what is possible with the slides features and some template slides.

If you are missing node or yarn, please install them as described below. (click to toggle)

Node.js

For all linux and mac users We suggest to use nvm to install and manage multiple node versions. With nvm installed, from the academy top level dir:

nvm install

This will install (if needed) and set the correct version to use for this project set in the .nvmrc file here.

If you choose to not use nvm, you need node of version greater than 16.10. It is likely your package manager has this version for you.

Yarn

Please see the official guide to install for yarn 3. Likely all you need to do is:

corepack enable

The only dependencies we need for this project can now all be installed with:

yarn

Run to view slides

Running this command will open a new browser tab and watch for file changes (update on every time you save a file in this repo):

yarn start

Viewing slides

Here are the basic ways to navigate through presenting your slides:

  • Use down/up arrow keys to navigate vertical slides.
  • Use left/right arrow keys to navigate horizontal slides.
  • Press Esc or o to see an overview view that your arrow keys can navigate. This allows you to click a slide to open it).
  • Press s to open up speaker view - this includes speaker notes that have extra information! You will want to

Exercises, workshops and activities

The academy is focused on practical application of Web3 concepts we cover, more than simply understanding. Each lecture may have a set of exercises, workshops and/or activities. Here is how we define these:

  • Exercises: these are short (5-10 minutes) exercises that are included as part of the slide deck and will be completing during the lecture.
  • Workshops: these are step-by-step, longer (30 min to 3 hours) guided in-class material. These are instructor lead, and hand-held to get everyone to the same result.
  • Activities: these are self-directed assignments for individuals and/or small groups that do not "hand-hold" like workshops. Student's completed work is expected to have some variety and a canonical solutions should be produced to review when students submit to compare to.

Related materals will be made available in the ./materials/ directory in this repository

Rust Jupyter notebooks with EvCxR

REPLs are a fantastic way to experiment with a language interactively. evcxr_jupyter uses Jupyter Notebooks for interactive documents with a built-in REPL.

Please watch this Jupyter 101 demo video to get to know the basics before proceeding

Quick start

  1. Install evcxr_jupyter
  2. Open any *.ipynb in this repository with the tool of your choice:
  • The easiest and likely to be suggested to students use notebooks is the VSCode plugin. Install by searching for this plugin (@id:ms-toolsai.jupyter) in the VSCode extensions menu. Once installed, as with evcxr_jupyter installed, you can select the Rust kernel and start interacting with Rust-based notebooks like the example.
  • Best-in-class support is Jupyter Lab over the vanilla notebooks tooling and VSCode. Installation described here.

Note that sadly rust-analyzer does not work with notebooks at this time.

Stand-alone Rust Workshops and Activities

For non-trivial Rust work, it's best to use a full IDE and cargo properly, over the REPL examples discussed above. For these, we have dedicated crates that stand alone for each workshop or activity.

Local IDE

We suggest using VSCodium as it's most all-around featureful for academy work more than just Rust itself.

  • We highly suggest sccache that will enable faster builds for almost all academy students! If you want to use it globally, you need to add this with the right path to your ~/.cargo/config.toml file:

    [build]
    rustc-wrapper = "<path to where>/.cargo/bin/sccache"

    Use which sccache to find the path.

  • To get more power out of sccache and maybe overall faster linking, install and use the lld linker and while notebooks using EvCxR use this by default if detected, if you want to use it globally, see this post on how to enable it. You need to add something like this to your ~/.cargo/config.toml file:

    [target.x86_64-unknown-linux-gnu]
    rustflags = [
      "-C", "link-arg=-fuse-ld=lld",
    ]

Online IDE

There are some great (but limited) options for anyone lacking the ability to do things locally, or real-time collaboration is needed.

  • REPL.it - This online IDE includes a low-powered machine to compile Rust on, but provides real-time collaboration where multiple users can follow-the-leader and edit simultaneously. It also features github integrations to save and share progress.
  • Substrate Playground - This is a Parity hosted very powerful build machine that anyone can access using a pre-compiled docker image of the base substrate node template to build on top of in an online VSCode-like IDE. The session is limited to 2 hours per user, before all data is cleared. There is no simple way to capture your work though, so this is only to be used in simple examples of substrate to iterate very quickly. Note that it is unclear if 50+ students can access this at the same time, thus please let the TAs know if you plan to use this first! We should be able to give you longer living sessions for the Academy on request.