SDK Setup and Installation
⚠️ API Disclaimer. CBTC APIs have no formal versioning policy today. All SDK interfaces described in this guide are subject to change. Breaking changes are communicated via the changelog.
This page is your single reference for installing and configuring everything you need to build with CBTC. If you've already completed setup, head straight to the Quick Start to mint your first wrapped Bitcoin.
System Requirements
Rust toolchain
Latest stable. Install via rustup.rs
Canton participant node
Running and connected to devnet, testnet, or mainnet. See Canton documentation
DA Registry Utility
Installed and configured. See Digital Asset Utilities docs
Keycloak credentials
Host, realm, client ID, username, and password for your environment
Party ID
Your Canton Party ID, obtained during onboarding
Minter credential
Only required to mint or burn CBTC. Issued to your party by the CBTC registrar; request one via sales@bitsafe.finance. Holding, sending, and receiving CBTC do not require it.
Install cbtc-lib (Rust)
cbtc-lib is BitSafe's primary SDK for CBTC operations: minting, burning, transferring, UTXO management, and balance queries. It wraps the Canton Ledger API with type-safe Rust functions.
Repository: github.com/DLC-link/cbtc-lib
Current version: v0.6.4
Licence: Check repository
Add to your project
Add cbtc-lib to your Cargo.toml:
📌 Pin your version. Always reference a specific tag (e.g.
v0.6.4) rather thanmain. The library is under active development andmainmay contain breaking changes between releases.
Key modules
cbtc::mint_redeem::mint
Create deposit accounts, get Bitcoin deposit addresses
cbtc::mint_redeem::redeem
Create withdraw accounts, burn CBTC and withdraw to BTC
cbtc::transfer
Send CBTC to another party (creates transfer offer)
cbtc::accept
Accept incoming CBTC transfer offers
cbtc::active_contracts
Query current CBTC holdings for a party
cbtc::consolidate
Merge multiple UTXO holdings into fewer contracts
cbtc::split
Split a single holding into multiple UTXOs
cbtc::batch
Batch operations for sending to multiple recipients
cbtc::distribute
Distribute CBTC across multiple parties
cbtc::cancel_offers
Cancel pending outgoing transfer offers
cbtc::credentials
List and accept Minter credentials (required to mint or burn)
cbtc::allocation
Allocate CBTC into DvP settlement legs (delivery-versus-payment)
Install canton-lib
canton-lib is now a Rust workspace containing multiple crates that cbtc depends on. It handles Canton Ledger API communication, authentication, and Daml contract interactions.
Repository: github.com/DLC-link/canton-lib
Crates:
keycloak,ledger,registry,common(all at v0.6.1)
Add to your project
Add the canton-lib crates you need to your Cargo.toml:
📌 Match the tag
cbtc-libdepends on.cbtc-libv0.6.4 pins canton-lib v0.6.1. If you add these crates at a different tag than the onecbtc-libuses, Cargo will resolve two incompatible copies of the same types and your build will fail with confusing mismatched-type errors.
The keycloak crate provides authentication helpers used across all CBTC operations.
Password-grant authentication (for user-facing flows):
Client credentials authentication (for service-to-service / backend flows):
Install CBTC DAR Files
DAR (Daml Archive) files contain the smart contract templates that power CBTC on Canton. They must be installed on your participant node before you can interact with CBTC.
Download: github.com/DLC-link/cbtc-lib/tree/v0.6.4/cbtc-dars
The latest CBTC DAR is cbtc-1.2.1, shipped in cbtc-lib v0.6.4. DAR versions and crate versions are numbered independently.
Install the DAR files on your Canton participant node using the Canton console or your deployment tooling. The specific installation method depends on your Canton setup. Refer to the Canton documentation for details.
💡 Install every DAR version, not just the newest. The repository ships all released DARs (
cbtc-1.0.0throughcbtc-1.2.1). Older versions are required to interact with contracts still live on the network from earlier releases. You can verify what your participant is missing with thecbtc::dar_checkmodule.
💡 DAR version and Instrument IDs are linked. When DAR files are upgraded on the network, Instrument IDs may change. Always fetch Instrument IDs dynamically from the metadata endpoint rather than hardcoding them. See the Instrument ID Management page for the polling pattern.
Environment Configuration
Set these variables before running any CBTC commands or code. Values differ per environment.
REGISTRY_URL
BITSAFE_API_URL
DECENTRALIZED_PARTY_ID
Provided during onboarding
Provided during onboarding
Provided during onboarding
💡
BITSAFE_API_URLis the BitSafe API gateway, which serves the/cbtc/v1/*endpoints behind deposit accounts, deposit addresses, and withdrawals.cbtc-libreads it and passes it as theapi_urlparameter toget_account_contract_rules,get_bitcoin_address, andsubmit_withdraw. An Attestor or Coordinator host will not work in its place.
Example.env file
Verify Your Installation
Run this minimal check to confirm everything is wired up:
If both checks pass, you're ready. Head to the Quick Start to mint your first CBTC.
Next Steps
Quick Start - Mint your first wrapped Bitcoin in 15 minutes
CBTC Minting and Burning - The mint and burn lifecycle in depth, with error handling and recovery patterns
API Reference - Full Canton Ledger API endpoint documentation
Instrument ID Management - How to fetch and poll for the latest CBTC Instrument IDs
Authentication Guide - Detailed Keycloak setup and Auth0 community example
Testnet Guide - Get testnet CBTC from the faucet and test before going live
Last updated