📚
Open Polkadot Bootcamp
  • 📚 About the Bootcamp
    • 📖 Additional Resources
    • 👐 Ask For Support
  • 📖 Curriculum
  • 📕Rust Programming Language
    • Basic Rust
      • Introduction to Rust
        • 🧑‍💻 Excercises
      • Common Programming Concepts
        • 🧑‍💻 Excercises
      • Program Life Cycle
        • 🧑‍💻 Excercises
      • Ownership & Borrow Checker
      • Common Data Structures
    • Advanced Rust
      • Generic types, Trait extension and Advanced types
      • Lifetime Notation
      • Smart pointers & Macros
      • Common design patterns in Rust
      • Package management & How to structure your Rust project
      • Overview of the Rust ecosystem
  • 📘Building a blockchain with Polkadot SDK
    • Polkadot
      • Additional Reads
        • Why do you want to build a blockchain on Polkadot?
        • Understanding the sharded network design of Polkadot
      • Development on Polkadot
    • Polkadot SDK
      • Substrate
        • Create a new blockchain
          • 🧑‍💻 Exercise: Clone the minimal template
          • Understanding the architecture
          • Break down the node architecture
          • Introducing to Pop CLI tool
        • Adding a custom logic to runtime
          • 🧑‍💻 Exercise: Rust State Machine
          • Components of a Pallet
          • Hooks
          • Weights & Benchmarking
          • Extensions
            • Signed Extensions
            • Transaction Extensions
        • Common runtime modules
          • 📕Example: System Pallet
          • 📕Example: Contracts Pallet
          • 📕Example: Assets Pallet
          • 📕Example: Utility Pallet
        • Runtime API and RPC
        • Runtime upgrade
        • Bump Polkadot SDK versions
      • Cumulus
        • Introduction to Cumulus
          • Parachain from scratch
          • 🧑‍💻 Exercise: Build a parachain from scratch
        • Running a local relaychain network
          • Register & reserve a parachain
          • Launch the network & run a collator node
          • Launch the network with Pop CLI
        • Agile Coretime
    • Polkadot Hub
  • 📒Smart Contract Development
    • Introduction
      • Introduction to PolkaVM
      • Getting started with Solidity development
      • Solidity File Structure
      • Contract Structure
    • Basic Solidity
      • Value types
      • Reference Types
      • Mapping Types
      • Simple Storage
    • Advanced Solidity
      • Units
      • Global Variables
      • Expression and Control Structures
      • Advanced Storage
      • Contract Tests
      • Contracts
Powered by GitBook
On this page
  1. Building a blockchain with Polkadot SDK
  2. Polkadot SDK
  3. Substrate
  4. Create a new blockchain

Understanding the architecture

PreviousCreate a new blockchainNextBreak down the node architecture

Last updated 7 months ago

We will use the Partiy minimal template for a Substrate blockchain to guide you through the concepts:

Alternative repository that you can consider reference from:

  1. Runtime

  • This file configures several pallets to include in the runtime. Each pallet configuration is defined by a code block that begins with impl $PALLET_NAME::Config for Runtime.

  1. Node

  1. Pallets

A FRAME pallet is comprised of a number of blockchain primitives, including:

  • Dispatchables: FRAME pallets define special types of functions that can be invoked (dispatched) from outside of the runtime in order to update its state.

  • Errors: When a dispatchable fails, it returns an error.

Each pallet has its own Config trait which serves as a configuration interface to generically define the types and parameters it depends on.

Code walkthrough

In Substrate, the terms "runtime" and "state transition function" are analogous. Both terms refer to the core logic of the blockchain that is responsible for validating blocks and executing the state changes they define. The Substrate project in this repository uses to construct a blockchain runtime. FRAME allows runtime developers to declare domain-specific logic in modules called "pallets". At the heart of FRAME is a helpful that makes it easy to create pallets and flexibly compose them to create blockchains that can address .

Review the included in this template and note the following:

The pallets are composed into a single runtime by way of the macro, which is part of the .

The runtime in this project is constructed using many FRAME pallets that ship with and a template pallet that is directory.

Storage: FRAME defines a rich set of powerful that makes it easy to use Substrate's efficient key-value database to manage the evolving state of a blockchain.

Events: Substrate uses to notify users of significant state changes.

Node:

Pallet registry:

Pallet configuration:

Specifying Runtime version:

Transaction signed extension:

📘
FRAME
macro language
a variety of needs
FRAME runtime implementation
construct_runtime!
core FRAME pallet library
Break down the node architecture
the Substrate repository
defined in the pallets
storage abstractions
events
https://github.com/paritytech/polkadot-sdk/tree/master/templates/minimal/node
https://github.com/paritytech/polkadot-sdk/blob/fa52407856c11ee138a32f2ba744f774fac984d5/templates/minimal/runtime/src/lib.rs#L127C1-L128C14
https://github.com/paritytech/polkadot-sdk/blob/master/templates/minimal/runtime/src/lib.rs#L184
https://github.com/paritytech/polkadot-sdk/blob/master/templates/minimal/runtime/src/lib.rs#L88
https://github.com/paritytech/polkadot-sdk/blob/master/templates/minimal/runtime/src/lib.rs#L106
https://github.com/paritytech/polkadot-sdk/tree/master/templates/minimal/
https://github.com/paritytech/polkadot-sdk-solochain-template
Overall architecture of a Substrate blockchain
Adding a new logic to the new blockchain is like playing with LEGO blocks