← Back to home

ChainShift Protocol

Revolutionary cross-chain DEX enabling seamless atomic swaps between Ethereum & Aptos

Problem Statement

ChainShift is a production-ready cross-chain atomic swap protocol deployed on Ethereum Sepolia and Aptos Testnet that enables trustless token swaps without traditional bridging delays or risks.What We Actually Built:🔗 Atomic Cross-Chain Swaps Our core innovation uses Hash Time Locked Contracts (HTLCs) to guarantee atomic execution across chains. Users can swap mUSDC on Ethereum for mUSDC on Aptos (or vice versa) with cryptographic guarantees - either both sides complete or both automatically refund.🏗️ Smart Contract InfrastructureEthereum: CrossChainSwap + CrossChainBridge contracts deployed on SepoliaAptos: Move-based generic_cross_chain_swap module deployed on testnetSecurity: ReentrancyGuard protection, 3-hour timelocks, 32-byte secret verification💱 Dual Execution ModesAtomic Swaps: Cross-chain token swaps (mUSDC-ETH ↔ mUSDC-APT) with 1inch price optimizationBridge Transfers: Same-token transfers (mUSDC ↔ mUSDC) via liquidity pools with 0.1% fees📊 Live Integrations1inch Fusion+ API: Real-time pricing and liquidity aggregation across 250+ DEXsDual Wallet Support: MetaMask (Ethereum) + Petra (Aptos) with live balance trackingReal-time Monitoring: Transaction status across both chains with automatic updates🎯 Proven User Flow Connect both wallets → Select cross-chain tokens → Get 1inch-optimized quote → Execute atomic swap with single signature → Monitor automatic cross-chain completion in 5-10 minutes.🧪 Currently Deployed Working on testnets with mUSDC-ETH and mUSDC-APT tokens, comprehensive test suite, and production-ready smart contracts awaiting mainnet deployment.Technical Achievement: We've solved the cross-chain atomic swap challenge with actual deployed contracts, 1inch integration, and a polished interface - not just a concept, but working code.

Solution

🌉 ChainShiftBridging DeFi across chains with atomic swap technologyA novel cross-chain swap extension for 1inch Fusion+ that enables secure, trustless, bidirectional token swaps between Ethereum and Aptos networks using atomic swap protocols🎯Project OverviewChainBridge Protocol implements a trustless cross-chain atomic swap mechanism that enables users to exchange tokens between Ethereum and Aptos networks while preserving the security guarantees of both blockchains. Built for the 1inch Cross-Chain Hackathon.✨Key Features🔄Bidirectional Swaps: Seamless Ethereum ↔ Aptos token exchanges⚛️Atomic Transactions: All-or-nothing swap guarantees🔒Hashlock/Timelock Security: Cryptographic safety mechanisms🚀1inch SDK Integration: Optimal routing and liquidity🛡️Production Ready: Comprehensive testing and security measures⚡Gas Optimized: Efficient transaction costs (~230K gas)🏗️Architecture┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐ │ Frontend │ │ Backend │ │ Smart │ │ (React) │◄──►│ (Node.js) │◄──►│ Contracts │ │ │ │ │ │ │ │ • Swap Interface│ │ • Event Monitor │ │ • Ethereum │ │ • 1inch SDK │ │ • Cross-chain │ │ • Aptos (Move) │ │ • Multi-wallet │ │ Coordination │ │ • Token Mgmt │ └─────────────────┘ └──────────────────┘ └─────────────────┘🔥Live DeploymentsEthereum (Sepolia Testnet)CrossChain Bridge: 0x4f1e1b041A9Fc9347731E893d1c06e6c8FbceDb0Token Manager: 0x2A809295cc916E85cF998eA8f8559cfeB85f2e28Mock USDC: 0x7a265Db61E004f4242fB322fa72F8a52D2B06664Aptos (Testnet)CrossChainSwap:🚀Quick StartPrerequisitesNode.js 18+npm or yarnMetaMask (for Ethereum)Petra Wallet (for Aptos)GitInstallation# Clone the repository git clone https://github.com/Rakesh-sahoo07/chainbridge.git cd chainbridge # Install Ethereum dependencies cd smart-contracts/ethereum npm install # Install Aptos dependencies cd ../aptos npm install # Copy environment files cp .env.example .env # Fill in your API keys and configurationLocal Development# Compile Ethereum contracts cd smart-contracts/ethereum npm run compile # Run tests npm test # Compile Aptos contracts cd ../aptos npm run compile🧪Testing ResultsChainBridge Protocol has been thoroughly tested withreal on-chain transactions:✅Ethereum → AptosStatus: ✅FULLY OPERATIONALLive TX:Amount: 5 USDC successfully swapped✅Aptos → EthereumStatus: ✅VERIFIED WORKINGLive TX:Amount: 0.05 APT successfully locked🛡️Security Tests✅ Hashlock protection verified✅ Timelock validation enforced✅ Wrong secret rejection confirmed✅ Atomic guarantees maintained🔧Smart ContractsEthereum Smart ContractsCrossChainSwapEthereum.solCore atomic swap functionality with hashlock/timelock mechanisms.function initiateSwap( bytes32 swapId, bytes32 hashlock, address recipient, uint256 amount, address token, uint256 timelock ) external; function completeSwap(bytes32 swapId, bytes32 secret) external; function refund(bytes32 swapId) external;TokenManager.solToken registry and cross-chain mapping management.Aptos Smart ContractsCrossChainSwapAptos.moveMove-native implementation of atomic swap protocol.public entry fun initiate_swap( initiator: &signer, swap_id: vector<u8>, hashlock: vector<u8>, recipient: address, amount: u64, timelock: u64, ) public entry fun complete_swap( completer: &signer, swap_id: vector<u8>, secret: vector<u8>, )⚛️Atomic Swap ProtocolPhase 1: InitiationAlice generates secret and hashlockAlice locks tokens on source chain with timelockSwap details published via eventsPhase 2: CommitmentBob monitors source chain eventsBob verifies swap parametersBob locks equivalent tokens on destination chainPhase 3: CompletionAlice reveals secret to claim destination tokensSecret becomes public on blockchainBob extracts secret to claim source tokensPhase 4: SafetyIf timelock expires: Both parties can refundAtomic guarantee: Both complete or both failNo partial completion possible🛠️Available CommandsEthereum Developmentcd smart-contracts/ethereum npm run compile # Compile contracts npm test # Run test suite npm run deploy:sepolia # Deploy to Sepolia npm run node # Start local nodeAptos Developmentcd smart-contracts/aptos npm run compile # Compile Move modules npm run publish # Publish to testnet npm run deploy # Initialize contracts📁Project Structurechainbridge/ ├── smart-contracts/ │ ├── ethereum/ # Ethereum contracts (Solidity) │ │ ├── contracts/ │ │ ├── test/ │ │ ├── scripts/ │ │ └── hardhat.config.js │ └── aptos/ # Aptos contracts (Move) │ ├── sources/ │ ├── scripts/ │ └── Move.toml ├── frontend/ # React application (future) ├── backend/ # Node.js services (future) └── docs/ # Documentation🔐Security FeaturesReentrancy Protection: OpenZeppelin ReentrancyGuardAccess Control: Owner-only administrative functionsPausable Contracts: Emergency stop functionalityInput Validation: Comprehensive parameter checkingTimelock Validation: Secure time windows (2-48 hours)Fee Management: Configurable swap fees (0.1% default)🎯1inch IntegrationChainBridge Protocol is designed for seamless integration with 1inch Fusion+:Token Discovery: Compatible with 1inch token listsPrice Quotes: Leverages 1inch aggregation APIsRoute Optimization: Cross-chain routing algorithmsSDK Integration: Ready for 1inch SDK integration🛣️Roadmap[x]Phase 1: Smart contract development ✅[x]Phase 2: Cross-chain bridge logic ✅[x]Phase 3: Comprehensive testing ✅[ ]Phase 4: Frontend development[ ]Phase 5: Backend services[ ]Phase 6: Production deployment[ ]Phase 7: Mainnet launch🤝ContributingFork the repositoryCreate your feature branch (git checkout -b feature/amazing-feature)Commit your changes (git commit -m 'Add amazing feature')Push to the branch (git push origin feature/amazing-feature)Open a Pull Request📄LicenseThis project is licensed under the MIT License - see theLfile for details.⚠️DisclaimerThis is a hackathon project for demonstration purposes. While built with production-ready practices, please conduct thorough testing and security audits before any mainnet deployment.🔗LinksGitHub:h1inch Network:hEthereum Documentation:hAptos Documentation:h📞SupportFor questions and support, please open an issue in the GitHub repository or contact the development team.Built with ❤️ for the 1inch Cross-Chain HackathonBridging the future of DeFi, one atomic swap at a time.🌉⚛️

Hackathon

ETHGlobal Unite

2025

Contributors