A Solana smart contract for managing BTC cross-chain assets through BitVM protocol.
The BitVM Bridge smart contract enables:
- Minting wrapped BTC tokens on Solana
- Burning tokens for BTC redemption
- Configurable parameters for pegin/pegout amounts
- Admin controls for emergency pause and parameter updates
- Rust 1.70.0+
- Solana CLI 1.17.0+
- Node.js 18.0.0+
- Anchor Framework 0.30.1+
- Yarn
- Install dependencies
yarn install
- Create
.env
file from template
cp .env.example .env
Update the following values in .env
:
SOLANA_PRIVATE_KEY=your_base58_private_key
RPC_URL=https://api.devnet.solana.com
- Build the program
anchor build
- Start local validator with required programs
solana-test-validator \
--clone metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s \
--clone PwDiXFxQsGra4sFFTT8r1QWRMd4vfumiWC1jfWNfdYT \
--url https://api.mainnet-beta.solana.com \
--reset
- Run tests
anchor test
anchor deploy
- Configure Solana CLI for devnet
solana config set --url devnet
- Get devnet SOL
solana airdrop 2
- Deploy
anchor deploy
After deployment, initialize the contract:
yarn initialize
# Build program
anchor build
# Create upgrade buffer
solana program write-buffer ./target/deploy/bitvm_bridge.so
# Deploy upgrade
solana program deploy --buffer <BUFFER_ADDRESS> --program-id <PROGRAM_ID>
Close deploy buffer account:
solana program close --buffers
The bridge contract includes configurable parameters:
max_btc_per_mint
: Maximum BTC amount per mintmin_btc_per_mint
: Minimum BTC amount per mintmax_btc_per_burn
: Maximum BTC amount per burnmin_btc_per_burn
: Minimum BTC amount per burnskip_tx_verification
: Enable/disable transaction verification
├── programs/
│ ├── bitvm-bridge/ # Bridge program
│ └── btc-light-client/ # BTC Light Client program
├── tests/ # Integration tests
├── cli/ # CLI tools
│ └── src/
│ ├── commands/ # CLI commands
│ └── utils.ts # Utility functions
└── Anchor.toml # Project configuration
ISC
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request