How it Works
ZenBridge is a trust-minimized cross-chain bridge that enables seamless asset transfers between supported blockchains. It operates through a set of smart contracts executed by both Users and Bridge Operators, ensuring secure and decentralized transaction processing.
At the core of ZenBridge's architecture is the Bridge Indexer, which continuously listens for new on-chain events. The indexer plays a critical role in orchestrating the entire data flow, detecting transactions, processing bridge operations, and ensuring timely execution of cross-chain transfers.
Cross-Chain Transaction Flow
- The user initiates a cross-chain transaction by calling a specific function on either the ZenchainExternalBridge or ZenchainInternalBridge smart contract, depending on the source blockchain.
- The transaction emits multiple events, which are detected and indexed by the Bridge Indexer.
- Bridge Operators continuously monitor newly indexed events. Once an event is identified, they sign the transaction data and store it in ZenchainInternalBridge on the Zenchain blockchain, earning a fee for their service.
- The Bridge Indexer then detects and indexes these signed messages, ensuring they are stored on-chain.
- Through the Bridge UI, the user retrieves all required signed messages (ensuring they meet the quorum threshold) and initiates the claim process on the destination chain.
- The assets are successfully transferred to the user's wallet on the destination blockchain, completing the cross-chain transaction.
Core
The Bridge Contract (ZenchainExternalBridge or ZenchainInternalBridge, depending on the blockchain) operates in conjunction with the BridgeDirectory smart contract, which is deployed on every supported EVM blockchain.
The BridgeDirectory smart contract acts as a central registry, managing key aspects of the cross-chain bridge system, including:
- Bridge Operators & Versions: Keeps track of registered bridge operators and their respective versions.
- Supported Blockchain Networks: Maintains a list of networks integrated with the bridge.
- Token Mappings: Defines token correspondences across different blockchains, ensuring seamless asset transfers.
By leveraging the BridgeDirectory, the bridge maintains a decentralized, scalable, and secure infrastructure for cross-chain transactions.
Version
The bridge version acts as a "snapshot" of the system's state, capturing the current configuration of operators and the quorum requirements. Each cross-chain transfer is linked to a specific bridge version, ensuring consistency and security throughout the transaction process.
Quorum
A cross-chain transaction can only be executed if the number of bridge operators signing the message meets or exceeds the required quorum threshold. If the threshold is not met, the transaction remains invalid.
The EVM ecrecover precompile ensures that the signer’s address is retrieved in the most secure way possible. Because of this, the message signed by bridge operators cannot be tampered with. Any attempt to alter its contents—such as modifying the amount—would result in a completely different hash. As a consequence, the recovered address would no longer match a valid bridge operator, making the altered message invalid.