A secure, upgradeable cross-chain token bridge built on Ethereum Virtual Machine (EVM) compatible chains. This bridge enables users to seamlessly transfer ERC20 tokens and native tokens across different blockchain networks with multi-signature committee verification, rate limiting, and comprehensive security features.
Bridge EVM is a production-ready cross-chain bridge solution that facilitates token transfers between different blockchain networks. The bridge implements a modular architecture with separation of concerns for committee management, configuration, rate limiting, and asset custody.
- Cross-Chain Token Transfer: Support for ERC20 tokens and native tokens (via wrapped token mechanism)
- Multi-Signature Verification: Committee-based signature verification for secure bridge operations
- Rate Limiting: Built-in transfer limits to prevent abuse and ensure system stability
- Fee Management: Configurable fee percentages per token with fee accumulation tracking
- Emergency Controls: Pausable contract with emergency freeze/unfreeze capabilities
- Upgradeable Contracts: All core contracts use OpenZeppelin's UUPS proxy pattern for future upgrades
- Reentrancy Protection: All critical functions are protected against reentrancy attacks
- Message Replay Prevention: Nonce-based system prevents duplicate message processing
- Committee Blocklist: Support for blocking compromised committee members
- Token State Management: Per-chain, per-token enable/disable functionality
The bridge consists of five main contracts:
The main bridge contract that handles token deposits, withdrawals, and cross-chain message processing.
Key Functions:
bridgeERC20(): Deposit ERC20 tokens for cross-chain transferbridgeNativeToken(): Deposit native tokens (e.g., ETH) for cross-chain transfertransferBridgedTokensWithSignatures(): Claim tokens on destination chain using committee signatures
Manages committee members, their stakes, and signature verification logic.
Key Features:
- Committee member management with stake requirements
- Submit-only access control
- Blocklist functionality for compromised members
- Message signature verification
Centralized configuration management for supported tokens, chains, fees, and other parameters.
Configuration Includes:
- Supported token list with addresses and metadata
- Supported chain IDs
- Token fee percentages
- Minimum transfer amounts
- Chain and token decimal configurations
Secure vault contract for custody of bridged tokens.
Features:
- ERC20 token custody
- Native token wrapping/unwrapping support
- Owner-only transfer functions (intended for Bridge contract)
Implements rate limiting and transfer amount restrictions.
Features:
- Per-chain, per-token transfer limits
- Time-window based limiting (e.g., 24-hour limits)
- Transfer amount tracking
- Node.js (v16 or higher)
- npm or yarn
- Hardhat
- Access to an EVM-compatible blockchain (testnet or mainnet)
# Clone the repository
git clone <repository-url>
cd bitlayer-bridge-evm
# Install dependencies
npm install- Generate a
.env.encfile in the root directory:
# Set pw
npx env-enc set-pw
npx env-enc set
MAINNET_PRIVATE_KEY
<your-mainnet-private-key>
# Other environment variables as needed- Configure network settings in
hardhat.config.tsfor your target networks.
# Compile contracts
npx hardhat compileThe project includes comprehensive deployment scripts:
# Deploy all contracts
npx hardhat run scripts/cmd/deploy.ts
# Deploy specific contract
npx hardhat run scripts/cmd/contract/Bridge/deploy.ts
# Setup contracts after deployment
npx hardhat run scripts/cmd/setup.ts# Run all tests
npx hardhat test
# Run tests with gas reporting
REPORT_GAS=true npx hardhat testbitlayer-bridge-evm/
├── contracts/ # Solidity smart contracts
│ ├── Bridge.sol # Main bridge contract
│ ├── BridgeCommittee.sol # Committee management module
│ ├── BridgeConfig.sol # Config module
│ ├── BridgeLimiter.sol # Token limit module
│ ├── BridgeVault.sol # Vault for tokens
│ ├── interfaces/ # Contract interfaces
│ ├── token/ # Token contracts
│ └── utils/ # Utility contracts and libraries
├── scripts/ # Deployment and utility scripts
│ ├── cmd/ # Command scripts
│ │ ├── deploy.ts # Deployment script
│ │ ├── upgrade.ts # Upgrade script
│ │ └── setup.ts # Setup script
│ └── config/ # Configuration files
├── test/ # Test files
├── artifacts/ # Compiled contract artifacts
├── cache/ # Hardhat cache
└── typechain-types/ # TypeScript type definitions
- @openzeppelin/contracts: ^5.0.1 - OpenZeppelin contract library
- @openzeppelin/contracts-upgradeable: ^5.0.1 - Upgradeable contracts
- @openzeppelin/hardhat-upgrades: ^3.0.1 - Hardhat upgrades plugin
- hardhat: ^2.22.19 - Ethereum development environment
- @nomicfoundation/hardhat-toolbox: ^5.0.0 - Hardhat toolbox
Contracts are written in Solidity ^0.8.20 with compiler optimizations enabled (200 runs).
The project is configured for:
- Bitlayer Testnet: Chain ID 200810
- Bitlayer Mainnet: Chain ID 200901
- Hardhat Local Network: For development and testing
- Committee Management: Ensure committee members have secure key management
- Upgrade Authorization: Upgrade functions should be carefully gated
- Rate Limits: Configure appropriate limits based on vault liquidity
- Token State: Regularly audit enabled/disabled token states per chain
- Fee Recipient: Verify fee recipient addresses are correct
https://github.com/bitlayer-org/smart-contract-audits
For questions or suggestions, please contact via GitHub Issues.