The multichain architecture is the organizational structure of co-existing blockchains within Plian, it contains one main chain and a number of parallel subchains. Each one of the parallel chains is secured by the nodes within it and pegged to the main chain, tying all chains together.
Plian has two types of chains, one is the main chain, which is the primary chain that everything is pegged to, and the other is subchains that help segregate network traffic for scalability and personalization.
The main chain is responsible for balance record/transfer, and storage of subchain's data. The subchains are responsible for running smart contracts. For both main chain and subchains, PI is used to pay for the transaction execution. PI in main and subchains have the same value and can be used interchangeably and transferred between chains, with the total supply of PI and generation of new supply coming from the main chain.
Each chain has its own stack consisting of consensus mechanism, transaction structure, block structure, and EVM.
In Plian, the main chain and subchains run their stacks separately across the nodes operating within them. These stacks share the same logic for most modules, such as the consensus algorithm (PDBFT), processing of transactions, block storage, execution of EVM, etc.
The difference between main chain’s and subchain’s stack is in the execution and deployment of smart contracts.
Each chain consists of the following layers:
Plian writes specific RPC logic for multi-chain with each subchain handling its own RPC requirements individually. When making RPC calls, specify chain by adding chain id in url’s path. For example, when access subchain ‘childchain-0’, the url to POST is http://pchain-node/childchain-0.
By taking advantage of the design of Ethereum’s P2P module, when a new chain is initiated, simply adding the mapping of chain and one sub protocol into ProtocolManager allows the network to adapt and route p2p messages to the proper chains.
ChainManager and CrossChainHelper
There are 2 application entities operating outside the stacks that coordinate the chains. One is ChainManager, which holds all chain’s information such as epochs, the validators list, and also manages the initializing/start process of all chains.
Another is CrossChainHelper, which is injected into every chain’s stack. When main/subchain needs to retrieve cross-chain information or call cross-chain functions, CrossChainHelper handles the request.
Two of the main hurdles for enterprise use of blockchain is the cost of operating on public blockchains (fees and scalability) and the security offered by using cheaper alternatives (economic security and decentralization). Plian solves this by enabling the creation of public or private subchains to affordably integrate blockchain into their business while benefitting from the security of a much more established blockchain network from pegging to the main chain.
Because each chain has its own processing power and independent EVM, business modules can be split apart and run independently of each other and deployed across several subchains. This enables large scale business logic that was previously unable to operate on blockchain, to be split and operate all within one blockchain network.