Overview
Chromia provides bridging technology for transferring tokens (ERC-20) between Ethereum-based chains and the Chromia ecosystem. The bridging mechanism relies on the Ethereum Interoperability Framework (EIF), designed to source data from EVM chains and submit transactions.
Bridge customization
The bridge supports multiple configurations depending on the token being transferred:
- Chromia Native Bridge – meant to be used for tokens that are native to Chromia. This contract overrides the deposit/withdraw functions to burn the ERC20 tokens on deposit and mint them on withdraw. This is done since the total available supply of tokens should be handled on the Chromia side, and to enable users to directly withdraw FT4 tokens to EVM without the need for tokens already being held in the contract.
- Token Bridge – the most basic bridge contract, used for depositing and withdrawing ERC20 tokens. When tokens are deposited to the TokenBridge, they are locked in the contract and minted on the Chromia side. When the user withdraws the tokens from Chromia back to EVM, the tokens are burned on the Chromia side and unlocked / transfered back to the user on the EVM side.
Bridges are protected by having withdrawal proofs signed by Chromia nodes through block headers, resembling a multi-signature setup. For tokens originating from an EVM-chain, if a majority of nodes get compromised, honest nodes can initiate a mass exit, allowing users to retrieve their balances based on a prior state. This setup makes it difficult for attackers to gain control over the bridge's balance.
For an overview of the EIF framework and the token bridge, see the diagram below:
Token Bridge components
- EVM smart contract: A smart contract running on the EVM chain. It carries the necessary business logic to process deposits to the Chromia network and the release of tokens. When users deposit tokens into the smart contract, the contract locks them and the Chromia dapp chain mints the appropriate amount. During a withdrawal, the bridge burns the tokens. Once the process is complete, the user sends proof of the burn to the EVM smart contract in awaitance for the confirmation to manually withdraw the funds.
- Event Receiver Chain: An essential component of the EIF framework, which reads the Token Bridge smart contract state and writes events to block headers.
- Dapp #1-3: Any dapp chain on Chromia can read events from the Event Receiver Chain using the ICMF protocol and process them accordingly.
The bridges use two mechanisms for each direction of the transfer. In the following example we shall refer to source chain as the chain from where the token
- Lock and mint – Lock assets on the source chain and mint assets on the destination chain.
- Burn and release – Burn assets on the destination chain and release assets on the source chain.
Lock and mint
- Deposit: On the EVM chain, users deposit tokens (ERC-20, or ERC-721 with customization) into the Token Bridge contract.
- EventReceiver reads EVM events (including block information) from the smart contract and inserts them to Rell using a special operation called __evm_block. Then sends ICMF message to the bridge chain (or publishes an ICMF message L_evm_block_events, because it is not sending, actually, it is rather a publish-subscribe mechanism).
- The bridge chain reads L_evm_block_events events from Event Receiver, parses them, decodes e.g. Deposit event, and processes it.
- Mint: The bridge mints equivalent tokens on Chromia.
When users want to move assets back to an EVM-compatible chain, the Burn and Release process is used.
Burn and release
- Burn: On Chromia, the user initiates a withdrawal -- tokens are burnt as part of the process.
- Query proof: The withdrawal event is recorded and proof is generated.
- Submit the withdraw proof: The user submits the proof to the EVM Token Bridge contract.
- Lock up period: The EVM Token Bridge verifies the proof and triggers the count down for the configured security lockup period.
- Funds redeeming: Once the security lockup period expires, the user submits the redeeming request and the bridge releases the funds.