Discusses the Internet Computer <>Bitcoin Integration

blockpunk
ICP League
Published in
19 min readMar 21, 2022

Presented by Diego Prats & Manu Drijvers, text compiled by ICPL Research.

Audio: https://twitter.com/i/spaces/1BdxYwgAaVNGX?s=20

A brief overview of Internet Computer

The Internet Computer is a layer one blockchain like Bitcoin and Ethereum but the technology is completely unique and built from the ground up by the world’s leading cryptography experts. They all work in-house on the R&D team at DFINITY. Since the internet computer is public launched in May, the project has seen this awesome explosion of developer growth on the protocol on the network. Everything from games to social to NFTs to metaverse startups is using the internet computer protocol to build these new decentralized apps for the web3 world. what’s different about this project and about this developer ecosystem is that everything is fully built on-chain, from the decentralized browser-based wallets to financial platforms to hosting content, is 100% on the blockchain.

Bitcoin the world’s first blockchain is widely regarded as digital gold. Bitcoin is turning 13 years old this year, and tons of people over the past 13 years have bought into bitcoin for various reasons, some of which are about making money, but people got involved in bitcoin because they were compelled by this promise of a better future which we now have a name for as Web3. The fact that bitcoin was built off of technology and backed by mathematical proofs really resonated with people who grew up on the internet.

The advent of smart contracts and now the internet computer brings this early Ethereum vision of a world computer to life. This lands us at a definition of internet computer: the internet computer is a decentralized internet that allows anyone to host or access software without the need for any centralized government, intermediaries, or services.

What does this integration mean for the bitcoin and ICP ecosystems?

The part that is most relevant to this conversation about bitcoin integration is that the internet computer blockchain is designed and implemented, it removes a lot of traditional limitations of smart contracts, using new cryptography distributed protocols. This will come in relevant in this conversation about integrating with bitcoin.

What does it mean by traditional limitations? First, it is much faster, and it is much cheaper. It scales infinitely, which is a tricky word because when say scale infinitely, it means that, most protocols are designed so that whether there are 10 servers or 100 or a million servers, there is a number of transactions per second or transactions that are just limited by the protocol. If you add more subnets and more hardware, it can keep growing. That’s how a lot of things in the centralized world scale work but decentralized is quite unique that they can scale infinitely by just adding more machines.

It can host entire depths, which means the front-end and back-end of the code, the entire web, and the entire Dapp is on-chain. This is also unique because normally when people talk about “having depth” in practice, it’s usually a small percentage is in a smart contract and the rest is in centralized protocols.

The last thing is that Internet Computer has on-chain governance, so all the updates to the code of Internet Computer are voted by the token holders and people who stay.

What does it mean to Integrate two blockchains?

There’s no precise definition, but we all know that there are many different blockchains out there and they hold different assets or different smart contracts. Different blockchains have different strengths and weaknesses. The idea of this integration is that, if I have something running on blockchain and then I can use the assets that are native on blockchain B also on blockchain A. The different assets can cross over between different blockchains. Similarly, for smart contracts, maybe a smart on the one blockchain can call or interact with a smart contract running on a different blockchain.

Do we need permission from the BTC network to perform the integration?

That depends on the approach you take. We’ll get more into the different approaches you can do that. I think typically you don’t need any permission, you can just present yourself as a user of that other blockchain, and then the integration is indistinguishable from other users.

What is a bridge, and what are the pros and cons of using a bridge? Is this Bitcoin integration with ICP doesn’t involve in the bridge?

A bridge is what people mean as some component, or some entity, or global entities that allow for integration between blockchains. The advantage is that you can, for example, use assets from different blockchains, they can come together in one place, you can use the strengths of different blockchains in one system. The disadvantage is that what allows this interoperability is some external components, instead of native to the blockchains. If I want to have an App on blockchain A, but I want to work with something on blockchain B, and now I have a bridge between the two. Now there are 3 parts that can go wrong. I need to trust that each of these parts works, is secure, is available. Only if everything works, the integration in the interoperability really works.

What will the bitcoin integration mean for the canister developers?

With the bitcoin integration, what we are trying to achieve is that a canister can hold real bitcoin without the need for some separate bridge, without any external components to manage this bridge. If you as a user hold bitcoin, it means that you control some cryptographic signing key. With this signing key, you have it in a device like a hardware wallet or a ledger nano. The signing key is what controls your bitcoins. If you sign something with that, then you authorize the network to move your bitcoins to some other address.

Now the first step of the integration that we planted on the Internet Computer is that we give canisters access to such a signing key. Just like you interact with your ledger nano to sign transactions, the canister will have an interface to create such cryptographic signatures. This is a very challenging technical project because behind the scenes, this secret key needs to be very secret. All the different nodes that power the Internet Computer hold pieces of the secret key. And together they collaborate to make the authorized signatures. This gives us a secure way for the canister to control such a signing key, just like you do in your ledger device. This is the first pillar of the project.

The second pillar of the project is that you also need access to the bitcoin blockchain. By looking at the bitcoin blockchain, do I know how many bitcoins I have, and I need to know which UTXOs I have that I can spend to send to somebody else. A second new interface that we give to canisters allows you access to the bitcoin blockchain. Or more precisely, you can look up exactly how many bitcoins and exactly which UTXOs different addresses have. Basically, what you have and what you can spend.

These two pillars allow you to create a signing key that corresponds to a Bitcoin address. Now you can ask people to send Bitcoin there, and you can send it away by looking at the Bitcoin blockchain. This means that now the canister developer can truly hold real Bitcoin just like a person can.

Inversely it means that a bitcoin person, developer, or otherwise can use smart contracts on bitcoin. We hate it but we should be direct that, the smart contracts are really in the theorem thing. Bitcoin cannot hold more contracts. This would give the ability to programmatically move bitcoins. It would give bitcoin the superpower Ethereum has.

What is it about the internet computers technology that enables the integration to happen successfully? Why is that meaningful for an end-user?

We have chain key cryptography, which is what we use to have all the different subnets securely communicate with each other. This is very close to what we need for bitcoin integration. To make that chain key cryptography work, each subnet blockchain that we have in Internet Computer has one public key for which the secret key is shared among all the nodes that power that subnet. This is exactly the same approach that we take to secure the ECDSA signing keys for the bitcoin integration. There’s a nice synergy that we take exactly the same approach of threshold signatures to realize that. There was still some work because the signature scheme that we used is not the one that bitcoin uses. But still, our experience with one really helped with the other.

Once the integration is complete, what will bitcoin holders be able to do that they could not have done before?

Traditional users would be able to take part in the same kind of DeFi boom explosion that they’ve seen in Ethereum. That’s not to say there isn’t DeFi bitcoin, but it usually does use like we’re talking about trust and bridges. It is not as native as a theorem, but you would see things like faster finality, liquidity pools. Basically, it would really inject steroids into the deep ecosystem of Bitcoin. If you’re a bitcoin user, you’re aware that there are certain limitations about using bitcoin, it’s slower, fewer transactions per second. A lot of those things will be alleviated significantly by Internet Computer integration.

What does this integration mean for people who have been in the internet computer community?

The most obvious one is that, starting to think about the new entrance as the new smart contract developers into space. A new smart somebody who is an engineer wants to choose where to get into the web today, or “I want to get into crypto, where do I get into first”. They usually evaluate 2 columns. The first column in a particular order is “how easy is it”, “what is the programming environment and do I understand it”, “is it fast enough for my use case”, “is it scalable enough”, “is it expressive enough”. The other column you look like is usually things like “how big is the opportunity”. Bitcoin integration would give new smart contract developers the best of both worlds. It would give them the IC smart contracts which are very expressive and very powerful, and then it would also give them access to the liquidity and the pool of bitcoin which is the largest crypto in the world. It would make it a lot easier decision for new entrants to the IC world. For the bitcoin world to write smart contracts, so now someone who really believes in the bitcoin may now be able to write some more codes for bitcoins and not have to go to another later.

There are a lot of people building Dapps on IC right now. what do you want people to do with it? When the integration goes live, what new use cases do you expect to see from the community?

We can’t say that there’s definitely a lot of low-hanging fruit of DeFi that is not possible currently in Bitcoin. I think we’re going to see a lot of lending liquidity pools, and we’re going to give ICP entrepreneurs the ability to jump in.

As a first step, it is very cool to see all the DeFi things that we’ve already seen on Ethereum. Another thing that will be cool is, Diego already hinted at it, wrapped bitcoin on Internet Computer in a way that you don’t have an external trusted party. I guess you’re familiar with things like wrapped Bitcoin on Ethereum or other forms of wrapped tokens on a different chain. They’re typically some entity or group of entities that say, “if you give me a wrapped token, I will give you a real token back”. This is one external part that you may need to trust a little bit. One cool thing that we can do with this direct integration with bitcoin is that you can write a canister on the internet computer, like a smart contract that does this wrapping for you. So the canister can hold real bitcoins. Real bitcoins are always slow because they happen on the real Bitcoin blockchain. Then it can, instead “if you give me a real bitcoin and I will give you a wrapped bitcoin back”, and that wrapped bitcoin is a native token to the internet computer. That is going to be transferred very quickly. There you can have finality in second and high transaction throughput. That will enable a lot of cool use cases.

This brings up another point: is Bitcoin the last stop here? Could ICP integrate with other chains in a meaningful and safe way for users? What would that look like?

On a technical level, we can envision many more integrations. This threshold ECDSA signatures work that we’re doing now is very transferable to other projects. Many blockchains use those types of signatures to authenticate transactions going into that system. That’s one piece that will carry over very nicely to other integrations.

There is definitely something we have been telegraphing. We’ve been talking about blockchain singularity and we usually say bitcoin, Ethereum, IC, we’ve been pretty transparent that we are obviously integrating with bitcoin but we also want IC to be integrated with Ethereum. Imagine a smart contract where it could have it could have integrated with the DeFi ecosystem hold bitcoins, maybe even swap it to each other, and the entire front is then secure because it is hosted on-chain. That is the kind of world that we see where you could leverage the DeFi ecosystem of Ethereum with the asset size of bitcoin and the security properties of the user experience of IC. I definitely think that the if there make the system, for example, would benefit a lot from having a much more user-friendly experience and a much more secure one that could happen from unchained Dapps.

DFINITY has this 200-person team, many of whom are cryptographic researchers and engineers. How many people are working on the bitcoin integration at DFINITY? What does their process look like?

We talked about these different pillars of the project before, and one big pillar is this ECDSA work that probably has maybe 10 people working on it or so. Then we have this other line of work on getting the bitcoin blockchain into the internet computer, which is a similar size project. Maybe around 20 people whose main focus is this. About the way we work, one challenge in projects like this is how you combine the more research side and the more engineering side. The risk there is that either you only focus on the building but then maybe you overlook the academic rigor and the cryptographic protocol security that you need. But on the other hand, often that if you have a research division it’s kind of a separate team in their ivory tower, detached from the real engineering world. What we do is we have a lot of people with academic backgrounds, a lot of cryptographers, and distributed systems professionals. They are in our research branch, and they are part of the engineering team. We try to make everybody work very closely together on this, which helps a lot to get something like this done. It is probably less than a month ago that Victor published his paper on the ECDSA protocol that we are using while we already have most of it working in code. So the gap between theory and practice is relatively small.

Could you share your timeline as well? What is the exact date of the release? Some people were following the Community forum and noticed that we were experiencing some challenges and that it will not be done in Q1 2020. Can you share the process and the exact timing of some of these milestones?

Diego: For the first half, we did release a developer API of the bitcoin integration so that people could play with it. As people can play with the developer API as well as internally we could learn about what is working and what is not, so that we can fix it. Phase 2 is deploying it to a particular subnet with warm people that “hey this still in beta mode”. Then the last phase is to actually deploy to all the subnets.

Manu: Indeed we mentioned Q1 as the target date for the next milestone, I think we will probably miss that by a couple of weeks. But it is definitely coming along nicely and we’re making a lot of progress. You’ll see it hopefully soon.

Diego: We will not be hours or days past March 31st, but it’s not going to be months past March 31st, rather weeks.

The bitcoin integration means that we can receive and send bitcoin on the Internet Computer Blockchain, like wrapped bitcoin on Ethereum blockchain, is that really as simple as it is?

Manu: Almost. From a functional perspective, that is right. From a technical perspective, it is more secure in the sense that wrapped bitcoin is not really bitcoin. It’s a different token on a different blockchain. We just have a group of people that say, “they’re equivalent, you might as well have a wrapped Bitcoin or a real Bitcoin”. What we had our canister on the internet computer to do is to have real bitcoin. The real bitcoin on the real bitcoin blockchain is just controlled by a canister.

Diego: Related to the recent news cycle, there is a lot of things in crypto but like protocol was hacked and you know $10 million, a $100 million. Most of the time it is rare that the layer one protocol is actually the one attack. It’s usually the bridge. It means that the bitcoin that will be in the IC smart contract would be as secure as the internet computer is, which is a much higher level of security than the bridge. Functionally, it appears the same, but the security threshold is a lot higher. In the news that’s why you hear about it a lot, most of the hacks you hear about are the bridges themselves, not the actual layer ones.

What would be possible to deploy a contract on ICP for stable coins backed by bitcoin as collateral, tradeable in multiple magnets?

Manu: I’m not super familiar with exactly how all these stable coins work is backed, but I think this should be possible. As a canister developer, you can ride canisters or smart contracts that have full programmatic control over Bitcoin. That allows you to do probably anything that you need to do. One separate step that you need is, I imagine, you need price information. You need to know how the markets develop to keep your coins stable. For that, we have a separate feature ongoing that would allow canisters on Internet Computer to make secure HTTP requests outside the system where the blockchain will still reach consensus on the answer, so it’ll still be secure and agreed upon. That’s a separate feature that you can use to get prices like real-world market prices into your canister. With those two ingredients, I would imagine that you can. build something like this question suggests.

When using Bitcoin in a DeFi canister, is it possible that you still have total control over the bitcoin address you send your funds to, or does the DeFi platform need to have control over this key partly or even complete? This is more about ownership of the bitcoin address itself. Is the DeFi platform as the individual or what does that look like in this proposed implementation.

Manu: Typically for DeFi, what you need is that the smart contract actually has some control over the assets. If I want to use bitcoin as collateral, it means that they should be able to take my bitcoin under certain circumstances. I think it is kind of like a prerequisite for a lot of different applications that the kind of smart contract does have access to the bitcoin. The smart contract is the controller of the bitcoins. You are not sending your bitcoins away. The fact that it is a canister smart contract that holds your bitcoin. You can inspect the kind of source code and convince yourself that it follows the rules of whatever DeFi application you want it to be, and therefore does not just run off with your bitcoins.

Do you have the ability to bring bitcoin to the internet computer? Is there anything that we are able to do on the bitcoin blockchain? Is there a separation? Is it like one implementation that does all of this, or two different implementations occurring here, where is one you bring to wrap and go for a faster transaction speed on the internet computer, or versus another type of invitation where you can do smart contract activity on bitcoin, or just under the one that brings the same action?

Diego: Holistically they are all part of the same project from this one set of documents that will tell developers how to have their smart contracts on Bitcoin. Whether there is a choice for the developer and ultimately the user, there will be a fork in the road. Whenever a developer wants to essentially cash out that can only move as fast as bitcoin does. If you want the pure bitcoin that can move as fast as bitcoin can, which is obviously very slow. But if it is wrapped within the IC world, it could move very fast. The pattern that I expect is one where people move bitcoin into IC smart contracts, maybe rapid, may do lots of transactions will be between lots of IC smart contracts back here over there. And then when somebody wants to cash out or remove or exit out of the system, then that would actually integrate deal with the bitcoin network and that might take 10 minutes, 20 minutes, 30 minutes to actually get out. So I foresee a world where people are just on-ramp on and then that has a lot of rapid and very cheap transactions.

I had a question regarding any thoughts or plans around the garbage collection on canisters. If I have a canister that I’ve sent some bitcoin to, and it holds some bitcoin and the canister is the controller of that bitcoin and then it runs out of the cycles and gets garbage collected. Is that bitcoin gone forever because the private key for that canister is now no longer capable?

Manu: Your canister does not immediately get like destroyed as soon as you run out of cycles. It got free threshold or something like that. It’s almost your canister first gets like hibernated and it will be in that stage for a very long time before it gets uninstalled. During that time you should top up your canister and then it just comes back and you will get access back to the same signing key. So you would still have access to your bitcoins. Maybe as a separate thing, there are already some tools built to automatically top up your canisters.

To my understanding, every canister will have a bitcoin private key, how will this private key be derived? Would it ever be possible for me to plug in my treasure one and integrated it into my plug wallet to pay for my NFTs directly? Would that ever be able to happen?

Manu: two questions are asked here:

(1) How is that key stored?

What we plan to do is that one of the blockchains in your computer has one secret key as a whole. They have one kind of public key and one corresponding secret key. The secret key should not just be known. It’s split into many pieces and all the different machines that power that subnets all have one piece of the corresponding secret key. Only when sufficiently many of them come together and agree to sign as a transaction or whatever else you want to sign with ESDSA. Only when they collaborate, you get a full signature back. Now we have one public key and one secret key, but we want to have keys per canister, what we do is something like BIP 32 we essentially derive different keys from that one master key if you will. Each canister can ask its own public key that the canister itself controls, which is derived from this root key. In fact, it requests many different keys because we can derive even more keys more subkeys again via BIP 32 Style Key derivation.

(2) Can I integrate my treasure seed phrase into my plug wallet?

This currently is not s on the road map because all these keys are secret shared things that we’ve set up in a decentralized way. It was never a central key to keep it as secure as we can. It’s an interesting use case that we can think about enabling down the road, but that will not be there immediately.

Jordan: I think it doesn’t really matter if your canister gets garbage collected because the master key is going to be stored by the subnet. The master key is able to control all keys that are derived from it, so I don’t think a garbage collected canister would lose funds.

Manu: Yeah, that’s correct. Theoretically, the key still exists to spend those bitcoins. The challenge is that, because we derive for a canister ID specific key and only canister X is the only one that can request signatures based on the key derived for canister X. If your canister gets uninstalled, you need to make sure you get the same canister ID back to really be authorized to make those calls. So theoretically in the system the information still exists to take those bitcoins, but I don’t think there are any practical hurdles to make that happen.

Jordan: The canisters have access to a threshold sign keeper essentially but that threshold sign keeper is going to be controlled by normal principles on the internet computer which have their own key pairs. So plug and the Internet identity for example, they’re basically managing key pairs for you. If the plug or the internet identity offered integration with a hardware wallet then you should be able to technically control your bitcoin stored on the internet computer through a hardware wallet. I don’t think you would need any changes to the bitcoin integration. It would be basically the canister and the wallet that could implement that. Does that sound along the correct lines?

Manu: I fully agree with that. I think the challenge is more about today I have a ledger nano lying here on which I hold bitcoin, can I now answer my seat phrase somewhere and then seamlessly control those bitcoins from the internet computer. That path of entry is something we don’t have yet.

Do you think bitcoiners will be happy with this setup because they believe in not your keys, not your crypto? Even though there will be threshold key pairs, you will not be able to truly own a coin on the internet computer. You will have to rely on the key pair being controlled by the subnet basically. I wonder how bitcoiners will feel about that?

Diego: It relies on the trust of the community as to how truly tamper-proof the IC is. The more trust there is about the tamper-proof qualities of the IC, it will be a sliding scale of people who are more comfortable with it or less comfortable with it. I think because the trust about this transition will make tamper-proof properties become stronger, we’ll see more OK with it. This is not only about technology and engineering, but human trust also. It’s very likely that we will take time in marketing as well.

MetaMatty: It also becomes to what you want to do with your bitcoin and how risk-averse you might be because the trust will be like a correlation with also the application and the benefits that you receive from this.

Diego: I expect people who just wanna hold — not to do this, but people who want to take a chance of DeFi, which is already a risky adventure, might be more willing for some extra percentage points.

--

--

blockpunk
ICP League

Co-founder of ICP League & Ourea Group, obsessed with Social Tokens, DAO & NFT.