In this module, we explore substrate at a more depth. First, let’s establish substrate being divided into a client and runtime.
The client and the runtime of course need to communicate. This is done through two concepts:
- Host functions: a way for the (Wasm) runtime to talk to the client. All host functions are
sp-io. For example,
sp-io::storageare the set of host functions that allow the runtime to read and write data to the on-chain state.
- Runtime APIs: a way for the client to talk to the Wasm runtime. Runtime APIs are defined
using macros and utilities in
sp-api. For example,
sp-api::Coreis the most basic runtime API that any blockchain must implement in order to be able to (re) execute blocks.
Finally, let’s expand the diagram a bit further and look at the internals of each component:
As noted the runtime contains all of the application specific logic of the blockchain. This is
usually written with
FRAME. The client, on the other hand, contains reusable and generic
components that are not specific to one single blockchain, such as networking, database, and the