Inspired by ICP's Bitcoin Integration based on Chain-key cryptography and threshold ECDSA signature scheme, we aim to build the integrations (or bridges) from UTXO platforms, like Litecoin-LTC, Cardano-ADA, Dogecoin - DOGE, Bitcoin Cash - BCH, etc, to ICP. Furthermore, we will utilize ICP as a payment and DeFi platform for those crypto-currencies based on decentralized custody protocol (DCP). It is clear that DeFi application on the UTXO platforms is very poor, even zero, although their total market-capitalization is tens of billions USD.
What it does
The project aims to integrate Litecoin, Cardano, Dogecoin, Bitcoin Cash into the ICP system. Then, we will bring LTC, ADA, DOGE, BCH holders to a secure, scalable DeFi space based on ICP canisters, which they haven't ever experienced before, for example:
- Swap the assets for ICP or others on DEXes implemented on the ICP platform;
- Stake or lend the assets to earn interest;
- Make cross-payment between platforms;
Moreover, DeFi, GameFi, Social-Fi developers on the ICP platform can utilize Octan's solutions (asset bridging, cross-chain payment) for their own applications.
How we built it
We use Bitcoin integration as a framework, take advances of threshold ECDSA, Bitcoin adapter implementations, then modify for new UTXO-chains. Firstly, we want to share knowledge about Bitcoin integration on ICP. This is a brief from https://wiki.internetcomputer.org/wiki/Bitcoin_integration The major features of Bitcoin integration:
- Canisters can have Bitcoin addresses (and therefore receive and hold bitcoin directly on the Bitcoin blockchain). (in progress)
- Canisters can access the UTXO set of Bitcoin addresses.
- Canisters can securely sign Bitcoin transactions. (in progress)
- Canisters can submit Bitcoin transactions to the Bitcoin network.
Bitcoin Adapter: connects directly to a predefined Bitcoin network from the config file and starts a local RPC node for listening requests from the canister. With this RPC server, the canister can fetch all blocks and send signed transactions through the Bitcoin adapter.
- Address Book: store Bitcoin network nodes from the config file
- Blockchain Manager: sync and process receive block from blockchain
- Blockchain State: Handle state, header, and fork chain
- Connection Manager: make connections, handle ping/pong nodes, and limit connections to the blockchain.
- Transaction Manager: get and send a transaction with raw data to the Bitcoin node.
- RPC Server: Listen to request from Canister. Handle block requests, and transfer signed transactions to Bitcoin Network.
Bitcoin Canister: connects to the Bitcoin network through the Bitcoin Adapter. It fetches blocks and stores UTXO sets locally. So we can check the BTC Address balance or get address UTXOs in Canister locally without calling to Bitcoin Adapter
- UTXOs: Store all UTXOs for each Bitcoin Address from genesis in Canister. The StableBTreeMap implementation has been amazingly efficient in memory management.
- Transaction: Request replica with consensus mechanism to sign a transaction signature into transaction payload and transaction will be sent to Bitcoin Network through Bitcoin Adapter
From this knowledge we're trying to make an integration for the Litecoin network. Almost all of the core features were written in Rust language. We would like to share some examples of the working process to integrate Litecoin into ICP
- https://github.com/Octan-Finance/rust-litecoin/tree/litecoin-compatible This is a rust-bitcoin fork library for Litecoin network in rust language. It's a core library to work with the Litecoin network.
- https://github.com/Octan-Finance/dfinity-ic/tree/litecoin-demo IC Bitcoin Adapter fork. It's using above rust-litecoin library for communicate to Litecoin Network and fetch block, transaction to canister
- https://github.com/Octan-Finance/dfinity-litecoin-integration Canister Examples. Contains Rust example to receive, send transaction between canister wallet and any litecoin wallets. We are trying to implement ecdsa signing signature feature but we do not have enough time to do that.
- Demo Video: https://youtu.be/_HV36uoetGw
Challenges we ran into
- New blockchain architecture
- New design concept of smartcontracts (canisters), i.e asynchronous DeFi
- New languages (Motoko, Rust)
- Lack of development tools compare to EVM-compatible blockchains
- No official documentation about threshold ECDSA usage
- Rust, Motoko CDK haven’t support system API on threshold ECDSA
Accomplishments that we're proud of
- Modified Bitcoin integration for Litecoin
- Proposed a composable DeFi integration between ICP and UTXO-assets, visit the paper https://drive.google.com/file/d/1dz_0AMqoCzhAmEMFzi7U_8MMq56_ZIQD/view?usp=sharing
- Reuse mock ECDSA prebuild from https://github.com/ninegua/ecdsa_example in wasm
What we learned
- We studied much about Internet Computer protocol and its implementation.
- Clearly understood the vision and architecture of ICP (Ex: the communication between canister by Wasm - ic0 module for system API)
- We learned Bitcoin integration and the capacity to extend on other UTXO-chains
- We learned the deployment process of an threshold ECDSA key (create, reshare as backup, enable sign) and distributed key generation protocol.
What's next for Octan Finance
- We are going to complete the ECDSA signing feature and the testnet implementation of Litecoin integration.
- After that, we will find support/grant to build integrations with Bitcoin Cash, Dogecoin and Cardano.
- In parallel, for each integration, we will build DeFi canisters on ICP to utilize UTXO-assets. This aims to support the holders with DEX, lending and payment facilities.
Log in or sign up for Devpost to join the conversation.