Substrate overview
The Substrate framework plays a key role in the provision of the Logos network.
This document is intended to provide a general overview of what the Substrate Framework is, how it is structured and what it was designed for.
The standalone Substrate repository has been archived since August 2023.
Parity Technologies has introduced a new repository structure.
Substrate
, Polkadot
and Cumulus
repositories have been merged into one Polkadot-SDK
repository.
In order to streamline our development process and foster better contributions, we have merged three separate repositories Cumulus, Substrate and Polkadot into this repository.
This should not impact the development of Substrate as a framework. Substrate will continue to be actively maintained as part of the Polkadot SDK, retaining its full capability to build both standalone blockchains and Polkadot-powered parachains.
Learn materials:
- Polkadot-SDK Rust Docs (opens in a new tab)
- Polkadot Blockchain Academy (opens in a new tab)
- Polkadot Blockchain Academy Materials (opens in a new tab)
- Polkadot Blockchain Academy Video Materials (opens in a new tab)
- Dot Code School: Learn to Build Web3 Applications with the Polkadot SDK (opens in a new tab)
Substrate framework
Substrate is a blockchain technology framework developed by Parity Technologies. The Substrate framework provides the flexibility and tools needed to meet the specific requirements of a blockchain, including choosing the consensus mechanism, designing the blockchain economy, implementing on-chain governance and more. The Substrate Framework and the modules it contains, known as Pallets, are written in the Rust programming language.
Polkadot-SDK (new term)
The Polkadot-SDK consists of three main parts:
- Cumulus: is a set of tools for writing Substrate-based Polkadot parachains.
- Polkadot: Implementation of a node for the Polkadot network in Rust, using the Substrate framework.
- Substrate: is the primary blockchain-SDK
Rust
Rust is known for its strong type safety and memory safety, which means that many common security issues, such as memory leaks and buffer overflows, are detected and prevented at compile time. This is particularly important in blockchain development, where security vulnerabilities can cause costly losses. Another advantage of rust is that it enables almost C-level performance, which means that programs run very quickly and efficiently. This is crucial for blockchain systems that require high performance to quickly process transactions and validate blocks. Rust also has excellent support for concurrent programming, which is essential for the development of decentralized networks and systems that need to handle many tasks simultaneously.
Substrate blockchain network
A Substrate blockchain network consists of many Substrate nodes that work together to form and operate the network. Each of these nodes runs a copy of the blockchain database and associated software that allows it to process transactions, create and validate blocks, and communicate with other nodes in the network. The collaboration of these nodes enables the network to function in a decentralized and secure manner. Decentralization is achieved by distributing the data and processing load across many different nodes, which are geographically distributed and can be managed by different operators. This structure helps to ensure censorship resistance and makes the network resistant to failures of individual nodes or attacks.
Substrate node
A Substrate Node is an instance of a blockchain that was created with the Substrate Framework. It is a single node (or server) in the blockchain network that performs specific tasks to operate and secure the network. This node stores a full or partial copy of the blockchain database and contributes to data processing, including the validation of transactions and blocks. It communicates with other nodes in the network to exchange data, including new transactions and blocks, which is essential for maintaining consensus in the network. Using the runtime component, the node executes the specific business logic of the blockchain, processes transactions and performs state transitions.
A Substrate node essentially consists of two main components: the client and the runtime. These components work together to enable the functionality of the blockchain.
Substrate Docs: Substrate node diagram (opens in a new tab)
Substrate client and runtime
Substrate Docs: Runtime (opens in a new tab)
Substrate Docs: Client outer node services (opens in a new tab)
-
Client: The client of a Substrate Node is the component that communicates with the network, validates blocks and forwards transactions. It is responsible for networking, the consensus protocol, data management and other basic functions that are necessary for the operation of the blockchain.
-
Runtime: The runtime of a substrate node is the heart of the blockchain. It defines the unique rules and logic that are specific to this blockchain. This includes the definition of accounts, transaction logics, smart contracts or other specific features of the blockchain. The runtime is compiled in WebAssembly (WASM), which means that it will be executed in the client's virtual machine at runtime. A key feature of Substrate is the ability to update the runtime without forks or network disruptions, which is referred to as "on-chain upgrade". This allows a Substrate-based blockchain to seamlessly introduce new features or improvements.
The client is the "infrastructure layer" that provides the basic functionalities such as network connections, consensus building and data persistence. It is largely standardized and provides the necessary environment for the blockchain to function properly. The runtime, on the other hand, is the "application layer" that contains the specific business logic of the blockchain. It defines how transactions are processed, the state transitions and the overall logic that determines the specific rules and behavior of the blockchain.
In summary, the client enables the blockchain to function at a basic level, while the runtime provides the specific logic and rules that define the blockchain's individual properties and functions.
client and runtime (substrate) vs. application, client and server (web2)
In web2, the term client is not the equivalent of what it represents in the substrate ecosystem and web3. In Substrate, the roles are inverted if we compare them to traditional terminology. The "client" acts more like an infrastructure (similar to a server in web2), while the "runtime" contains the specific application logic (similar to an application in web2). In the Web2 model, the server is the central node that provides both the infrastructure and the application logic, while the client is generally responsible for the user interface and interaction.
Substrate libraries
Substrate Docs: Substrate libraries (opens in a new tab)
Substrate Docs: Substrate libraries diagram (opens in a new tab)
-
Substrate primitives: contains basic types and interfaces that are used in various parts of the Substrate framework. These are generally designed so that they can function both in
no_std
environments (i.e. within the WASM runtime of the blockchain) and instd
environments (with the Rust standard library). -
Substrate Clients: contain functionalities specific to the implementation and execution of Substrate blockchain nodes, typically in the context of a blockchain validator or full node. These libraries are intended for the native execution environment (
std
) and utilize the full Rust standard library. -
Substrate FRAME/Pallets: is a framework within Substrate that enables the creation of runtimes through a collection of interoperable modules (the so-called pallets).
Pallets are modular plugins that provide specific functionalities within a Substrate runtime. Each pallet can be reused, configured and customized independently. These are also designed so that they can function both inno_std
environments and instd
environments.
In order to achieve the initial understanding faster, it is also recommended to look at the official glossaries of Substrate and Rust to understand the main concepts and structures.
Substrate glossary (opens in a new tab)
Rust glossary (opens in a new tab)