-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b5e6056
Showing
14 changed files
with
5,681 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Private key of the wallet that holds the WBTC (same wallet will be used across all chains) | ||
PRIVATE_KEY=your_private_key_here | ||
|
||
# RPC endpoints (use your own endpoints for better reliability) | ||
OPTIMISM_RPC=https://mainnet.optimism.io | ||
ETH_RPC=https://eth-mainnet.g.alchemy.com/v2/your-api-key | ||
POLYGON_RPC=https://polygon-rpc.com | ||
|
||
# Optional: Use your own RPC providers for better reliability | ||
# OPTIMISM_RPC=https://opt-mainnet.g.alchemy.com/v2/your-api-key | ||
# ETH_RPC=https://eth-mainnet.g.alchemy.com/v2/your-api-key | ||
# POLYGON_RPC=https://polygon-mainnet.g.alchemy.com/v2/your-api-key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
# Multi-Chain WBTC Bridge | ||
|
||
A command-line application that bridges WBTC between different chains using official bridge contracts, ensuring 1:1 token mapping through canonical bridge paths. | ||
|
||
#NOTE: This project is abandoned because it turns out the upside for arbitraging wbtc is low given the logisical difficulties in moving wbtc across chains in a 1-1 way. This is on the assumption is that the actual arbitage will happen using wbtc from aave or other lending protocols and the settlement to happen by using 1-1 bridging across chains based on their native bridge with eth chain. | ||
|
||
## Currently Supported Paths | ||
|
||
### 1. Optimism ↔ Polygon (Default) | ||
|
||
Bridge path: Optimism → Ethereum → Polygon | ||
|
||
- Optimism WBTC: `0x68f180fcce6836688e9084f035309e29bf0a2095` | ||
- Ethereum WBTC: `0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599` | ||
- Polygon WBTC: `0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6` | ||
|
||
Estimated time: 1.5-2.5 hours | ||
|
||
- Optimism to Ethereum: ~1-2 hours | ||
- Ethereum to Polygon: ~30 minutes | ||
|
||
### 2. Arbitrum ↔ zkSync (Coming Soon) | ||
|
||
Bridge path: Arbitrum → Ethereum → zkSync | ||
|
||
- Arbitrum WBTC: `0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f` | ||
- Ethereum WBTC: `0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599` | ||
- zkSync WBTC: `0xbbeb516fb02a01611cbbe0453fe3c580d7281011` | ||
|
||
Estimated time: ~1.5 days | ||
|
||
- Arbitrum to Ethereum: ~1 day | ||
- Ethereum to zkSync: ~30 minutes | ||
|
||
## Prerequisites | ||
|
||
- Node.js v16 or higher | ||
- yarn or npm | ||
- A wallet with: | ||
- WBTC on source chain | ||
- Native tokens for gas on all chains in the path | ||
|
||
## Installation | ||
|
||
1. Clone the repository | ||
|
||
```bash | ||
git clone <repository-url> | ||
cd wbtc_bridge_app | ||
``` | ||
|
||
2. Install dependencies | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
3. Configure environment variables | ||
|
||
```bash | ||
cp .env.example .env | ||
``` | ||
|
||
Edit `.env` and add your: | ||
|
||
- Private key | ||
- RPC endpoints (recommended: use your own Alchemy/Infura endpoints) | ||
|
||
## Usage | ||
|
||
To bridge WBTC: | ||
|
||
```bash | ||
npm run bridge <amount> | ||
``` | ||
|
||
Example: | ||
|
||
```bash | ||
npm run bridge 0.1 | ||
``` | ||
|
||
This will: | ||
|
||
1. Check if you have sufficient WBTC balance on the source chain | ||
2. Execute the withdrawal to Ethereum | ||
3. Bridge from Ethereum to the destination chain | ||
4. Monitor and confirm the completion of both transactions | ||
|
||
## Monitoring Progress | ||
|
||
The application will: | ||
|
||
- Display transaction hashes for tracking | ||
- Show real-time status updates | ||
- Check balances before and after the bridge | ||
- Wait for confirmation on all networks | ||
|
||
## Gas Costs | ||
|
||
You'll need: | ||
|
||
- Native tokens on source chain for withdrawal | ||
- ETH on Ethereum for: | ||
- Finalizing L2 withdrawals | ||
- Approving WBTC for destination bridge | ||
- Depositing to destination chain | ||
- Native tokens on destination chain for future transactions | ||
|
||
## Security | ||
|
||
This application uses only official bridge contracts: | ||
|
||
1. For Optimism: | ||
|
||
- Optimism Bridge for L2→L1 | ||
- Polygon PoS Bridge for L1→L2 | ||
|
||
2. For Arbitrum (Coming Soon): | ||
- Arbitrum Gateway for L2→L1 | ||
- zkSync Portal for L1→L2 | ||
|
||
This ensures that WBTC maintains its canonical form across chains through official bridge paths. | ||
|
||
## Error Handling | ||
|
||
The application includes checks for: | ||
|
||
- Insufficient balances | ||
- Failed transactions | ||
- Bridge contract errors | ||
- Network connectivity issues | ||
- Chain-specific verifications (e.g., Polygon checkpoints) | ||
|
||
## Important Notes | ||
|
||
1. Keep your private key secure and never share it | ||
2. Ensure sufficient gas tokens on all networks | ||
3. Double-check all transaction amounts before confirming | ||
4. The application automatically monitors and waits for confirmations | ||
5. Different bridge paths have different waiting times | ||
|
||
## License | ||
|
||
ISC |
Oops, something went wrong.