Comment on page


Fundamentals of Shibarium Architecture

Shibarium is a platform that enables blockchain scalability through its hybrid Plasma and PoS side chains. What stands out the most about the architecture of the Shibarium Network is its design. It features a validation layer that is generic and separate from different execution environments.
There's a three-layered architecture as the basic explanation for this architecture:
  • Heimdall
  • Bor
  • Contracts
The Ethereum layer of Shibarium Network comprises a set of contracts on the Ethereum blockchain. The second layer, Heimdall, includes a collection of Proof of Stake Heimdall nodes that work in tandem with the Ethereum main network. Heimdall plays a crucial role in monitoring staking contracts on the Ethereum layer and committing checkpoints in Shibarium Network to the Ethereum blockchain.
The Bor layer, another essential layer in Shibarium's architecture, consists of a collection of Bor nodes responsible for Bor nodes. Developers can also use the Plasma side chain of Shibarium Network to facilitate specific state transitions, addressing common precedents for ERC-20 and ERC-721 tokens, as well as asset swaps. In cases where arbitrary transitions are required, the Proof of Stake functionalities can deliver the desired benefits. The hybrid design of Shibarium's architecture highlights its flexibility in using Proof of Stake or Plasma side chains.
To activate the Proof of Stake mechanism on Shibarium, users need to deploy staking management contracts on Ethereum, followed by a collection of incentivized validators executing Heimdall and Bor nodes. While Ethereum serves as the first base chain, Shibarium plans to introduce support for more base chains. The network aims to create an interoperable and decentralized layer 2 blockchain network, following community consensus and suggestions.

Ethereum Layer

The Ethereum layer basically points to the set of smart contracts employed on Ethereum blockchain. It is one of the important requirements for activating the Proof of Stake or PoS mechanism for Shibarium. The staking management contracts take responsibility for a major share of functions driving the Shibarium Network. Some of the important functions enabled by staking contracts include,
  • Earning the staking rewards for validating state transitions on Shibarium.
  • Flexibility for anyone in staking BONE tokens for staking contracts in the Ethereum main blockchain alongside joining as a validator.
  • Features for imposing penalties and slashes for malicious activities like double signing or validator downtime.
  • The staking contracts also help in saving Shibarium Network checkpoints on the Ethereum blockchain.
  • The PoS mechanism is a critical aspect of Shibarium blockchain architecture as it works to resolve the data unavailability issues in Shibarium side chains.

Heimdall Layer

The Heimdall layer is the second entry in the three-layer architecture of Shibarium Network. It is one of the core elements in the Shibarium Network and performs many important functions. Heimdall layer helps in managing validators and selection of block producers and spans. In addition, it also works on managing the state-sync mechanism among Ethereum, Shibarium, and other important aspects of the system. Here is an overview of the important highlights of the Heimdall layer.
  • Encoder
The Encoder or Pulp is essential for verifying transactions of the Heimdall layer on the Ethereum blockchain. It leverages RLP encoding for creating special transactions such as checkpoints. The RLP-based or pulp encoding serves better functionalities in comparison to the basic amino encoding. The Pulp encoding component of Heimdall layer in Shibarium architecture leverages a prefix-based encoding mechanism for simpler solutions to interface decoding.
  • Transactions
Transactions in the Heimdall layer include metadata include in the messages and contexts responsible for initiating state changes in a module. The messages and context are triggered through the Handler of the module. Users can create transactions when they want to interact with a specific application or introduce any state changes.
It is important to note that the message of every transaction must feature a signature with the private key related to the suitable account before broadcasting it to the network. In addition, you must also include a transaction in a block and validate it, followed by approval of the network through consensus.
  • StdTx
One of the most striking components for Shibarium architects in the Heimdall layer obviously refers to StdTx. It helps in creating your own blockchain application on Shibarium network. Interestingly, the StdTx does not require fees for every transaction. Shibarium features support a limited range of transaction variants. It is also important to note that end users would not deploy any type of contract on Heimdall, thereby validating the fixed fee model.
  • Types
The important types in the Heimdall layer also serve as an integral highlight for a description of Shibarium’s architecture. You can find three types in the Heimdall layer such as PubKey, HeimdallAddress, and HeimdallHash. The HeimdallAddress type basically refers to an address on the Heimdall layer with a length of 20 bytes.
HeimdallAddress also uses the common library of Ethereum for defining the Address. PubKey refers to the public key employed in Heimdall, which is uncompressed and compatible with ECDSA. The final type, i.e., HeimdallHash, offers representation for the hash in Heimdall layer and leverages the hash of Ethereum.
  • Validators
Validators are an essential part of Shibarium architecture explained in detail as they are responsible for a larger share of work on the Heimdall layer. The Heimdall layer could change validators once a block is completed with the EndBlocker. Heimdall layer provides the description of the checkpoint numbers in between which the validator will be active.
With the EndBlocker functionality, Heimdall could procure all the active validators alongside updating the existing validator set in the concerned state. Validators serve the important function of running Heimdall nodes alongside enabling the Bor node for recording checkpoints on Ethereum blockchain.
  • Checkpoints
The next crucial aspect in Shibarium’s architecture points towards checkpoints. Checkpoints offer representation for the snapshots of Bor chain state. It must be verified by over two-thirds of the validator set before submitting the checkpoint on the staking management contracts on Ethereum main blockchain.
The other significant details in checkpoints refer to the RootHash and AccountRootHash. RootHash is basically the Merkle hash of the Bor block hashes from the starting block to the end block. The AccountRootHash is basically the hash of the information pertaining to validator account, which users must transfer to the Ethereum blockchain with each checkpoint.
  • Validator Key Management
The Shibarium architecture & design also relies heavily on validator key management in the Heimdall layer. Validators can utilize two keys for managing all validator activities on the Shibarium Network. The two keys are the signer key and the owner key. The signer key is actually the address you use for signing the Heimdall blocks and checkpoints alongside other signing activities. Private Key of the signer key would stay on the validator node for better signing. At the same time, it could not work on managing stakes, rewards, or operations associated with delegations.
On the other hand, the owner key is actually the address that helps in staking, re-staking, and modifying the signer key. The owner key also helps in withdrawing rewards alongside managing parameters pertaining to delegation. It is important to safeguard the private key of owner key by all means. In most cases, you have to store the signer key and owner key separately on different wallets. The owner key takes control over the staked funds, and the isolation of responsibilities offers a better tradeoff between ease of use and security.
  • Ante Handler
The final component in the Heimdall layer of Shibarium blockchain architecture works on checking and validating transactions. Following the verification, you can check the sender’s balance and deduct the necessary fees for including successful transactions. Ante Handler component also works on management and verification of signature in any incoming transaction.

Bor Layer

The Bor layer is the third layer in the Shibarium Network’s three-layer architecture and focuses primarily on block production. The Bor node is also referred to as the Block Producer implementation. If you look closely, the Bor node is actually the side chain operator featuring EVM compatibility.
As of now, the Bor layer is a fundamental Geth implementation with custom changes in the consensus algorithm. However, developing the implementation from scratch has helped in maintaining it as a lightweight resource. Block producers are sorted from the Validator set alongside shuffling by leveraging older Ethereum block hashes.
As the block producer layer in Shibarium architecture, the Bor layer maintains synchronization with Heimdall for selecting producers and verifiers. All the interactions for Shibarium users happen through the Bor layer. Interestingly, Bor layer also features EVM compatibility, thereby offering the flexibility for accessing Ethereum developer applications and tools. Block producers on the Bor layer are basically a committee assembled from the pool of Validators according to their stakes. The periodic selection and shuffling of block producers are also significant highlights of the Bor layer.
  • Genesis Contracts
The most prominent highlight in the functionalities of the Bor layer points to the Genesis contracts. Bor layer relies largely on the three in-built contracts, referred to as genesis contracts, available on the genesis block. The Genesis contracts include the Bor validator set, BONE ERC20 token contract, and state receiver contract.
  • Span Management
The next important aspect in the Bor layer of Shibarium refers to span management. Span refers to the logically defined block set for which you can choose a specific set of validators from available validators.
  • Bor Fee Model
The crucial highlight in the operations of Shibarium architecture & design also refers to the fee model. In the case of normal transactions, Bor layer collects fees in the form of BONE tokens and distributes them among block producers. BONE serves as the primary token for paying gas fees for Shibarium transactions as well as staking purposes. Interestingly, the fee model is a supporting factor for efficiency of Bor layer, which has an exceptional transaction speed of almost 2 to 4 seconds.