The library provides Bitcoin functionality built on top of the low-level Bitcoin integration API.
The library provides the following functionality:
-
It can generate and manage Bitcoin addresses, supporting various address types.
-
Given a valid Bitcoin address, it can get the unspent transaction outputs (UTXOs) and the balance of it.
-
It can send bitcoins using UTXOs collected from managed addresses with various options to set the transaction fee.
-
It can get current Bitcoin transaction fees.
The library supports local deployments in Bitcoin regtest mode and in Bitcoin testnet mode when running on the Internet Computer.
-
Rust documentation is available here.
While the library is reasonably well tested, it is still under development, therefore use it at your own risk.
This library is work in progress and is not production-grade yet. At least the following aspects of the library need further consideration before using it in production use cases:
-
Canister upgradability and management of state related to the library requires further consideration before the library can be used in production. If upgradeability of a canister w.r.t. the replicated state managed by the library is flawed, we risk canisters to break on an upgrade in production, in the worst case in a non-recoverable or hard-to-recover fashion.
-
More test coverage would be important for some parts of the code.
-
We have not gained much experience yet in using the library in real-world use cases.
During your canister development, you might be interested in testing your canister with fake bitcoins. In order to do this, you can run a local Bitcoin blockchain in Regtest mode.
For more details, see here:
If you are more confident with your canister code, you can deploy it on the Internet Computer but continue to use fake Bitcoin by making use of the Bitcoin testnet.
If you want to put your canister into production using real bitcoins, you can then switch over to Bitcoin mainnet.
This first version only supports Rust, however support for Motoko will be added soon.
Update unconfirmed transactions using replace-by-fee.
Canisters will be able to update unconfirmed transactions using replace-by-fee by issuing a new transaction with a higher transaction fee.
Furthermore two simple examples using the ic-btc-library
will be provided.
-
The bitcoin-developer-preview which showcases how developers can use the library.
-
The sample dApp which is a Bitcoin wallet running fully on the Internet Computer.