✍️
Technology Initiative Tracking
  • Solid POD
  • Distributed Consensus
  • Ethereum 2
  • Docker
  • MAC Tips & Tricks
  • Arduino
  • Raspberry Pi
  • ZenCode
  • WASM
  • Substrate Framework
    • Substrate Runtime Developer Academy Course
  • Cryptography
  • Polkadot
    • Chains Actors - Who they are?
    • Crowdloan & Parachain Auctions
  • eIDAS DSS Lib
  • Dfinity
  • NFT
  • reCaptcha
  • Kubernetes
    • K8S Lab on Mac m1
Powered by GitBook
On this page
  • Reference Material
  • Substrate foundations
  • Your First Substrate-Chain
  • Adding a Pallet to the FRAME runtime on Substrate

Was this helpful?

Substrate Framework

PreviousWASMNextSubstrate Runtime Developer Academy Course

Last updated 4 years ago

Was this helpful?

Reference Material

Material

URL

Setup Rust and WASM

Create your first chain

Tutorial catalogue

Web Assembly WASM

Rust for WASM

WASM Spec

Substrate foundations

Parity company is developing massive component for Substrate:

Frame is: The Framework for Runtime Aggregation of Modularized Entities (FRAME) is a set of modules (called pallets) and support libraries that simplify runtime development. Pallets are individual modules within FRAME that host domain-specific logic, see

Pallet: set of component/module, like small lib/component for runtime function in Frame. Pallet contains a set of types, storage items, and functions that define a set of features and functionality for a runtime.

The Contract Pallet: The Contracts pallet provides functionality for the runtime to deploy and execute WebAssembly smart-contracts.

The provides low-level types, storage, and functions for your blockchain. All other pallets depend on the System library as the basis of your Substrate runtime.

Rocksdb: This is the Database used on Substrate node. This has been invented by Facebook team: , , it is based on leveldb invented at Google ()

The acts as the orchestration layer for the runtime. It dispatches incoming extrinsic calls to the respective pallets in the runtime.

The runtime library brings together all these components and pallets. It defines which pallets are included with your runtime and configures them to work together to compose your final runtime. When calls are made to your runtime, it uses the Executive pallet to dispatch those calls to the individual pallets.

Consensus mechanisms used by Substrate:

  • Babe: BABE (Blind Assignment for Blockchain Extension) is the block production mechanism that runs between the validator nodes and determines the authors of new blocks.

  • GRANDPA (GHOST-based Recursive ANcestor Deriving Prefix Agreement) is the finality gadget that is implemented for the Polkadot Relay Chain.

Your First Substrate-Chain

// https://substrate.dev/docs/en/knowledgebase/getting-started/
// Setup Rust Env on MAC:
$ brew update
$ brew install openssl cmake

// Install RUST (compiler rustc, meta data and toolchain rustup, and package manager: Cargo)
// https://rustup.rs is an installer system for RUST Programming language

$ sudo curl https://sh.rustup.rs -sSf | sh
// select 1 for Default installation
// Set CARGO_HOME environment variable
$ source ~/.cargo/env
// Configure the Rust toolchain to default to the latest stable version:
$ rustup default stable

// Install a specific Rust nightly version that is known to be compatible with the version of Substrate
$ rustup install nightly-2020-10-05 
// -->> !! issue with the 10-05, use the 10-06 > https://github.com/substrate-developer-hub/substrate-node-template/issues/90

$ rustup target add wasm32-unknown-unknown --toolchain nightly-<yyyy-MM-dd>
// run this in the project folder: /substrate/myFirstSubstrate
$ WASM_BUILD_TOOLCHAIN=nightly-2020-10-05 cargo build --release
$ rustup update
$ rustup update nightly
$ rustup target add wasm32-unknown-unknown --toolchain nightly



// Create your first substrate chain (and node with Rust compiled and WASM)
https://substrate.dev/docs/en/tutorials/create-your-first-substrate-chain/setup
// Test it: https://substrate.dev/docs/en/tutorials/create-your-first-substrate-chain/interact

Adding a Pallet to the FRAME runtime on Substrate

The is a collection of Rust macros, types, traits, and functions that simplify the development of Substrate pallets.The support macros expand at compile time to generate code that is used by the runtime and reduce boilerplate code for the most common components of a pallet.

See more on

Details is explained here:

https://github.com/paritytech
https://substrate.dev/docs/en/knowledgebase/runtime/frame
System library
https://github.com/facebook/rocksdb/wiki/RocksDB-Basics
https://rocksdb.org/docs/getting-started.html
https://github.com/google/leveldb
FRAME Executive module
FRAME Support library
https://wiki.polkadot.network/docs/en/learn-consensus
https://substrate.dev/docs/en/tutorials/add-a-pallet/
https://substrate.dev/docs/en/knowledgebase/getting-started/
https://substrate.dev/docs/en/tutorials/create-your-first-substrate-chain/setup
https://substrate.dev/tutorials
https://webassembly.org
https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm
https://webassembly.github.io/spec/core/
https://developer.mozilla.org/en-US/docs/WebAssembly