BTC Integration with ICP

Dear Dfinity Team members,

We are ICPBunny Team. We are diving into BTC Ordinals. We are exploring
how we can exhibit the ICP Capabilities to our BTC community as the ordinal space
is very early.

I would like to thank Mr. @ielashi for the detailed demo of BTC <> ICP Integration
Wondering about the BTC <> ICP Integration ? I heard @ielashi talking about SegWit

Kindly clarify Nested or Native SegWit.

Legacy
Nested SegWit
Native SegWit
Taproot(P2TR)

How about Taproot integration for wallet generation ? Is there any future scope. Can we independently develop that ?

Follow our BTC Bunny Ordinal Discord channel

https://discord.gg/QdDRQjfH

BitcoinBunny Island LAND Parcel in Bitcoin chain

Need head up as well.
Thank you

1 Like

Hi @gladguy, I’m not sure I understand your question.

The Bitcoin API provides UTXOs for the following addresses (see docs):

  • Pay to public key hash (P2PKH)
  • Pay to script hash (P2SH)
  • Pay to witness public key hash (P2WPKH)
  • Pay to witness script hash (P2WSH)
  • Pay to taproot (P2TR)

As for signing transactions, you can use any address type that relies on ECDSA, so that would be all of the address types above with the exception of P2TR. We don’t offer libraries for signing Bitcoin transactions, so you’d have to rely on other libraries to do so or implement that yourself.

Does that answer your question?

1 Like

Thanks a lot Islam.
Would like to know who owns the Mnemonic or private of the wallet ?

Wondering, Libraries are written in rust ?
Where i can read about it more to generate addresses in Pay to taproot (P2TR).

Thank you for your reply.

1 Like

IC method bitcoin_get_utxos

Mentions as below, it seems taproot is submitted or i misunderstood ?

Given a get_utxos_request, which must specify a Bitcoin address and a Bitcoin network (mainnet or testnet), the function returns all unspent transaction outputs (UTXOs) associated with the provided address in the specified Bitcoin network based on the current view of the Bitcoin blockchain available to the Bitcoin component. The UTXOs are returned sorted by block height in descending order.

The following address formats are supported:

  • Pay to public key hash (P2PKH)
  • Pay to script hash (P2SH)
  • Pay to witness public key hash (P2WPKH)
  • Pay to witness script hash (P2WSH)
  • Pay to taproot (P2TR)

If the address is malformed, the call is rejected

1 Like

Would like to know who owns the Mnemonic or private of the wallet ?

You mean, if you want to sign transactions on the Internet Computer, where would the private key/seed phrase be stored? You shouldn’t generate private keys on the Internet Computer, as that isn’t secure. Instead, you should be using the threshold ECDSA API. There are Motoko and Rust examples that show how this is done.

You can read more about threshold ECDSA here.

I’m unaware of any library that you can use out of the box with the Internet Computer currently. I’d have a look at the example above, or the source code of ckBTC for inspiration on how to sign transactions. Additionally, for P2TR, while you can retrieve the UTXOs of a PT2R address, you cannot use sign P2TR transactions as it doesn’t use ECDSA, so I’d suggest you go with a different address type for your project.

2 Likes

Pay to taproot (P2TR) is the main address that supported by the data security on Bitcoin chain. How we can achieve P2TR signing in ICP?