Skip to content

zalatar242/wbtc_bridge_tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
git clone <repository-url>
cd wbtc_bridge_app
  1. Install dependencies
npm install
  1. Configure environment variables
cp .env.example .env

Edit .env and add your:

  • Private key
  • RPC endpoints (recommended: use your own Alchemy/Infura endpoints)

Usage

To bridge WBTC:

npm run bridge <amount>

Example:

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published