The backend acts as a bridge coordinator — it verifies Ethereum transactions and triggers minting on Avalanche.
- Receives a call from the frontend after ETH is locked
- Scans Ethereum logs from
currentBlock - 1tocurrentBlock + 1 - Finds and verifies the event emitted by the ETH contract
- Generates a unique
lockIdfrom the transaction - Calls Avalanche contract's
backend_confirmation()function - Avalanche contract checks the mapping:
mapping(bytes32 => mapping(address => mapping(uint256 => uint8))) - If valid, it increases confirmation count
- Once confirmations reach 2, Avalanche contract calls
mint()to mint wrapped ETH
- Verifies on-chain logs to prevent fraud or spoofing
- Triggers cross-chain mint securely only when ETH is truly received
- Ensures confirmations are tracked before minting
This backend flow makes the bridge secure, verifiable, and ensures the wrapped tokens are minted only after a valid ETH deposit.
