The Calimero Bridge handles the transfer of various assets, including fungible and non-fungible tokens, between the NEAR public network (Testnet or Mainnet) and Calimero. It also facilitates cross-shard contract calls, enabling interactions between public and private smart contracts.
Below is a high-level overview of the bridge's components:
The architecture of the NEAR to Calimero bridge includes the following key components:
Light Client Contract
The Light Client contract validates and accepts block headers that meet specific validation criteria, ensuring the integrity and security of the bridge's operations.
The Prover contract proves that a transaction occurred on the opposite chain (for example, on the Near side if this Prover contract is on the Calimero side). It asks the light client contract for the Merkle tree root for the specific block height, and he uses this information for the verification of the proof.
The Connector Contracts handle the transfer of specific asset types:
- FT Connector: Facilitates the transfer of fungible tokens (FT) between NEAR public networks (Testnet or Mainnet) and Calimero private shard.
- NFT Connector: Handles the transfer of non-fungible tokens (NFT) between NEAR public networks (Testnet or Mainnet) and Calimero private shard.
- Cross-shard Contract Calls Connector: handles contract pairs used to call one chain's contract methods from another chain.
The Archival Node stores all past transactions, typically spanning a longer time period (e.g., a month or week ago). It serves as a historical record of transaction data.
The Events Indexer is a crucial component that monitors the blockchain, scanning and capturing all emitted events. These events act as triggers for communication between the Near and Calimero platforms. The events include various types such as LOCK, BURN, DEPLOY, CROSS CALL, and CROSS RESPONSE. Once an event is identified as a Calimero event, it is then published to a designated message queue. Subsequently, the relayer and bridge services read the message queue, enabling them to perform their respective tasks based on the received events.
The Message Queue is used for communication between the events indexer on one side and the bridge and relayer service on the other side.
The Relayer consumes messages from the message queue and relays a new light client block header to the opposite side.
The Bridge Service receives the block where a Calimero event occurred (lock, burn, or cross-shard calls related events).
For more detailed information on each component and its functionality, refer to the subsequent sections.