Substrate Developer Hub

Substrate Developer Hub

  • Tutorials
  • Knowledge Base
  • Recipes
  • API Reference
  • Languages iconEnglish
    • 简体中文
    • Help Translate

›Runtime

Getting Started

  • Overview
  • Installation
  • Getting Started on Windows
  • Glossary

Learn Substrate

  • Extrinsics
  • Transaction Pool
  • Account Abstractions
  • Session Keys
  • Transaction Weight
  • Off-Chain Features

Runtime

  • Runtime Overview
  • Runtime Primitives
  • FRAME
  • Pallets
  • Runtime Macros
  • Runtime Metadata
  • Runtime Storage
  • Runtime Origin
  • Runtime Execution
  • Runtime Events
  • Runtime Errors
  • Transaction Fees
  • Off-Chain Workers
  • Debugging
  • Runtime Tests
  • On-Chain Randomness
  • Runtime Upgrades

Smart Contracts

  • Overview
  • ink! Smart Contracts
  • ink! Concepts
  • ink! Development
  • EVM Pallet
  • ink! F.A.Q.

Integrate

  • Polkadot-JS
  • Client Libraries
  • Chain Specification
  • The Subkey Tool
  • Memory Profiling

Advanced

  • SCALE Codec
  • Consensus
  • The Block Import Pipeline
  • Executor
  • Cryptography
  • Storage
  • SS58 Address Format

Contribute

  • Help Translate
Edit

FRAME

The Framework for Runtime Aggregation of Modularized Entities (FRAME) is a set of modules (called pallets) and support libraries that simplify runtime development. Pallets are individual modules within FRAME that host domain-specific logic.

FRAME provides some helper modules to interact with Substrate Primitives, which provide the interface to the core client.

Overview

The following diagram shows the architectural overview of FRAME and its support libraries:

FRAME Architecture

Pallets

When building with FRAME, the Substrate runtime is composed of several smaller components called pallets. A pallet contains a set of types, storage items, and functions that define a set of features and functionality for a runtime.

FRAME Runtime

System Library

The System library provides low-level types, storage, and functions for your blockchain. All other pallets depend on the System library as the basis of your Substrate runtime.

The System library defines all the core types for the Substrate runtime, such as:

  • Origin
  • Block Number
  • Account Id
  • Hash
  • Header
  • Version
  • etc...

It also has a number of system-critical storage items, such as:

  • Account Nonce
  • Block Hash
  • Block Number
  • Events
  • etc...

Finally, it defines a number of low level functions which can access your blockchain storage, verify the origin of an extrinsic, and more.

Executive Module

The FRAME Executive module acts as the orchestration layer for the runtime. It dispatches incoming extrinsic calls to the respective pallets in the runtime.

Support Library

The FRAME Support library is a collection of Rust macros, types, traits, and functions that simplify the development of Substrate pallets.

The support macros expand at compile time to generate code that is used by the runtime and reduce boilerplate code for the most common components of a pallet.

Runtime

The runtime library brings together all these components and pallets. It defines which pallets are included with your runtime and configures them to work together to compose your final runtime. When calls are made to your runtime, it uses the Executive pallet to dispatch those calls to the individual pallets.

Benchmarking

Macro for benchmarking a FRAME runtime.

  • Docs
  • Source

Prebuilt Pallets

Some pallets will be sufficiently general-purpose to be reused in many blockchains. Anyone is free to write and share useful pallets. There is a collection of popular pallets provided with Substrate. Let's explore them.

Assets

The Assets pallet is a simple, secure module for dealing with fungible assets.

  • Docs
  • Source

Atomic Swap

A module for atomically sending funds from an origin to a target. A proof is used to allow the target to approve (claim) the swap. If the swap is not claimed within a specified duration of time, the sender may cancel it.

  • Docs
  • Source

Aura

The Aura pallet extends Aura consensus by managing offline reporting.

  • Docs
  • Source

Authority Discovery

The Authority Discovery pallet is used by core/authority-discovery to retrieve the current set of authorities, learn its own authority ID, as well as to sign and verify messages to and from other authorities.

  • Docs
  • Source

Authorship

The Authorship pallet tracks the current author of the block and recent uncles.

  • Docs
  • Source

BABE

The BABE pallet extends BABE consensus by collecting on-chain randomness from VRF outputs and managing epoch transitions.

  • Docs
  • Source

Balances

The Balances pallet provides functionality for handling accounts and balances.

  • Docs
  • Source

Benchmark

A pallet that contains common runtime patterns in an isolated manner. This pallet is not meant to be used in a production blockchain, just for benchmarking and testing purposes.

  • Docs
  • Source

Collective

The Collective pallet allows a set of account IDs to make their collective feelings known through dispatched calls from specialized origins.

  • Docs
  • Source

Contracts

The Contracts pallet provides functionality for the runtime to deploy and execute WebAssembly smart-contracts.

  • Docs
  • Source

Democracy

The Democracy pallet provides a democratic system that handles administration of general stakeholder voting.

  • Docs
  • Source

Elections Phragmén

The Phragmén Elections pallet is an election module based on sequential Phragmén.

  • Docs
  • Source

Elections

The Elections pallet is an election module for stake-weighted membership selection of a collective.

  • Docs
  • Source

Example Offchain Worker

The Offchain Worker Example: A simple pallet demonstrating concepts, APIs and structures common to most offchain workers.

  • Docs
  • Source

Example

The Example pallet is a simple example of a pallet demonstrating concepts, APIs, and structures common to most pallets.

  • Docs
  • Source

GRANDPA

The GRANDPA pallet extends GRANDPA consensus by managing the GRANDPA authority set ready for the native code.

  • Docs
  • Source

Identity

A federated naming system, allowing for multiple registrars to be added from a specified origin. Registrars can set a fee to provide identity-verification service. Anyone can put forth a proposed identity for a fixed deposit and ask for review by any number of registrars (paying each of their fees). Registrar judgements are given as an enum, allowing for sophisticated, multi-tier opinions.

  • Docs
  • Source

I'm Online

The I'm Online pallet allows validators to gossip a heartbeat transaction with each new session to signal that the node is online.

  • Docs
  • Source

Indices

The Indices pallet allocates indices for newly created accounts. An index is a short form of an address.

  • Docs
  • Source

Membership

The Membership pallet allows control of membership of a set of AccountIds, useful for managing membership of a collective.

  • Docs
  • Source

Multisig

A module for doing multi-signature dispatches.

  • Docs
  • Source

Nicks

Nicks is a trivial module for keeping track of account names on-chain. It makes no effort to create a name hierarchy, be a DNS replacement or provide reverse lookups.

  • Docs
  • Source

Offences

The Offences pallet tracks reported offences.

  • Docs
  • Source

Proxy

A module allowing accounts to give permission to other accounts to dispatch types of calls from their signed origin.

  • Docs
  • Source

Randomness Collective Flip

The Randomness Collective Flip pallet provides a random function that can be used in tests and generates low-influence random values based on the block hashes from the previous 81 blocks. This pallet is not intended for use in production.

  • Docs
  • Source

Recovery

The Recovery pallet is an M-of-N social recovery tool for users to gain access to their accounts if the private key or other authentication mechanism is lost. Through this pallet, a user is able to make calls on-behalf-of another account which they have recovered. The recovery process is protected by trusted "friends" whom the original account owner chooses. A threshold (M) out of N friends are needed to give another account access to the recoverable account.

  • Docs
  • Source

Scheduler

This module exposes capabilities for scheduling dispatches to occur at a specified block number or at a specified period. These scheduled dispatches may be named or anonymous and may be canceled.

  • Docs
  • Source

Scored Pool

The Scored Pool pallet maintains a scored membership pool where the highest scoring entities are made members.

  • Docs
  • Source

Session

The Session pallet allows validators to manage their session keys, provides a function for changing the session length, and handles session rotation.

  • Docs
  • Source

Society

The Society module is an economic game which incentivizes users to participate and maintain a membership society.

  • Docs
  • Source

Staking

The Staking pallet is used to manage funds at stake by network maintainers.

  • Docs
  • Source

Sudo

The Sudo pallet allows for a single account (called the "sudo key") to execute dispatchable functions that require a Root origin or designate a new account to replace them as the sudo key.

  • Docs
  • Source

Timestamp

The Timestamp pallet provides functionality to get and set the on-chain time.

  • Docs
  • Source

Transaction Payment

The Transaction Payment pallet provides the basic logic to compute pre-dispatch transaction fees.

  • Docs
  • Source

Treasury

The Treasury pallet provides a "pot" of funds that can be managed by stakeholders in the system and a structure for making spending proposals from this pot.

  • Docs
  • Source

Utility

A stateless module with helpers for dispatch management.

  • Docs
  • Source

Vesting

A simple module providing a means of placing a linear curve on an account's locked balance. This module ensures that there is a lock in place preventing the balance to drop below the unvested amount for any reason other than transaction fee payment.

  • Docs
  • Source

Next Steps

Learn More

  • Learn how to develop custom Substrate pallets.

Examples

  • Follow a tutorial to add a pallet to your FRAME runtime.

References

  • Visit the reference docs for the System library.

  • Visit the reference docs for the Executive pallet.

  • Visit the reference docs for the FRAME support library.

Last updated on 2/24/2021 by Dan Forbes
← Runtime PrimitivesPallets →
  • Overview
    • Pallets
    • System Library
    • Executive Module
    • Support Library
    • Runtime
    • Benchmarking
  • Prebuilt Pallets
    • Assets
    • Atomic Swap
    • Aura
    • Authority Discovery
    • Authorship
    • BABE
    • Balances
    • Benchmark
    • Collective
    • Contracts
    • Democracy
    • Elections Phragmén
    • Elections
    • Example Offchain Worker
    • Example
    • GRANDPA
    • Identity
    • I'm Online
    • Indices
    • Membership
    • Multisig
    • Nicks
    • Offences
    • Proxy
    • Randomness Collective Flip
    • Recovery
    • Scheduler
    • Scored Pool
    • Session
    • Society
    • Staking
    • Sudo
    • Timestamp
    • Transaction Payment
    • Treasury
    • Utility
    • Vesting
  • Next Steps
    • Learn More
    • Examples
    • References
Substrate Developer Hub
Developer Hub
TutorialsKnowledge BaseRecipesAPI Reference
Community
Community HomeNewsletterSubstrate Technical ChatSubstrate SeminarStack OverflowTwitterEvents
More
Substrate Builders ProgramBlogSubstrate GitHubDeveloper Hub GitHubPrivacy PolicyTerms of UseCookie Settings
Copyright © 2021 Parity Technologies