# **Week 14: Building a Multi-Chain ERC20 Token Bridge** This week was all about building in action—the kind of week where ideas turn into working systems. We rolled up our sleeves to architect a cross-chain ERC20 token bridge, enabling seamless transfers between Base and Sepolia testnets. The challenge? Ensuring secure, trust-minimized asset movement while handling blockchain finality. Here’s how we tackled it. Blockchains are siloed by design, but real-world use cases demand interoperability. Our goal was to Let users move ERC20 tokens from Base to Sepolia (and vice versa). Avoid centralized custodians—make it permissionless and event-driven. Handle chain finality delays safely. ## Architecture Breakdown **Smart Contracts (Both Chains)** Token Contracts: Deployed identical ERC20 tokens on both Base and Sepolia (with mint/burn logic). Bridge Contracts: Lock/Burn: On the source chain, users lock tokens (or burn them for mint-burn bridges). Mint/Release: On the destination chain, the bridge mints/releases tokens upon proof verification. **Backend Relayer** Event Listening: Polled source chain for TokenLocked or TokenBurned events. Finality Handling: Waited for enough block confirmations to prevent reorg attacks. Proof Submission: Relayed transaction proofs to the destination chain’s bridge contract. **User Flow** User locks 100 tokens on Base → Relayer detects event → After finality, relayer triggers minting of 100 tokens on Sepolia. Key Challenges & Lessons Finality Risks: Sepolia and Base have different finality times—had to account for delays. Relayer Reliability: Designed fail-safes to prevent double-spending if the relayer crashed mid-process. Cost Optimization: Batch submissions to reduce gas fees for cross-chain transactions. Why This Matters Bridges are the highways of Web3. By building one, we: ✔️ Understood the security pitfalls (e.g., reorgs, relay trust). ✔️ Learned to coordinate contracts across chains. ✔️ Saw how event-driven backends power decentralized systems.