Direct Integration with Bitcoin

Should we implement pagination already now for the get_UTXOs method?

Pagination is definitely needed. Even if not, for now, but for sure in the future.

1 Like

what is the difference between this bitcoin direct integration and wrap bitcoin on ethereum?

@trannghia:
The direct integration does not require any intermediaries, such as trusted bridges, which would lock up the received Bitcoin and mint the wrapped tokens. In the direct integration, smart contracts directly can hold Bitcoin as they can have their own threshold ECDSA private key that is secret shared among the replicas of a large subnet. So, the direct integration features a much stronger trust model than a bridge-based solution.

A developer preview that allows people to use the API will be available already by around end of January. The release of the feature on IC mainnet is planned to happen by the end of Q1.

4 Likes

What’s the difference between the Bitcoin smart contracts IC can achieve with the direct integration and the Bitcoin smart contracts Stacks STX provides?

IMHO …When I took a look at Stacks, it appeared to be similiar to about 90% of the crypto space. A bunch of vaporware mumbo jumbo. Perhaps though your research will offset the following criticism…

No scientific paper describing consensus protocol.
No soundness or liveness proof.
All I found was a rather light explanation of the PoX consensus. (Proof of Transfer) . What is the connection to miners? Who knows! Block producers bid for the right to create blocks by transferring bitcoins to another group called stackers. The motivation is STX but it gets convoluted when you dig further. I do like the ‘Hard Fork to Proof of Burn’ scenario. Sounds like film noir.

The Stacks 2.0 native currency is not Bitcoin. There is not even a wrapped-BTC token as far I can tell.

There is a STX token and the developers want folks to lock it for a long period… obviously.

They do use ‘Bitcoin technology’ to secure consensus so they have a Bitcoin blockchain oracle I think.

But I give a thumbs down to their ‘built on Bitcoin’ shtick …

6 Likes

Thanks for your thoughts. This is apparently Stacks’ Bitcoin DeFi platform

Maybe more technical details will be released after the coin goes up another billion.

1 Like

Progress update:
We have made lots of progress towards the Developer Preview release of the Bitcoin integration feature. This release will come out next week and allow people to use the Bitcoin API already now.

Let me briefly summarize below what you get with this preview release:

Scope:

  • Bringing the (close to final) APIs to our community; this should allow folks who want to use the API to already do so now in their development environment
  • Main goals
    • Bring the API to the people so they can play around already now, thereby bridging the gap between the original release date end of 2021 to the new release date end of Q1 2022
    • Facilitate smart contract development by community members already now
    • Get community feedback for the API for the final release
    • The Bitcoin-related logic is almost completely available
    • Almost zero engineering waste created by the DP release
  • This release does not use the final architecture for the integration, but does it in the following simplified way (this does not matter for the local environment and the intended goals):
    • APIs will be exposed as a regular canister (BTC Canister) running locally, not as a system API, for now
    • bitcoind in regtest mode is used instead of the Bitcoin mainnet or testnet (this makes sense for the lowest-level dev/testing stage anyway)
    • The IC stack integration is shortcut via ingress messages and queries, the full IC stack integration with consensus is being finalized in parallel and will be released in the Q1 release
    • Users start the Bitcoin adapter, integration shim, bitcoind, and BTC canister with a script
    • There’s no threshold ECDSA yet in this release
  • We will provide small sample dApps in both Rust and Motoko that make use of the interface

The following is not in scope and will not be available in this release. Non-scope:

  • Threshold ECDSA (in this release, people need to use an ECDSA library in the canister for now to sign transactions)
  • Bitcoin testnet and Bitcoin mainnet integration
  • Library to abstract the interface and make it more convenient for the users
  • Full IC stack integration through Consensus
21 Likes

Developer Preview Release
The release date for the Developer Preview has been fixed to Thursday next week, Feb 3rd, 2021, 3PM UTC+1.

13 Likes

This is great news! Amazing work everyone, looking forward to integrating this into Earth Wallet and giving feedback on the APIs :smiley:

4 Likes

Awesome, feedback on APIs will always be greatly appreciated! :slight_smile:

5 Likes

We are planning to make the source code of the Bitcoin logic already available as well with the Developer Preview release in the upcoming week!
Feedback is of course also much appreciated for the code. :slight_smile:

9 Likes

End-of-week update:

This is (with overwhelming probability) the last end-of-week update before the release of the Developer Preview which is scheduled for next Thursday, February 3rd, 15:00 UTC+1. We are well on track with the implementation, documentation, and open sourcing tasks and are confident that we will be able to stick to the defined release date.

Sneak preview on the API:
For those interested in the API already now, please find the current draft PR here: Adding the Bitcoin candid file and specification by THLO · Pull Request #5 · dfinity/interface-spec · GitHub
This is the API included with the Developer Preview release. It will be subject to your scrutiny so we can all benefit from your experiences with it in the final release.

By the way, for those of you who have not seen this yet, the IC interface specification repository is public now! See: GitHub - dfinity/interface-spec: IC Interface Specification

17 Likes

Wow!
Great Wish to the Team and Dfinity Community :heart_eyes:

1 Like

Can we watch the preview?

The Bitcoin integration developer preview is publicly available now

The Bitcoin developer preview has been released to the public, including all associated source code. Please visit Bitcoin integration :: Internet Computer for an overview of the release and links to the code, installation and usage instructions, the API documentation, a Wiki page with technical documentation, and example projects in Rust and Motoko.

With this release we reach an important milestone in the process towards a direct, trustless, integration with the Bitcoin network that will soon start a new era of DeFi! The developer preview enables you to start writing and testing smart contracts that use the Bitcoin API right now.

We hope that many of you will try out the preview release, start working on exciting smart contracts using the Bitcoin integration. We will greatly appreciate feedback on the developer preview, and particularly the API, to improve it further towards the final launch of the feature. We are planning to host a workshop in about a month from now where we would like to invite people interested in contributing to improvements.

Many thanks to @ielashi, @0x5279616e, and @THLO for their tremendous effort in finalizing the implementation of the developer preview, for getting the documentation ready, and even providing small sample projects in both Rust and Motoko in time for this preview release! Many thanks to everybody else who has contributed to the Bitcoin integration feature, particularly @Manu who has provided guidance w.r.t. key engineering questions!

Enjoy the developer preview, we are very much looking forward to your feedback!

The Bitcoin integration team at DFINITY

30 Likes

Here’s another announcement: We decided to build our own wrapped Bitcoin ledger to further speed up the development of Bitcoin smart contracts on the Internet Computer.

Please post your feedback and questions in this channel!

8 Likes

A couple concerns/questions (I have never actually done Bitcoin development before so please help me through this):

  1. Is there a way to query from the blockchain an appropriate transaction fee instead of using the hard-coded fee? https://github.com/dfinity/bitcoin-developer-preview/blob/master/examples/rust/src/main.rs#L123
  2. Can we get rid of the need to cache spent txos? Shouldn’t the utxos by definition not contain any spent txos? https://github.com/dfinity/bitcoin-developer-preview/blob/master/examples/rust/src/main.rs#L142
  3. With the API provided, are we able to deploy bitcoin smart contracts (as in code running on the bitcoin blockchain)?
1 Like

Hey @lastmjs, thanks for the quick feedback and great questions.

Is there a way to query from the blockchain an appropriate transaction fee instead of using the hard-coded fee?

Not at the moment, but it has become more apparent to us that we need to offer an endpoint that provides fee estimates based on previous blocks, and there are discussions ongoing on the semantics of that API.

Can we get rid of the need to cache spent txos? Shouldn’t the utxos by definition not contain any spent txos?

When you build a transaction using UTXOs and send it to the Bitcoin network, in theory you’ve spent these UTXOs and shouldn’t use them again for other transactions, but until this transaction is mined in a block, its UTXOs are still considered unspent by the Bitcoin network, and that’s why you currently need to cache them locally (until they are mined).

We have considered an alternative API for get_utxos where, when you send a transaction using send_transaction, the Bitcoin canister will mark these UTXOs as spent in its local state, so then clients won’t need to cache these transactions themselves. @dieter.sommer maybe this is something worth revisiting?

With the API provided, are we able to deploy bitcoin smart contracts (as in code running on the bitcoin blockchain)?

I am not sure what you mean by code running on the bitcoin blockchain. Are you referring to Bitcoin script? Can you provide an example of what you have in mind?

1 Like