The Layer Zero Bridger is a Python script that automates the process of transferring USDC or USDT (stablecoin cryptocurrencies) between different blockchains (Polygon -> Avalanche -> BSC -> Polygon as a default route). It uses a set of pre-configured wallet addresses to perform transfers in both directions and repeat the process a configurable number of times. In addition to this, it is also possible to use script for Bungee Refuel, wallet balance checking, new wallets generation and more.
- Polygon (USDC, USDT)
- Fantom (USDC)
- Avalanche (USDC, USDT)
- BSC (USDT)
- Arbitrum (USDT, USDC)
- Optimism (USDC)
- Base (USDC)
- Python 3.11
- An understanding of blockchain, cryptocurrency, and how to handle wallets and private keys securely.
- Docker (optional)
-
Clone the repository:
git clone https://github.com/tmlnv/layer_zero_bridger.git cd layer_zero_bridger -
Install the required dependencies:
pip install -r requirements.txt
Or, using Docker:
docker build -t layer_zero_bridger . -
Configure your wallets and number of cycles:
Specify the wallet keys in the
private_keys.example.envfile and run a command below.
Note: keys should be specified with a name for each key in aKEY=valueway.mv private_keys.example.env private_keys.env
In the
config.pyfile, specify the min and max $ amounts for transferring, the number of transfer cycles you want to run and a $ amount for Bungee Refueling.AMOUNT_MIN = 100 # Min amount to bridge AMOUNT_MAX = 150 # Max amount to bridge # If stated amounts exceed wallet balance, the whole available balance would be bridged TIMES = 10 # Number of transfer cycles BUNGEE_AMOUNT = 10 # $ value of native asset to be bridged via Bungee Refuel
Warning: Never disclose your private keys. They are sensitive information.
Execute the main.py script:
python main.pyOr, using Docker:
docker run -v ./private_keys.env:/app/private_keys.env layer_zero_bridgerTo pass CLI arguments, append them after the image name and private_keys.env mounting:
docker run -v ./private_keys.env:/app/private_keys.env layer_zero_bridger --mode balanceThe main script performs the following actions for each wallet:
- After a random delay of 1 to 200 seconds, it initiates a USDC transfer from Polygon to Avalanche.
- It waits for a random period between 1200 and 1500 seconds.
- Then, it initiates a USDC transfer from Avalanche to BSC. USDT tokens are received on BSC.
- It waits for a random period between 1200 and 1500 seconds.
- Then, it initiates a USDT transfer from BSC back to Polygon. USDC tokens are received on Polygon.
- It waits for a random period between 100 and 300 seconds.
- These steps are repeated a predefined number of times (
TIMESinconfig.py).
The script logs all its actions and reports when each wallet's transfers are done and when all tasks are finished.
To use separate modules, execute the main.py script using --mode flag with one of possible options or pass the --mode flag followed by the specific option to the Docker run command:
Execute only separated one-time bridging runs if you want just to transfer assets. Consider token availability on both departure and destination chains. Execute the main.py script using --mode one-way flag with one of possible options:
pfto bridge from Polygon to Fantompato bridge from Polygon to Avalanchepbto bridge from Polygon to BSCparbto bridge from Polygon to Arbitrumpoto bridge from Polygon to Optimismpbaseto bridge from Polygon to Basefpto bridge from Fantom to Polygonfato bridge from Fantom to Avalanchefbto bridge from Fantom to BSCapto bridge from Avalanche to Polygonafto bridge from Avalanche to Fantomabto bridge from Avalanche to BSCaarbto bridge from Avalanche to Arbitrumaoto bridge from Avalanche to Optimismabaseto bridge from Avalanche to Basebpto bridge from BSC to Polygonbfto bridge from BSC to Fantombato bridge from BSC to Avalanchebarbto bridge from BSC to Arbitrumboto bridge from BSC to Optimismbbaseto bridge from BSC to Basearbpto bridge from Arbitrum to Polygonarbato bridge from Arbitrum to Avalanchearbbto bridge from Arbitrum to BSCarboto bridge from Arbitrum to Optimismarbbaseto bridge from Arbitrum to Baseopto bridge from Optimism to Polygonoato bridge from Optimism to Avalancheobto bridge from Optimism to BSCoarbto bridge from Optimism to Arbitrumobaseto bridge from Optimism to Basebasepto bridge from Base to Polygonbaseato bridge from Base to Avalanchebasebto bridge from Base to BSCbasearbto bridge from Base to Arbitrumbaseoto bridge from Base to Optimism
Example:
python main.py --mode one-way pfGenerate a new private key and its associated address if you require a fresh wallet. Execute the main.py script using --mode new-wallet flag.
Example:
python main.py --mode new-walletCheck wallet balances. Execute the main.py script using --mode balance flag.
Example:
python main.py --mode balanceGet native tokens on the destination chain to pay fees using Bungee Refuel. Execute the main.py script using --mode refuel flag with one of possible options:
pato refuel from Polygon to Avalanchepbto refuel from Polygon to BSCparbto refuel from Polygon to Arbitrumpoto refuel from Polygon to Optimismpbaseto refuel from Polygon to Baseapto refuel from Avalanche to Polygonabto refuel from Avalanche to BSCaarbto refuel from Avalanche to Arbitrumaoto refuel from Avalanche to Optimismabaseto refuel from Avalanche to Basebpto refuel from BSC to Polygonbato refuel from BSC to Avalanchebarbto refuel from BSC to Arbitrumboto refuel from BSC to Optimismbbaseto refuel from BSC to Basearbpto refuel from Arbitrum to Polygonarbato refuel from Arbitrum to Avalanchearbbto refuel from Arbitrum to BSCarboto refuel from Arbitrum to Optimismarbbaseto refuel from Arbitrum to Baseopto refuel from Optimism to Polygonoato refuel from Optimism to Avalancheobto refuel from Optimism to BSCoarbto refuel from Optimism to Arbitrumobaseto refuel from Optimism to Basebasepto refuel from Base to Polygonbaseato refuel from Base to Avalanchebasebto refuel from Base to BSCbasearbto refuel from Base to Arbitrumbaseoto refuel from Base to Optimism
Example:
python main.py --mode refuel paNote: Consider that Bungee Refuel has different limits for different chains.
This script is meant for educational purposes. Always ensure you're keeping your private keys secure.