Runtime Development
Developing runtime
Getting Started
First, make sure you have the CLI tool installed globally. To start the runtime development, first initialise a new Subsembly
project:
Subsembly
File Structure
Subsembly
File StructureNewly initialised Subsembly
project has the following file structure:
Runtime configuration
Top-level runtime folder consists of Runtime API entries that are exposed to the Host. Some functions of API are general to the blockchain, such as block production, execution, extrinsic submission and some others are specific to the module, such as Aura
authorities. There is also, runtime.ts
file, where types and constants for the frame modules and pallets are defined. We define general types that are used across the runtime and also pallet specific constants and types.
Some requirements for Runtime types, such as:
Type should implement
Codec
interface fromas-scale-codec
. It makes sure that every type in the Runtime can be SCALE encoded and decoded.Make sure to avoid possible
IntegerOverflow
exceptions. For example, it does not make sense to use 8-bit unsigned integer asTimestamp
Moment
type, since the value of timestamp is way out of range of what 8-bit unsigned integer can hold.
Compiling
To compile the runtime:
This should compile your runtime and place hex-encoded wasm
binary to the build
folder.
Last updated