Skip to content

Templates Overview

Introduction

ContainerChains deployed through Tanssi are essentially parachains within the Polkadot ecosystem that are capable of interacting with the relay chain and other parachains. They also contain the necessary functionalities to support the Tanssi protocol.

As presented in the Included Templates from the Learn section, Tanssi already provides two templates to jumpstart the development process:

In this article, the required base setup and how to use the templates as a starting point to start building your Appchain are presented.

Base Setup to Connect to Polkadot

The Substrate framework, included in the Polkadot SDK, already provides out-of-the-box support for the basic functionalities every blockchain needs (such as networking, consensus, and so forth), allowing developers to build new solo chains while focusing on the runtime (state transition function) logic.

To seamlessly integrate a new Appchain into the Polkadot ecosystem, converting a solo chain into a ContainerChain, the Polkadot SDK also includes Cumulus, an extension library to make it easy.

Parachains are expected to handle their block production through their own set of collators and expose interfaces to communicate with the relay chain. This allows their state transition to be validated, thus benefiting from the shared security model, to send and receive messages to and from other Parachains, and to manage other aspects, such as:

  • Consensus - Cumulus adds the necessary functionality to allow the collators to produce, gossip, and validate the blocks, and coordinate with the relay chain to get notified about the block's finality
  • XCM - handles the ingestion and dispatch of incoming downward and lateral messages, allowing a ContainerChain to communicate and interoperate with the other sibling chains within the ecosystem
  • Runtime Upgrades - a runtime upgrade in a ContainerChain must be informed to the relay chain to allow its validators to check on the blocks produced by the collators of the ContainerChains. Cumulus notifies the upgrade to the relay chain and waits the required amount of time (blocks) before enacting the change

The provided templates already implement Cumulus, so they are ready to be customized and deployed through Tanssi to work and operate within the ecosystem without any issues.

More information about how to configure the Cumulus SDK to integrate an Appchain into Polkadot's ecosystem can be found in the official Cumulus template.

Base Setup to Support the Tanssi Protocol

Besides Cumulus, a ContanerChain must implement the following Tanssi modules to support the protocol and benefit safely from Tanssi's block production as a service:

  • Author Noting - registers the set of collators assigned to the ContainerChain by Tanssi
  • Author Inherent - Allows the collator authoring the block to include its identity to get validated and rewarded

If you don't include these modules in the ContainerChain's runtime, there won't be a method to confirm that the blocks are being generated by trustworthy collators designated by the Tanssi orchestrator. This could create a vulnerability for malicious actors to exploit and compromise the ContainerChain.

More information about Tanssi's block production as a service and the interaction between Tanssi, the relay chain, and your ContainerChain can be found in the Technical Features article.

Start Building

To start building on top of the provided templates, be it the Baseline Appchain template or the Baseline EVM (Ethereum Virtual Machine) template, the recommended approach is to fork the Tanssi repository and start adding built-in modules or custom-made modules on top of the latest release tag.

This approach comes with some advantages, such as:

  • Building on top of the latest and stable release
  • Get the Tanssi protocol already configured and included in the template runtime
  • Keep your fork up-to-date by syncing with the Tanssi upstream repository
  • Run the included tests, ensuring that block production on your ContainerChain works as intended
  • Run a local environment, spinning up a relay chain, the Tanssi orchestrator, and your ContainerChain with the included Zombienet configuration

If the templates already cover your use case needs, or after building and testing your chain, you can continue with the Deploy your ContainerChain via the Tanssi DApp article to know how to use the Tanssi DApp to register and get your chain up and running.

Last update: January 16, 2024
| Created: August 16, 2023