Seamless cross-chain payments across 8 blockchain networks
π Live Demo β’ π Documentation β’ π§ Deploy β’ π€ Contribute
Midway is a revolutionary cross-chain payment infrastructure that enables seamless token transfers and balance management across multiple blockchain networks. Think of it as a universal wallet that abstracts away the complexity of managing assets across different chains.
- π Unified Balance Management - Single balance tracked across all chains
- β‘ Instant Cross-Chain Transfers - No bridges, no waiting
- π° Gas Optimization - Deposit on cheap chains, withdraw anywhere
- π‘οΈ Secure Architecture - Battle-tested smart contracts
- π Multi-Chain Native - Built for a multi-chain future
Midway operates on a hub-and-spoke model with Optimism Sepolia as the central hub:
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Ethereum β β Base Sepolia β β Polygon Amoy β
β Sepolia β β β β β
β βββββββββββββ β β βββββββββββββ β β βββββββββββββ β
β β MidPay ββββΌβββββΌββΊβ MidPay ββββΌβββββΌββΊβ MidPay β β
β β Client β β β β Client β β β β Client β β
β βββββββββββββ β β βββββββββββββ β β βββββββββββββ β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β² β² β²
β β β
βββββββββββββββββββββββββΌββββββββββββββββββββββββ
βΌ
βββββββββββββββββββββββββββ
β Optimism Sepolia β
β (Core Hub) β
β βββββββββββββββββββ β
β β MidPay Core β β
β β (Balances & β β
β β Management) β β
β βββββββββββββββββββ β
β β
β βββββββββββββββββββ β
β β Cross-Chain β β
β β Relayer β β
β βββββββββββββββββββ β
βββββββββββββββββββββββββββ
Component | Location | Purpose |
---|---|---|
MidPay Core | Optimism Sepolia | Central balance management & coordination |
MidPay Client | All other chains | Local operations & message routing |
External Routers | All chains | Cross-chain message passing |
Cross-Chain Relayer | Off-chain service | Automated message relay between chains |
Chain | Chain ID | Status | Features |
---|---|---|---|
π΄ Optimism Sepolia | 11155420 | β Hub | Core contracts, balance management |
β« Ethereum Sepolia | 11155111 | β Active | Full deposit/withdraw support |
π£ Zora Sepolia | 999999999 | β Active | NFT-focused ecosystem integration |
π΅ Base Sepolia | 84532 | β Active | Coinbase L2 integration |
π Polygon Amoy | 80002 | β Active | Low-cost transactions |
π Worldchain Sepolia | 4801 | β Active | Identity-verified network |
ποΈ Ink Sepolia | 763373 | β Active | Creator economy focus |
π¦ Unichain Sepolia | 1301 | β Active | DeFi-optimized network |
sequenceDiagram
participant User
participant ChainA as Any Chain
participant Core as Optimism Core
participant Relayer
User->>ChainA: Deposit FUSD
ChainA->>ChainA: Lock tokens locally
ChainA->>Relayer: Send cross-chain message
Relayer->>Core: Update balance on Optimism
Core->>Core: Credit user account
Core->>User: Balance updated β
sequenceDiagram
participant User
participant ChainB as Target Chain
participant Core as Optimism Core
participant Relayer
User->>ChainB: Request withdrawal
ChainB->>Relayer: Send withdrawal message
Relayer->>Core: Verify & debit balance
Core->>Relayer: Confirm withdrawal
Relayer->>ChainB: Execute token release
ChainB->>User: Tokens transferred β
- External Routers handle message queuing and routing
- Automated Relayer processes messages between chains
- Message verification ensures security and prevents double-spending
- Retry logic handles network failures gracefully
- Node.js 18+ and Bun
- MetaMask or compatible wallet
- Testnet ETH on supported chains
# Clone the repository
git clone https://github.com/heetprox/midway.git
cd midway
# Install frontend dependencies
cd client
bun install
# Start development server
bun run dev
# Navigate to server directory
cd server
bun install
# Set up environment variables
cp .env.example .env
# Add your private keys and RPC URLs
# Start the relayer
bun run start
Create .env
files with the following:
# Backend (.env)
BOT_PRIVATE_KEY=your_relayer_private_key
OPTIMISM_SEPOLIA_RPC_URL=https://sepolia.optimism.io
ETH_SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/your-key
ZORA_SEPOLIA_RPC_URL=https://sepolia.rpc.zora.energy
BASE_SEPOLIA_RPC_URL=https://sepolia.base.org
POLYGON_AMOY_RPC_URL=https://rpc-amoy.polygon.technology
WORLDCHAIN_SEPOLIA_RPC_URL=https://worldchain-sepolia.g.alchemy.com/public
INK_SEPOLIA_RPC_URL=https://rpc-gel-sepolia.inkonchain.com
UNICHAIN_SEPOLIA_RPC_URL=https://sepolia.unichain.org
- Responsive design that works on all devices
- Real-time balance updates
- Intuitive network switching
- Clear transaction status feedback
- Multi-signature architecture
- Automated security checks
- Rate limiting and spam protection
- Comprehensive error handling
- Smart contract gas optimization
- Efficient message routing
- Parallel transaction processing
- Caching for improved UX
- TypeScript throughout
- Comprehensive testing
- Clear documentation
- Modular architecture
- Accept payments on any supported chain
- Settle in preferred currency/chain
- Reduce gas costs through optimal routing
- Simplified multi-chain treasury management
- Unified balance across all chains
- Pay with tokens on cheapest available chain
- Seamless cross-chain experience
- No manual bridging required
- Integrate cross-chain payments easily
- Access liquidity from multiple chains
- Reduce user onboarding friction
- Enable chain-agnostic user experiences
Contract | Network | Address | Purpose |
---|---|---|---|
MidPayCore | Optimism Sepolia | 0x895cCb... |
Central balance management |
MidPayClient | Ethereum Sepolia | 0x9E86ca... |
Local operations |
MidPayClient | Zora Sepolia | 0xfd0A25... |
Local operations |
External Router | All chains | Various | Message routing |
- FUSD: Custom testnet token for demonstration
- Decimals: 18
- Mintable: Yes (testnet only)
- Batch operations where possible
- Efficient storage patterns
- Minimal cross-chain message size
- Smart retry mechanisms
# Frontend tests
cd client
bun test
# Smart contract tests
cd contracts
forge test
# Integration tests
bun run test:integration
- β Unit tests for all components
- β Integration tests for cross-chain flows
- β End-to-end testing
- β Security audit preparation
- Core architecture implementation
- 8-chain support
- Basic UI/UX
- Cross-chain messaging
- Mainnet deployment preparation
- Advanced security features
- Performance optimizations
- Mobile app development
- Additional chain integrations
- DeFi protocol integrations
- Governance token launch
- DAO formation
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
- Use TypeScript for type safety
- Follow ESLint configuration
- Add comprehensive comments
- Write tests for new features
This project is licensed under the MIT License - see the LICENSE file for details.
- Website: midway.fi
- Documentation: docs.midway.fi
- Discord: Join our community
- Twitter: @MidwayProtocol
- GitHub: github.com/midway-protocol