Retrieve btc to external wallets

Hi! I’m working on an node + express API to consume ckBtc minter and ledger canister provided in IC documentation. I create a complete flow for deposit, convert to ckbtc, transfer to external wallets in ckbtc addresses.

Everything works fine but I have a question in the retrieve method. The candid flow explanations mentions that the method “to” address is obtained in the method get_withdrawal_account and then deposit ckbtc to that address.

My doubt is placed here. I supposed to transfer with for example icrc1_transfer to that address, and then call retrieve_btcwith the BTC address to deposit the amount?

Thanks for helping and I would try it but minimum amount is too expensive to that. I can’t risk 0.001 BTC to make a shoot on this.

I believe that you are following the previous flow.

There is a new flow which you can find in detail here under the Converting ckBTC to BTC section.

From a high-level, you have to:

  1. Call icrc2_approve with the account that you want to take ckBTC from on the ckBTC ledger to allow the ckBTC ledger to take ckBTC away

  2. Call retrieve_btc_with_approval with the same account above specifying the BTC amount and BTC address

1 Like

I Resolved it with the common transfer without approval. I was able to do it! I have now an issue with notify my users. Can I send you a message?

I am assuming that you went with the older method? Yes, feel free to provide more info.

1 Like

Well I didn’t found where to send you a private message, so I tell you here:

In my API I need to add something like a webhook, to call to the wallet backend to notify users when they receive a transfer. There’s anyway to do that? I was searching info and only found the get_events method but it will have so many troubles to implement.

I have not a custom canister, I am using ckBtc Minter and Ledger and creating an address from unique value (username) and uuid. I need to know the exact time they receive a deposit to notify them.

If you could help me with this, I will be gratefull to you the rest of my life. :raised_hands:t2:

Have you looked into IC-Websocket?

1 Like

Im doing it right now, someone send me this link yesterday. Thanks! It may works