Skip to content

Instantly share code, notes, and snippets.

@cgcardona
Last active July 18, 2018 07:07
Show Gist options
  • Save cgcardona/3c45546c86084d5a3288b745fbfcec50 to your computer and use it in GitHub Desktop.
Save cgcardona/3c45546c86084d5a3288b745fbfcec50 to your computer and use it in GitHub Desktop.

Wormhole: A smart contract implementation based on Bitcoin Cash

Wormhole WHC 07.16 18:58 Reading 38325 Author: Chia Chi, Jiang Heping, Wen Long

Summary

Bitcoin Cash (BCH), generated at block heights of 478,558, has been dedicated to bringing a reliable electronic cash to the world and fulfilling its original bitcoin commitment to "point-to-point digital cash." It has global seamless circulation, Permissionless innovation. How to implement the Token in Bitcoin Cash, many developers have already done a lot of research, such as the dyed coin scheme Colored-Coins, then Andrew Stone proposed Enable representative tokens via OP_GROUP on Bitcoin Cash, proposed to increase OP_GROUP The opcode is used to implement the Token scheme. The OP_GROUP solution needs to modify the consensus rules of Bitcoin Cash to be implemented. More specifically, it is similar to those of the popular ERC20 protocol on the Ethereum network.

Any proposal for a certificate-issuing technology that needs to be changed by consensus will inevitably encounter problems. The first is technical risk, and the second is that concerns about this risk often lead to huge controversy in the technology development community and even the entire economic ecology. The concerns of the opponents in the dispute are likely to be true and true. Regardless of who is right or wrong in such a dispute, the result is often that controversial proposals cannot be realized. Such difficulties can be seen as an insurance mechanism, making it difficult for risk changes to be added to the agreement, ensuring the stability and security of the agreement. However, the innovation of the agreement faces enormous difficulties. The controversy that led to the expansion of the independent block of the Bitcoin Cash community, the prolonged and unconstrained generation, is an even more unavoidable evidence of social psychology.

Fast and active innovation requires an environment that does not require a license. We have also been exploring ways to license unlicensed innovation, implementing smart contracts on Bitcoin Cash's blockchain without changing the consensus. After research, we have paid attention to the OmniLayer protocol, which is a scheme for realizing the issuance of certificates through the OP_RETURN opcode. This program is the technical basis for the daily distribution and circulation of the popular TEDA (USDT). The Omni Layer runs on top of Bitcoin's blockchain. The Omni Layer protocol uses the MIT open source license. We fork have agreed on the Omni Layer protocol and implemented the technical solution for issuing certificates on Bitcoin Cash's blockchain. We named this technical solution the Wormhole protocol, and the original token in the agreement was named Wormhole Cash.

the term

• OP_RETURN One of the opcodes in Bitcoin Cash, the transaction output containing this instruction is Unspendable, and the node can safely move it out of the UTXO collection without affecting the total volume of the UTXO collection. After the latest BCH protocol upgrade in May 2018, it can be used to store 220 bytes of metadata.

• The Wormhole protocol is based on the Omni Layer protocol and implements the protocol specification for smart contracts on the Bitcoin Cash blockchain.

• The base currency used in the wormhole cash Wormhole protocol, abbreviated as "WHC".

principle

Wormhole Cash is based on the Bitcoin Cash blockchain and is attached to the Bitcoin Cash blockchain. The BCH blockchain enables basic functions such as issuing, transferring and burning of the pass without changing the existing BCH consensus rules.

The metadata information of the transaction is written on OP_RETURN. Based on the Wormhole protocol, the generation, transfer and burning of the pass are required to be completed through the Bitcoin Cash transaction. Identifying the data in OP_RETURN will complete the release, transfer and burning of Token.

The Wormhole protocol multiplexes Bitcoin Cash's transaction transfer system, which requires identification of transactions, addresses, and OP_RETURN data on the Bitcoin Cash blockchain.

The Wormhole protocol is a superset of the Bitcoin Cash network consensus. The metadata it identifies is only the OP_RETURN data in the consensus protocol of the Bitcoin Cash blockchain, and the consensus rules of Bitcoin Cash do not need to understand the data in OP_RETURN.

achieve

The implementation of the Wormhole protocol is implemented by integrating into Bitcoind. But the consensus rules of Bitcoin Cash itself do not need to be changed. The Bitcoind client that integrates the Wormhole protocol is called the Wormhole client. The node running the Wormhole client will be able to recognize the OP_RETURNWormhole protocol.

Safety and consensus rules

Wormhole Cash has two layers of protection.

The first layer is the transaction security of Bitcoin Cash, and Bitcoin Cash uses the POW mining algorithm as the decentralized timestamp server. The algorithm has been running stably for nearly 10 years. The UTXO model has the following advantages:

• UTXO requires no maintenance balance

• UTXO is an independent data logging unit that speeds up verification transactions

• UTXO model does not need to care about transaction issues, only relational locking scripts and unlocking scripts

• UTXO has high performance when processing transactions

The Wormhole protocol reuses the UTXO security model throughout Bitcoin Cash, using Bitcoin Cash's decentralized timestamp server model.

The second layer of protection is the node running the Wormhole protocol. The data that does not conform to the Wormhole protocol will not be parsed by the nodes of the Wormhole protocol. Each node has the ability to calculate the most recent legal final state of Wormhole Cash by re-parsing the transaction data.

Wormhole Cash (WHC)

Wormhole Cash (WHC) is the base currency in the Wormhole protocol. The reason why the WHC is introduced is because the Wormhole protocol layer cannot control Bitcoin Cash when implementing the smart contract in the Wormhole protocol, so that the transaction cannot be implemented in the Wormhole protocol layer. Moreover, when implementing smart contracts, it is necessary to introduce Gas as a protection against network abuse, and also need a native base currency in the Wormhole protocol.

WHC generation

The WHC is generated by the Proof-of-Burn mechanism. After the Wormhole protocol is officially launched, the WHC can send a minimum of 1 BCH to the bitcoincash:qqqqqqqqqqqqqqqqqqqqqqqqwhc address to generate the WHC. If the number of BCHs sent is less than 1BCH, then no WHC will be generated. This combustion generation process is subject to the risk of rollback in the BCH blockchain. For security reasons, the agreement requires that the generated WHC be used after 1,000 acknowledgments. The conversion ratio generated by combustion is 100 WHC per 1 BCH of combustion.

According to known cryptography theory and engineering practice experience, bitcoincash:qqqqqqqqqqqqqqqqqqqqqqqqqqqqqu08dsyxz98whc address is that no one has a private key. No one used this address in the history of the Bitcoin Cash blockchain until we started working on the development of the Wormhole protocol. In order to guard against the theoretical extremes - there is a method and theory we currently have unknown to construct the private key of this address - the BCH protocol can consider prohibiting the currency of this address from being transferred out for cost. Of course, this is not the scope of the matter that this article and the author of this article need to pay attention to.

After the WHC is issued, if the WHC forms a circulation market, users who need WHC can also purchase WHC from the market.

Why didn't you consider implementing two-way anchoring with BCH? This problem has been fascinated by the study of two-way anchoring problems since the introduction of sidechain theory. But unfortunately, there is no feasible two-way anchoring method, which can be safe and decentralized, and can effectively deal with the inevitable rollback risk of the blockchain. When discussing about Star Trek, Elon Musk said that he immigrated to Mars and planned to stay there without returning. The Wormhole protocol implements smart contracts, has a programming language that is different from Bitcoin Cash, and has a rapidly evolving development plan in the future. This type of combustion generation is very similar to the one-way ticket for Star Trek. Every burnt BCH needs to be prepared for a one-way interplanetary voyage, settled in Wormhole, and will not return.

The process of burning to generate WHC is not set at the cut-off point.

WHC range of use

Fees are often used to prevent abuse of the network, or the use of the network exceeds the performance bottlenecks allowed by current technology and blockchain infrastructure. In the Wormhole agreement, the operation of smart contracts relies on the Bitcoin Cash transaction. The Bitcoin Cash transaction itself has to pay a certain fee, which can already block the DoS attack. Therefore, in the early Wormhole protocol, the transfer does not need to pay the WHC as a fee.

The need to pay WHC as a fee:

  1. The new Token is subject to a 1WHC fee. The handling fee will be burned directly and the total supply of WHC will be reduced. Creating a Token requires the consumption of computing resources. In order to prevent the Wormhole node from being maliciously attacked, the WHC fee is charged.

  2. A large number of address transfers. For example, to send a Token to all addresses that have a certain Token, such operations need to traverse all the addresses, so you need to pay WHC as a fee.

  3. Smart Contract's Gas

  4. Other transactional operations, or other types of operations that are identified as having a DoS risk.

Token's release

After paying the normal BCH transaction fee and the WHC creation fee, anyone can freely create a token on the system.

Currently, the WHC protocol supports three types of Token creation:

Fixed TOken

• Once created, the creator automatically owns all Tokens

• Can't add more, can't burn

• Can't initiate crowdfunding
  1. Can be crowdfunded Token
• Automatically enters crowdfunding after creation

• The creator does not own all Tokens after creation

• After the crowdfunding, the unfinished Token automatically goes to the creator address

• Can't add more, can't burn
  1. Manageable Token
• When creating, the number of Tokens is 0

• Cannot raise crowdfunding

• Can be added, can burn

Token transfer

The created Token and Wormhole Cash can be transferred. The one-to-one transfer does not need to pay any fees except for the necessary BCH transaction fee. The BCH agreement determines the fee.

In addition to paying the necessary BCH transaction fee, the one-to-many transfer also requires payment of a certain WHC fee, which is denominated and charged by the WHC. The 1-to-many transfer is mainly used in the Token airdrop scenario. The fee charged for the WHC will be burned directly.

Token burning

The manually managed Token supports direct combustion, and the Token after combustion shows the total amount after combustion in the Wormhole protocol.

Wormhole Road Map

The development of the Wormhole protocol is divided into four phases: Earth, Tropos, Ionize, Exophere.

Earth (initial)

The Wormhole protocol is separated from the Omni Layer protocol and implements a smart contract solution on the BCH, focusing first on the implementation of the decentralized certificate issuance management function.

In order to ensure the security of the entire protocol, and can be online as soon as possible, we do not support the decentralized transaction function in the Omni Layer protocol at this stage.

The work that needs to be done in the Earth phase:

• Wormhole Core implementation: Porting Token functionality to Bitcoin ABC version 0.17.2, which will be updated with Bitcoin ABC updates

• Publish Wormhole Protocol White Paper

Estimated completion time August 2018

Tropos (fusion)

What needs to be done:

• The decentralized exchange agreement based on the Wormhole protocol was re-launched after careful testing

• Wormhole's Android Wallet Reference Implementation

• Wormhole's iOS wallet reference implementation

• Wormhole's PC-side wallet reference implementation

Estimated completion time November 2018

Ionize (ionization)

What needs to be done:

• Implement ERC721 in the Wormhole protocol

• Develop the Wormhole multi-language implementation SDK. In order to make it easier for developers to develop at Wormhole, we will provide a multi-language SDK for parsing Wormhole.

• Wormhole Cash's Cold Wallet Solution

Estimated completion time January 2019

Exophere

What needs to be done:

• Smart contracts without a license. The Omni Layer itself is not a mechanism for unlicensed innovation. Any new type of contract must be incorporated into the program code to be recognized. We will implement an unlicensed smart contract platform in the Exophere phase. That is, any developer can post a smart contract to the network after complying with the necessary rules for maintaining protocol security.

• Implement the Plasma protocol for capacity expansion. In our internal research, we may have discovered an effective implementation of Plasma, which we will likely implement after further research. At the same time, Vitalik also announced on Twitter that they have discovered a way to implement Plasma, and we can also consider the implementation of Vitalik's upcoming release.

• A new generation of smart contract virtual machines. As a programming language that transforms the ancient concept of smart contracts into reality, Solidity has been extensively reviewed by computer experts. There have been better ideas in recent years. We will consider developing virtual machines for some new programming languages ​​to make the most efficient, developer-based computer languages ​​available for building DApps.

Estimated completion time June 2019

to sum up

First of all, thanks to Omni Layer, their extensive application on the USDT, let us see more things can be done based on Bitcoin Cash. The Omni protocol is a very complete protocol implementation that takes full advantage of the features of the UTXO model and enables Token management without changing the consensus and protocol. The Omni team also gave a lot of help in the process of our development. At the same time, Omni Layer is also adhering to the spirit of the open source movement, using the MIT license, is an important basis for us to achieve unlicensed innovation.

The lack of smart contracts has always been a major weakness of the public chain based on the UTXO model. The Wormhole protocol can also implement smart contracts in the case of fully reconfiguring the security and reliability of UTXO. The Wormhole protocol will bring more to Bitcoin Cash. More possibilities.

Document history

1.Version 0.1 WormholeCash first phase completed 2018-05-23

2.Version 0.2 WormholeCash Roadmap 2018-06-20

3.Version 0.3 WormholeCash alpha version 2018-07-15

references

[1] Satoshi Nakamoto. Bitcoin: A Peer-to-peer Electronic Cash System.
https://bitcoin.org/bitcoin.pdf,Oct 2008. [2] OP_RETURN https://en.bitcoin.it/wiki/OP_RETURN [3] OmniLayer https://github.com/OmniLayer/spec [4] ERC20 Token Standard https://theethereum.wiki/w/index.php/ERC20_Token_Standard [5] The Colored Coins Protocol https://github.com /Colored-Coins/Colored-Coins-Protocol-Specification/wiki [6] Andrew Stone : Enable representative tokens via OP_GROUP on Bitcoin Cash https://github.com/BitcoinUnlimited/BUIP/blob/master/077.mediawiki [7] ERC-721 https://erc721.org/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment