A cross-chain ETH bridge built using Hardhat, Solidity, Pyth Oracle, and a Relayer Service. This project enables users to transfer ETH between Ethereum Sepolia, Arbitrum Sepolia, and Base Sepolia testnets with the help of an automated relayer.
- Deposit & Withdraw ETH Across Chains
- Uses Pyth Oracle for price verification
- Automated Relayer Service for processing transactions
- Secure & Scalable Architecture
- Next.js Frontend for User Interaction
monad-bridge
├── contracts # Solidity smart contracts
├── scripts # Hardhat deployment scripts
├── relayer # Node.js relayer service
├── frontend # Next.js frontend
├── hardhat.config.js # Hardhat configuration
├── relayer.js # Relayer event listener
└── README.md # Project documentation
git clone https://github.com/bossonormal215/monad-dapp-test
cd monad-bridge
npm install
Create a .env
file in the root directory:
PRIVATE_KEY=your_wallet_private_key
ETH_SEPOLIA_RPC=https://sepolia.infura.io/v3/your_project_id
ARB_SEPOLIA_RPC=https://arb-sepolia.alchemy.com/v2/your_project_id
BASE_SEPOLIA_RPC=https://base-sepolia.infura.io/v3/your_project_id
MONAD_RPC=https://monad-rpc-url
PYTH_ORACLE_ETHEREUM_SEPOLIA=0xYourEthereumSepoliaOracleAddress
PYTH_ORACLE_ARBITRUM_SEPOLIA=0xYourArbitrumSepoliaOracleAddress
PYTH_ORACLE_BASE_SEPOLIA=0xYourBaseSepoliaOracleAddress
PYTH_ORACLE_MONAD_TESTNET=0xYourMonadTestnetOracleAddress
npx hardhat run scripts/deploy.js --network sepolia
Repeat for Arbitrum Sepolia and Base Sepolia networks.
node relayer.js
cd frontend
npm run dev
- Connect Wallet in the frontend.
- Enter the amount and select a destination chain.
- Click "Bridge ETH" to send the deposit transaction.
- The relayer detects the deposit event and processes withdrawal on the destination chain.
- The relayer automatically processes withdrawals after confirming the deposit.
- Handles deposits and withdrawals
- Uses Pyth Oracle to fetch ETH price
- Emits Deposit events for the relayer
- Listens for deposit events
- Transfers ETH from liquidity pool on the destination chain
- Calls withdraw function on the smart contract
- Provides a simple UI for users to bridge ETH
- Interacts with the smart contract
- Shows transaction status
- Liquidity Management: Ensure the relayer always has enough ETH.
- Oracle Verification: Verify Pyth Oracle prices to prevent manipulation.
- Relayer Safety: Secure the private key of the relayer.
- Add more chains (e.g., Optimism, ZkSync)
- Implement slippage protection for bridging fees
- Introduce bridging fees for sustainability
- Enhance UI/UX with transaction history
Want to improve this bridge? Feel free to fork, improve, and create a PR!
git checkout -b feature-branch
git commit -m "Added new feature"
git push origin feature-branch
This project is MIT Licensed. Feel free to use and modify it.
- Solidity - Smart contract development
- Hardhat - Ethereum development framework
- Next.js - Frontend framework
- Ethers.js - Ethereum interaction library
- Pyth Oracle - Price feeds