Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.
For the best experience please use the latest Firefox browser.
Write a Blockchain Runtime with Parity Substrate
- Joshy Orndorff
- Parity Technologies
- 18 October 2019
- joshy@parity.io
- github.com/JoshOrndorff
My goal is to teach you about blockchains written in rust.
Used to be a teacher
Now work at Parity
Not much rust experience
Flight Plan
- Play with a Web App
- Is that Blockchain!?
- Decentralize our App
- Add a Module
- Forks and Upgrades
- Remove a Module
- Write a custom module
https://bit.ly/2pmVyls
Play with a Web App
Apps: A Multimeter for Substrate
Bonus: Browser Extension
Is that Blockchain!?
Is that Blockchain!?
Is that Blockchain!?
Decentralize our App
Compilation Steps
- Install system dependencies
sudo apt install cmake pkg-config libssl-dev git clang libclang-dev
brew install cmake pkg-config openssl git llvm
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
git clone https://github.com/substrate-developer-hub/substrate-node-template
cd substrate
scripts/init.sh
cargo build --release
Detailed
Windows instructions from Substrate Readme.
Blockchain is like Git
In the meantime, let's talk about how blockchain works.
Problem: Social coordination
Solution:
- Social Contract
- Shared History
Generate Two Keys
- sr25519 for Babe block production
- ed25519 for Grandpa finalization
Share your addresses, and REMEMBER YOUR PHRASES!
Join the Network
Download the chainspec file.
./target/release/node-template \
--chain=customSpecRaw.json \
--validator \
--name YOURNAME \
--telemetry-url ws://telemetry.polkadot.io:1024
Apps > Toolbox > RPC Calls > author > insertKey
Add Tic Tac Toe Module
- Update Code
- Cargo.toml -- dependency, std feature
- lib.rs -- impl trait, costruct_runtime, bump spec version
- Recompile
cargo build --release
- View the solution
Perform a Runtime Upgrade
Remove Sudo Module
- Update Code
- Cargo.toml -- dependency, std feature
- lib.rs -- impl trait, costruct_runtime, bump spec version
- chain_spec.rs -- config and import
- Recompile
cargo build --release
- View the solution
Upgrade same as before
No special interface this time
Custom Proof of Existence Module
Proof of Existence == Timestamped Notary Service
Certify any file Trustlessly
Roughly following this tutorial
Lots more to learn at substrate.dev