Examples
Bitcoin Multisig Example
This example demonstrates a production-ready multi-signature wallet for Bitcoin transactions, showcasing all major Ika integration patterns.
Overview
The Bitcoin Multisig contract enables:
- Multiple members to collectively approve Bitcoin transactions
- Configurable approval and rejection thresholds
- Time-based request expiration
- Irrevocable voting to prevent manipulation
- Automatic presign pool management
Source Code: examples/multisig-bitcoin/contract/
Architecture
Multisig Transaction Flow
1. Create Request
Member proposes transaction
request_future_sign()
Store PartialSigCap
with request
▼
▼
2. Voting
Members approve or reject
Approve
Reject
▼
▼
3. Execute
When threshold reached
Complete Signature
Broadcast to Bitcoin
Key Data Structures
Multisig Contract
Request Types
Workflow
1. Create Multisig
2. Create Transaction Request
Uses future signing to create a partial signature that's stored with the request:
3. Vote on Request
Voting is irrevocable - once cast, votes cannot be changed:
4. Execute Approved Request
Complete the signature using the stored partial signature:
Constants Configuration
Key Patterns Demonstrated
1. Shared dWallet Ownership
The contract owns the DWalletCap, enabling automated signing:
2. Presign Pool with Auto-Replenishment
3. Future Signing for Governance
Transaction requests use future signing to separate commitment from execution:
4. Payment Management
5. Irrevocable Voting
Using Table ensures votes cannot be modified:
File Structure
Testing
Build
Test
Deploy to Testnet
TypeScript Integration
To interact with the deployed contract:
Security Considerations
- Irrevocable Votes: Once cast, votes cannot be changed
- Expiration: Requests automatically expire to prevent stale states
- Threshold Validation: Thresholds must be valid (greater than 0, at most member count)
- Member Deduplication: Duplicate members are automatically removed
Next Steps
- Review the full source code
- Check Core Concepts for fundamentals
- See Integration Patterns for more patterns