Skip to content

feat: add bitcoin integration template#11

Merged
raymondk merged 15 commits intomainfrom
marc0olo/bitcoin-template
Mar 5, 2026
Merged

feat: add bitcoin integration template#11
raymondk merged 15 commits intomainfrom
marc0olo/bitcoin-template

Conversation

@marc0olo
Copy link
Member

@marc0olo marc0olo commented Feb 9, 2026

Summary

Add a Bitcoin integration template demonstrating how to read Bitcoin balance from a canister using the Bitcoin canister API.

  • Rust backend uses ic_cdk::bitcoin_canister which handles cycle costs and canister ID selection automatically
  • Motoko backend calls the Bitcoin canister directly with (with cycles = amount) syntax (moc 1.1.0, mo:core)
  • Two endpoints: get_balance (returns satoshi balance) and get_config (returns configured network + Bitcoin canister ID)
  • Three environments via BITCOIN_NETWORK env var: local (regtest), staging (testnet), production (mainnet)
  • Network type selection (Default vs Docker) with correct bitcoind-addr handling (127.0.0.1 for native, host.docker.internal via args for Docker)
  • README with Bitcoin canister IDs table, getting started guide, cycle costs reference, and environment overview
  • Rust recipe pinned to @dfinity/rust@v3.2.0, Motoko recipe pinned to @dfinity/motoko@v4.1.0

Dependencies

This PR relies on the following PRs:

@marc0olo marc0olo marked this pull request as ready for review February 9, 2026 20:13
@marc0olo marc0olo requested a review from a team as a code owner February 9, 2026 20:13
- Update YAML schema references from v0.1.0 to v0.2.0
- Use published Motoko recipe @dfinity/motoko@v4.1.0
- Update Rust recipe to @dfinity/rust@v3.2.0
- Expand .gitignore to match repo conventions
@marc0olo
Copy link
Member Author

We should NOT merge this unless v0.2.0 is released.

Replace Prim.envVar<system> with Runtime.envVar from mo:core/Runtime,
removing the need for the internal Prim import. Bump moc to 1.3.0.
marc0olo and others added 5 commits March 5, 2026 12:23
Align Motoko with Rust by reading the env var per request instead of
caching at init. Add comment to both backends noting the network can
be changed at runtime.
Runtime.envVar requires system capability which is not available in
Motoko query functions. Use a cached transient value for get_config
(query) while get_balance (update) reads the env var fresh.

Also clean up ordering to mirror the Rust backend: types, helpers,
then public API.
@raymondk raymondk merged commit f4732c3 into main Mar 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants