Skip to content
This repository was archived by the owner on Jun 20, 2025. It is now read-only.

CycleOperators/cycles-btc-poc

Repository files navigation

CycleBTC


Requirements

  • Npm

Setup

First, install dependencies and set up the environment (this will create the .mops, .bitcoin, and .canisters directories):

make install

Next, download all required canister WASMs:

make download

Local Development

Tip: You will need a separate terminal window for each of the following processes:

  • bitcoind (Bitcoin node)
  • dfx start (Internet Computer local replica)
  • Any other commands/scripts (e.g., make mine)

1. Start Local Bitcoin Node

See: IC Docs: Local Bitcoin Development

Note: You may need to sign the binaries to run them on macOS:
codesign -s - ./.bitcoin/bitcoin-27.0/bin/bitcoind
codesign -s - ./.bitcoin/bitcoin-27.0/bin/bitcoin-cli

Then let's launch the Bitcoin Core daemon (bitcoind) in "regtest" mode. This boots a self-contained Bitcoin Core node for local testing, and isolates all its files to your working directory.

./.bitcoin/bitcoin-27.0/bin/bitcoind \
  -conf="$(pwd)/.bitcoin/bitcoin-27.0/bitcoin.conf" \
  -datadir="$(pwd)/.bitcoin/bitcoin-27.0/data" \
  --port=18444

2. Start DFX

Note: You'll want this to run in its own window as starting up Bitcoin with dfx has noisy logging!

dfx start --background --clean

In yet another new terminal, deploy the canisters:

make deploy

Mining Blocks

Instead of manually generating blocks, use the provided script to mine blocks every 10 seconds:

make mine

This command mine a block and sends the rewards to the deposit ck address on the ckMint (note: canisters must deployed first):

./.bitcoin/bitcoin-27.0/bin/bitcoin-cli \
  -conf=$(pwd)/.bitcoin/bitcoin-27.0/bitcoin.conf \
  generatetoaddress 1 $(dfx canister call cycle-btc ck_deposit_address | sed 's/[(")]//g')

Useful Commands

Mint ckBTC (after sending BTC to the deposit address):

dfx canister call cycle-btc mint_ck

Check ckBTC balance:

dfx canister call ck-btc icrc1_balance_of '(record { owner = principal "umunu-kh777-77774-qaaca-cai"})'

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors