Over the past few months, we’ve been discussing how to bring Bitcoin and other currencies into the Ethereum blockchain in the most secure and user-friendly way possible. The idea is to create an ERC20 Token that represents Bitcoin, which we call BTCT for brevity. Users can create a new BTCT from their existing Bitcoins and then exchange their BTCT for Bitcoins. The applications that BTCT can implement vary, from decentralized switching to payments to advanced financial products. At Kyber Network, allowing users to trade between Bitcoin and other ERC20 tokens is one of our main priorities, as it will help increase trading volumes on the exchange. This article describes some possible solutions to this challenge that we have been considering.
Trust escrow
This is the simplest solution from a technical point of view, and perhaps the easiest to understand. In this approach, there will be a licensed custodian who acts as a trusted third party. The custodian will provide the Bitcoin address for the user to send their Bitcoin, and then they will send back the corresponding number of BTCT tokens to the user. When users want to exchange their BTCT for Bitcoin, they simply send a request to the custodian, who in turn sends bitcoin directly to the user’s address. The custodian may charge a fee for each deposit or withdrawal to fund its operations.
While the custodian does require trust, a big advantage of this solution is that the user can always verify that the custodian has the same amount of Bitcoin in the managed wallet. If the custodian acts dishonestly, the user can take legal action against the custodian using fully transparent public records. This is different from the USDT solution, where users need to trust audit decisions and cannot take independent legal action if an audit is performed. In addition, in a USDT system, audits will not be real-time, meaning that people need to wait for the custodian to prepare the report.
Use smart contracts without trust
The above solution, while it may work well in practice, requires centralized entities as trusted third parties. This conflicts with the idea of decentralization and may even pose some risks. For example, a custodian may break the law and keep users’ money, or communication between the parties may be interrupted or delayed due to inefficient regulatory management. In this section, we present a new solution that utilizes smart contracts to make the issuance and redemption of BTCT completely untrusted.
The solution utilizes BTCRelay, a bitcoin light client that runs in an Ethereum-based smart contract. BTCRelay allows Ethereum smart contracts to validate Bitcoin transactions, thus enabling ethereum online entities to check whether payments on the Bitcoin network have actually taken place.
In this solution, a third party will prepare the initial capital to facilitate the issuance and redemption of the BTCT. Before the user deposits bitcoin, this initial capital will be the required margin, which the user can receive as a refund if any adverse events occur. For simplicity, as an example, Kyber Network could act as a third party and provide margin for ETH and ERC20 tokens in bitcoin contracts. Kyber will then provide the Bitcoin address into which the user can deposit bitcoin to create a BTCT token. After confirming the user’s deposit, Kyber creates a corresponding number of BTCT tokens for the user in the BitcoinToken contract. If Kyber does not issue a new BTCT token, the user can submit that merkle certificate of deposit to the BitcoinToken smart contract, which then communicates with BTCRelay to verify that the user has actually deposited bitcoin into Kyber. If an illegal game is detected, the BitcoinToken contract forfeits part of Kyber’s margin and uses it to pay the user. Other users can also start exchanging BTCT tokens to get their Bitcoins. Since the value of the margin always exceeds the amount of bitcoin currently held by the custodian, the user will receive a margin of Bitcoin. The scenario mentioned above is shown below.
Let’s consider the case of a user who wants to exchange Bitcoin for BTCT. What they need to do is call the “burn function” in the BitcoinToken contract for the bitcoin address they want to receive bitcoin from. Kyber will listen for the destruction event and send the corresponding amount of Bitcoin to the user’s Bitcoin address. If users do not see the payment sent by Kyber, they can challenge Kyber by calling the BitcoinToken smart contract (we may require users to provide some small deposits to prevent abuse of this feature). If Kyber fails to provide valid proof of payment (which it will not be able to do without), Kyber’s deposits will be partially confiscated, so users will receive more ETH and ERC20 tokens to sell their Bitcoins later. Other users, once Kyber fails to pay, can ask to exchange their BTCT.
This approach provides several nice properties on top of trusted managed methods.
- 1. No trust. Users need not trust Kyber Network or any other third party. If anything happens, they can submit proof and Kyber Network will be penalized. The fine amount will be issued to the user who reports the violation, and the user will receive more from the margin than the original value of the bitcoin in the ETH/ERC20 token. Please note that the margin will be large enough for all users to claim bitcoins using the prize.
- 2. Cost effectiveness. When things are good, users don’t have to submit much data, in fact they don’t have to do anything on Ethereum to publish BTCT. They only need to send ethereum a transaction in exchange for their BTCT.
- 3. Publicly verifiable. Everything is transparent and publicly available to the user. Users can verify locked deposits before deciding to publish a BTCT.
However, the downside is that as adoption grows, the solution requires more capital.
The total deposit of ETH and ERC20 tokens must be at least equal to the total amount of BTCT issued plus an additional margin of safety (10%-20%) to account for price fluctuations. For example, for $X of BTCT, we need 1.2 times initial capital. Another major drawback is the potential security risk in cases where untrusted trustees put up billions as collateral. Furthermore, the fact that it is not fully decentralized may mean that the entity can be monopolized by a centralized organization.
Remove BTCRelay to get Evm compatible tokens
Among the above solutions, it was emphasized that BTCRelay would require development and maintenance work, and would be very expensive for ethereum Classic, Litecoin, and other deliveries of ZCash. In addition, processing bitcoin transactions on Ethereum could introduce complications. In this section, we present an alternative solution that does not involve BTCRelay and simplifies the process more effectively. To achieve this goal, we must require another chain to support EVM-based smart contracts. Fortunately, Rootstock will be developed and they are compatible with EVM, they have used the joint side chain to move bitcoin from the Bitcoin blockchain to Rootstock. This solution also works with other cryptocurrencies, such as Ethereum Classic and other Ethereum-based currencies. In this section, when referring to bitcoin below, we will be talking about bitcoin unless otherwise noted.
As with previous solutions, custodians still need to keep their margin on the Ethereum chain, whether in ETH, other ERC20 tokens, or both. In addition, the custodian must put up a small security deposit, say about 5% of the amount of bitcoin currently held. The margin on Rootstock will be deposited in Bitcoin and will penalize custodians if they misbehave at the Rootstock chain.
After the user deposits X Bitcoin into the DepositContract on Rootstock, the custodian will sign a message “X Bitcoin is deposited in Y on Ethereum at Block Z” and submit it to the DepositContract on Rootstock. The custodian will then issue the same number of BTCT tokens on the BitcoinToken contract on Ethereum. Unless the custodian is challenged for failure to pay, only the custodian has the right to remove bitcoin from the Rootstock DepositContract. If the custodian fails to provide a signed message, the user can challenge the Rootstock and get the bitcoin deposited, as well as some bonus money from the custodian margin on the Rootstock. If the custodian fails to issue a new BTCT token on Ethereum after signing the message, the user can use the signed message to issue their OWN BTCT token on Ethereum and subject the custodian to penalties for failing to do his or her duty.
When a user requests to redeem their BTCT token on Ethereum, they call the Burn function on the BitcoinToken contract and provide their Rootstock address to receive their Bitcoins.
The custodian will sign the data saying “exchange X bitcoins to resolve Rootstock’s Y” and submit a message on Ethereum for the bitcoin contract. The custodian then transfers X Bitcoins to the user’s address on Rootstock to complete the exchange. Similar to the issuance process, custodians can be penalized if they either fail to submit signed messages on Ethereum or make bitcoin transfers on the rootstock.
1. The benefits
- No BTCRelay or other transfer links are required, which can be expensive and cumbersome to maintain.
- Since you don’t have to process bitcoin transactions on Ethereum, it’s much easier to implement.
2. The shortcomings
- Evm-compatible smart contracts required (hence Rootstock support for Bitcoin)
conclusion
Given the pros and cons, the approach we follow is likely to be a mixture of all of the above proposals. We wanted to create a trust-free and fully compatible platform for users to move different cryptocurrencies to Ethereum. Specifically, we plan to work with partners who have licenses to host digital assets, and with other crypto funds to fund the margin. We believe this is the best way for us to operate in the long term without compromising security for users or making it more difficult for regulators.
Last but not least, we believe this move is good not only for Kyber Network, but also for the entire ecosystem. So we really want the community to contribute and help us build solutions and improve blockchain adoption together. If you are interested in participating in this program, please contact us by email [email protected].
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Share some interactive online programming tutorials related to blockchain such as Ethereum, EOS and Bitcoin:
- Java Ethereum development tutorial, mainly for Java and Android programmers for blockchain Ethereum development web3J details.
- Python Ethereum is a detailed explanation of blockchain ethereum development by Python engineers using Web3.py.
- PHP Ethereum, mainly introduces the use of PHP for smart contract development interaction, account creation, transactions, transfers, token development, filters and transactions and other content.
- Ethereum introductory course, mainly introduces smart contract and DAPP application development, suitable for entry.
- Ethereum development advanced tutorial, mainly introduces the use of Node.js, mongodb, blockchain, IPFS to achieve decentralized e-commerce DApp combat, suitable for advanced.
- C# ethereum, mainly explains how to use C# based development. Net ethereum applications, including account management, status and transactions, smart contract development and interaction, filters and transactions, etc.
- This course will help you get a quick start on the development of EOS blockchain decentralized applications. It covers core knowledge points such as EOS tool chain, account and wallet, issuing tokens, development and deployment of smart contracts, and interaction between codes and smart contracts. Finally, the development of a notepad DApp will be completed using all knowledge points comprehensively.
- Java development tutorial COINS, this course for beginners, content covers the core concepts of COINS, such as block mechanism, key chain store, decentralized consensus and script, trading and UTXO etc, also explained how to integrate the currency support functions in Java code, such as creating address wallet, tectonic naked trading, management, Is a rare bitcoin development course for Java engineers.
- PHP currency development tutorial, this course for beginners, content covers the core concepts of COINS, such as block mechanism, key chain store, decentralized consensus and script, trading and UTXO etc, also explained how to integrated the currency support functions in PHP code, such as creating address wallet, tectonic naked trading, management, This is a rare bitcoin development course for Php engineers.
- Tendermint blockchain development in detail, this course is suitable for engineers who want to use Tendermint blockchain development, the course content includes the core concepts of tendermint application development model, such as ABCI interface, Merkle tree, multi-version state library, etc., also includes the rich practical code such as token issuance. It is the best choice for go language engineers to quickly start blockchain development.
Huizhi net original translation, reprint please indicate the source. How to bring Bitcoin to the Ethereum blockchain