This is an intermediate level guide to help you get started with building complex DAppChains using the Substrate framework. If you are new to Substrate, we recommend you first start with any of the following beginner level tutorials to have the basic concepts covered.
- Creating a Custom Substrate chain - Fast paced, brief tutorial.
- Substrate Collectables Tutorial - Detailed tutorial and covers more concepts in depth (highly recommended).
Once you have finished one of these tutorials, you are good to go with this guide.
What does this guide cover?
This guide is intended for blockchain developers who want to build an end-to-end DAppChain solution using Substrate. This guide covers the following topics as part of building a simple Token Curated Registry, as an example.
The code for the sample TCR runtime covered in this guide is available in the Substrate-TCR GitHub repository.
The guide is divided into the following five parts.
- How to use other SRML modules in custom runtime modules
- How to use complex types in runtime storage
- How to use genesis config for Substrate modules
- How and when to use runtime events
PART 2: Unit testing the TCR module
- How to mock the runtime
- How to mock genesis config
- How to write unit tests for runtime module functions
- How to connect to the Substrate node using the Polkadot JS API
- How to bind complex types
- How to subscribe to on-chain state updates
- How to listen to Substrate runtime events
- How to sync on-chain data with an off-chain storage
PART 5: Best practices
- Avoiding economic vulnerability in runtime modules
- Error handling - Never Panic!
- When to update state (doing enough checks)