Download presentation
Presentation is loading. Please wait.
Published byAlp Tandoğan Modified over 5 years ago
1
Substrate An open source framework for building blockchains
Shawn Tabrizi Software developer @ Parity Technologies Ltd. Hi, my name is Shawn Tabrizi today I will be talking to you about Substrate a really cool project we are working on at Parity Technologies
2
GitHub / Twitter: @shawntabrizi
Software Background: Identity and Authentication Cloud Infrastructure Ethereum DApp Development Substrate Development First, a little about myself. As I said, my name is Shawn and for the last 4 years I was working at Microsoft working on Cloud Identity and infrastructure. During my time there, I learned about and started developing on Ethereum. More recently I have been developing on top of Substrate, which is one of the things I will be talking to you about today. GitHub /
3
We will talk about: Substrate Rust Wasm Blockchain Upgrades
Building on Substrate To give you an overview… Today we will be talking about: Substrate Rust Wasm Blockchain Upgrades a live demo and how you can start Building on Substrate
4
A quick review of blockchains
Blockchain nodes need: Database P2P Network Consensus Algorithm Transaction Handling State Transition Function (Runtime) Block 41 Block 42 Block 43 HEADER HEADER HEADER BODY BODY BODY Blockchain is a log of state transitions All transitions are bundled in blocks each block references its parent The specific details each chain are defined by that blockchain To run a blockchain node, you need… A database to store the current state P2P network for nodes to talk Consensus algorithm for nodes to come to an agreement Transaction handling to queue and manage messages State Transition function which is the main logic of the blockchain
5
How does blockchain development happen today?
Most projects do not have the ability to get a whole team of developers to build the entire blockchain stack Instead, they fork existing projects and make modifications of the parts they want to customize Most often the underlying blockchain logic, which we call the runtime
6
Parity has a lot of blockchain building experience...
github.com/paritytech/ parity-ethereum github.com/paritytech/ parity-bitcoin github.com/paritytech/ polkadot Parity Ethereum Parity is most known for our Ethereum Client It comprises about 30% of the main network Used by enterprises such as Google and Microsoft Parity Bitcoin A robust and modular client for miners Bitcoin and the Bitcoin Cash network Polkadot A next generation, multi-chain protocol At the center is a relay chain It was through the development of the polkadot relay chain that we realized: “Hey, we have already written these pieces before… What if we could generalize the concepts, and build a framework so we don’t have to start from scratch each time…”
7
From Polkadot, came Substrate.
And so, from Polkadot, came Substrate...
8
What is Substrate? Substrate is an open source, modular, and extensible framework for building blockchains. Substrate is an open source, modular, and extensible framework for building blockchains… It is currently listed under the GPL license, but we will be switching to Apache 2 soon
9
What is Substrate? Substrate Provides: Database Layer Networking Layer
Consensus Engine Transaction Queue Library of Runtime Modules Each of which can be customized and extended. Substrate provides you with everything you need to run a blockchain out of the box. But if you need to, you can choose to customize all these components for your specific needs
10
What else do you get with Substrate?
Interchain connectivity via Polkadot Hot-swappable, pluggable consensus Light client Chain synchronisation Pub/Sub WebSocket JSON-RPC JS Libraries/Tooling Telemetry Forkless runtime upgrades Through polkadot it can talk to other chains, exchange messages, tokens, etc… You can start using substrate now, and later upgrade your chain to a new consensus algorithm Light client support for free Chain synchronization already built in Publish Subscribe websocket API which we use for… JS libraries and tooling we have already made Built in telemetry And a method to upgrade your chain logic without causing a fork
11
Built into both Wasm & native
RUNTIME Written in Rust Built into both Wasm & native governance dao staking slashing csprng parachains permissions smart contracts WEBASSEMBLY Written in Rust Built into native CONSENSUS libp2p So let’s look at the Substrate architecture You have the Wasm Interpreter, Consensus and Networking layers Written in Rust, and compiled to your native executable Then you have a runtime layer which is also written in Rust, But is compiled to both WASM and the native executable Building components of Substrate
12
Substrate is written in Rust.
Rust is a new systems programming language started by mozilla and used in firefox In fact, all of our clients: Parity-ethereum Parity-bitcoin And even our upcoming clients for Polkadot and ZCash are written in Rust.
13
Why Rust? Parity is a Rust team as much as it is a blockchain team
Rust is Safe Rust is Fast Rust is Lightweight Rust is Idiomatic Rust is Fun Rust ensures that our programs are free from: undefined behavior data races any memory safety issues. Rust is crazy fast Has zero runtime overhead It is easy to read And once you get the hang of it, can be fun to write
14
Why WebAssembly? Wasm is a platform independent executable format
Wasm is Compact Wasm is Sandboxable Wasm is Deterministic Wasm is Near Native Speed Wasm is Well Supported Was was made to be: as close to native machine code as possible while still being platform independent. Wasm is: Designed to be compact so it can easily be transferred over the web Sandboxed to protect users from buggy or malicious code Determinism is obviously incredibly important for a runtime and reaching consensus Close to machine code means close to native speed Well supported by the community, all major browsers and companies
15
Rust for Wasm ...and these two technologies work really well together!
Rust compiles directly to Wasm Native and Wasm binaries use the same runtime codebase Parity has built a Wasm interpreter in Rust Small .wasm files Rust compiles directly to wasm Which means that we can create the native and wasm binaries using a single codebase To support projects which use WASM, we built a Wasm Interpreter for Rust called wasmi And, because rust has no runtime, you do not have any extra bloat in your wasm binaries Like a garbage collector
16
Built into both Wasm & native
RUNTIME Written in Rust Built into both Wasm & native governance dao staking slashing csprng parachains permissions Wasm stored on-chain smart contracts WEBASSEMBLY Written in Rust Built into native CONSENSUS libp2p And because the WASM runtime we build is so small we can actually store it on chain And this is where the magic happens Building components of Substrate
17
Forked Blockchain Upgrades
OLD LOGIC OLD LOGIC OLD LOGIC OLD LOGIC OLD LOGIC OLD LOGIC Only a subset of nodes upgrade NEW LOGIC NEW LOGIC NEW LOGIC NEW LOGIC Traditional blockchain platforms would need to fork to do a logic upgrade When new binaries are released with updated logic Nodes would need to upgrade Not all nodes actually upgrade right away, so you get a fork For example, Ethereum’s Constantinople upgrade Which requires tons of coordination, not really suitable for distributed systems
18
Forkless Runtime Upgrades
Wasm runtime (from chain) ✘ WebAssembly Interpreter Merklised storage database Native runtime is same version as on-chain runtime? Native client environment ENTRY APIs ✔ Native runtime (from client) With Substrate, we can do something different Because our runtime is stored on chain We can actually compare the native binaries running our node To the “latest” wasm runtime stored on chain If they are the same, then we run the native code because it is faster If it is different, we will run the wasm binaries within the wasm interpreter Ensuring that all nodes stay in sync
19
Context: The CryptoKitties Craze
Cats almost broke the internet… again. Non-fungible tokens are unique CryptoKitties represents these tokens as digital pets Peak popularity in December 2017 Almost “broke Ethereum” What if Substrate was available…? I want to do a demo, but first I want to give a little context Similar to blockchains managing your token balance blockchains can allow you to track and manage unique assets (NFT) CryptoKitties is a dApp which allowed users to create, own, and trade unique tokens represented as Kitties In December of 2017, the game was so popular that it accounted for up to 25% of Ethereum traffic at peak times This caused huge delays to transactions and caused significant increases to the cost of transactions As a dApp developer, the only option at that time was to build on Ethereum What if Substrate was available at that time…?
20
Let’s do an upgrade... Live Demo
Run the Substratekitties chain without breeding Show the Substrate UI Explain kitties a little Upgrade the chain in the substrate UI Refresh the page Show breeding Breed a cat, explain
21
Substrate Collectables Workshop
Run a local Substrate node Learn about runtime development and best practices Build a working chain with UI Minimal Rust Experience Kitty by David Revoy tiny.cc/paritySubstrateWorkshop
22
So in summary… We talked about: Substrate as an open source framework for building custom blockchains Rust and Wasm as ideal technologies used to build this framework Forkless Runtime Upgrades which allows your network to stay in sync Encouraging you to make good upgrades to your chain without the social ramifications The Substrate Collectables Workshop which can enable you to start building on Substrate TODAY
23
We’re hiring! parity.io/jobs
If you found anything I talked about interesting You should check out our job listings at...
24
Parity events and updates
parity.io/newsletter You can keep up to date about events or updates By subscribing to our newsletter
25
shawn@parity.io @shawntabrizi
Questions? @shawntabrizi
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.