The ETH-BSC Bridge Relayer facilitates secure and efficient token transfers between the Ethereum (ETH) and Binance Smart Chain (BSC) networks. It leverages smart contracts and a backend relayer service to listen for lock and unlock events, manage transactions, and ensure seamless asset movement across chains.
- Token Locking and Unlocking: Listen for and handle token lock and unlock events across ETH and BSC.
- Signature Verification: Generate and verify signatures to secure transactions.
- Automated Synchronization: Use cron jobs to regularly sync bridge operations and ensure consistency.
- Upgradeable Smart Contracts: Deploy upgradeable contracts for flexibility and future improvements.
- Node.js (version 12.x or higher)
- MongoDB
- An Ethereum and a BSC wallet with testnet or mainnet tokens for testing
Clone the repository
git clone https://github.com/VAIOT/eth-bsc-bridge-relayer.git
cd eth-bsc-bridge-relayer
Install dependencies
npm install
Set up environment variables
Copy the .env.example file to a new file named .env, and fill in your details:
PORT=<port_of_backend>
MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net<dbname>
ORIGIN_NETWORK_URL=https://<ethereum_network>
DESTINATION_NETWORK_URL=https://<bsc_network>
ORIGIN_NETWORK_ADDRESS=<address_of_ethereum_bridge_contract>
DESTINATION_NETWORK_ADDRESS=<address_of_bsc_bridge_contract>
PRIVATE_KEY=<your_private_key_for_signing>
MODE=<eth_to_bsc or bsc_to_eth>
Start the application
npm start
Run cron jobs
The application automatically schedules cron jobs for syncing operations. Ensure your system allows cron job execution.
- Listening for Events: The application listens for TokensLocked and TokensUnlocked events from the configured smart contracts on the Ethereum and BSC networks, respectively.
- Processing Transactions: Transactions are automatically processed and synced based on the events captured by the listeners.
This project includes the UpgradeableBridgeContract, VAITokenBSC, and VaiTokenETH smart contracts. Deploy these contracts on the respective networks before using the bridge.
You can find them here.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.