1 of 27

Dan Shields

Support Eng. @ Parity.io

Steward @ Cryptorado.org

@nukemandan // dan.shields@parity.io

Presentation Adapted from Joshy Orndorff (github.com/joshorndorff).

Extensible, Modular, Frameworks in Rust: Substrate's Approach for Blockchains

2 of 27

A quick review of blockchains

Blockchain nodes need:

  • Database
  • P2P Network
  • Block Authoring
  • Fork Choice Rule
  • Transaction Handling
  • State Transition Function (Runtime)

BODY

Block 42

HEADER

BODY

Block 43

HEADER

BODY

Block 41

HEADER

Block 41

3 of 27

Parity has a lot of blockchain building experience...

github.com/openethereum/

OpenEthereum

github.com/paritytech/

parity-bitcoin

github.com/paritytech/

polkadot

4 of 27

From Polkadot, came Substrate.

5 of 27

What is Substrate?

Substrate is an open source, modular, and extensible framework for building blockchains.

( )

6 of 27

What is Substrate?

Substrate provides all the core components of a Blockchain:

  • Database Layer
  • Networking Layer
  • Transaction Queue
  • Consensus Engine
  • Library of Runtime Modules

Each of which can be customized and extended.

7 of 27

Substrate is built using Rust and Wasm.

+

8 of 27

Architecture of a Substrate Node

libp2p

Written in Rust

Built into Wasm�(& native)

Written in Rust

Built into native

5

Application logic that makes this chain special

Runtime

Tx Pool

jsonRPC

Consensus

Block Storage

9 of 27

The Substrate Runtime

The runtime is the block execution logic of the blockchain, a.k.a. the State Transition Function.

5

sudo

grandpa

indices

system

babe

balances

It is composed of Pallets.

RUNTIME

Mix and Match Pallets

assets

babe

balances

collective

contracts

democracy

elections

grandpa

evm

grandpa

indices

membership

offences

session

staking

sudo

system

timestamp

treasury

and more...

timestamp

10 of 27

Official FRAME Pallets

Nick’s Pallet Tutorial

Example Node Template

UI to Interact (apps)

(this branch w/ nick’s added)

Substrate Hands-on!

11 of 27

Tutorials and More

Join Substrate’s

Matrix Channel

Substrate.dev

    • substrate.dev/tutorials
      • Basics
    • substrate.dev/recipes
      • Forkable Examples
    • substrate.dev/seminar
      • Tuesday Live Event

12 of 27

Recap most recent dev conference ^^

Keynote is great overview: https://www.crowdcast.io/e/axvfinsv/2

13 of 27

Earn while you learn!

Cash prizes!

14 of 27

Dan Shields

Support Eng. @ Parity.io

Steward @ Cryptorado.org

@nukemandan // dan.shields@parity.io

The Local Blockchain Community:

Cryptorado.org

    • Bi-weekly meetups
    • Discord chat
    • Ongoing projects

15 of 27

Additional Slides

16 of 27

Analogy: Blockchains as Computers

Think of a blockchain network as a single computer with many simultaneous users

...a mainframe

Use Substrate to design optimized computers

…with easy networking between computers

17 of 27

Substrate enables creation of

a network of Blockchains.

Each optimized for a specific purpose

18 of 27

19 of 27

20 of 27

Custom built, optimized, computers

Communicate via a relay

Single machine, with

only EVM smart contracts

21 of 27

Write Parachains with Substrate

Cumulus turns your runtime into a Polkadot Parachain:

  • Outsource (some of) your security
  • Cumulus Collator as runtime nodes
  • Polkadot Validation/Msgs

In progress...

Parachain

Parachain

22 of 27

Architecture of Polkadot

Relay Chain

23 of 27

Architecture of a Substrate Node

libp2p

Written in Rust

Built into Wasm�(& native)

Written in Rust

Built into native

5

Application logic that makes this chain special

Runtime

Tx Pool

jsonRPC

Consensus

Block Storage

24 of 27

Substrate Consensus

Who may author new blocks and when?

When are blocks considered final?

Consensus

Authoring

Finality

PoW

Grandpa

Aura

Cumulus / Polkadot

Babe

Sassafras

Manual Seal

Aura

Grandpa

25 of 27

Hard Fork Upgrades

Some nodes upgrade their software

OLD LOGIC

OLD LOGIC

OLD LOGIC

OLD LOGIC

OLD LOGIC

OLD LOGIC

NEW LOGIC

NEW LOGIC

NEW LOGIC

NEW LOGIC

26 of 27

Forkless Upgrades

Upgrade is processed� On Chain

OLD LOGIC

OLD LOGIC

OLD LOGIC

NEW LOGIC

NEW LOGIC

NEW LOGIC

27 of 27

Governing Runtime Upgrades

  • Runtime code is accessible through on-chain governance
  • Sudo Pallet
  • Democracy Pallet
  • Your own pallet and logic
  • Runtime Upgrades are Optional