Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the exchange protocol on bytom MOV chain

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to understand the exchange protocol on the bytom MOV chain". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to understand the exchange protocol on the bytom MOV chain".

The Development of decentralized Exchange Protocol

From Bitshare,Stellar to the Etherdelta,Bancor,0x protocol on Ethernet Square, the decentralized exchange protocol has also gone through several generations of development and many models of exploration, each generation through the previous protocol pain points to improve and deepen.

It is mainly divided into:

Orderbook on chain, settlement on chain

Orderbook under the chain, settlement on the chain

Fund Pool based on Intelligent contract Management

Orderbook on chain, settlement on chain

The earliest successful exploration based on the decentralized exchange agreement of ethernet was Etherdelta, which once occupied half of the decentralized exchange market. Etherdelta is a more complete decentralized mode, user recharge, hanging orders, eating orders, settlement and withdrawal are all completed on the chain.

The specific operating mechanism is as follows:

The entire operation of Etherdelta is completed on the chain, users keep their own private keys, and the platform will not touch user assets, ensuring the security and transparency of assets and exchanges. But its disadvantages are also obvious:

Because all the switching links are completed on the chain, and every operation such as hanging order, withdrawing order, eating order and so on will consume GAS costs, resulting in high delay and low cost-effectiveness.

It is possible for miners to exchange in advance illegally.

Orderbook under the chain, settlement on the chain

In order to solve the problem of inefficiency and low handling fee on the pure chain, 0x protocol introduces the concept of relayer (relay), all orders are sent to relayer, no need to chain, only the transaction will be linked.

The operation mode of "order relay under the chain and final settlement on the chain" of 0x is as follows:

The main problem with the 0x agreement is that if the order is to be shared, every transaction on the exchange using the 0x agreement needs to be broadcast so that other exchanges can know and confirm it, so that the instantaneous transaction cannot be realized by using the 0x protocol alone; in addition, the exchange cost is also increased because of the need to convert ETH into WETH.

Fund Pool based on Intelligent contract Management

The most typical capital pool models are Bancor and Kyber. The so-called capital pool can be understood as that the platform uses intelligent contracts to establish a pool for storing all kinds of assets, and the providers of assets in the capital pool can be ordinary users or market makers.

Introduction of MOV decentralized Exchange Protocol

When we examine various switching protocols, in fact, the exchange protocol on the pure chain is the solution that gives full play to the value of the blockchain. However, due to the performance problems of the public chain such as Ethernet Fong, the solution on the pure chain such as Etherdelta is frustrated, and the under-chain orderbook such as 0x appears to improve the performance. The root of the problem is that its own infrastructure is not perfect, which leads to forced changes. Therefore, the original chain MOV starts to solve the block chain performance problem from the very beginning.

High-speed side chain is the guarantee.

MOV uses high-speed side chain Vapor pro as the underlying infrastructure. Vapor can hold 8000 transactions every 0.5s, that is, 16000 tps per second. In the case of increasing the block and upgrading the node server, there is still room for further improvement. This performance can meet the needs of users during the current off-peak hours and can be comparable to the centralization of the shoulder-to-shoulder part.

At the same time, MOV uses DPoS as the consensus mechanism, although it has lost a certain degree of decentralization, it has increased the threshold for matchmaking on the chain, and raising the threshold for entry can better prevent some miners with bad intentions from making transactions in advance, at the same time, because the matchmaking on the chain itself has a certain income. So through this economic incentive, we can prevent the DPoS's out-of-block nodes from doing evil to destroy the system (the cost of doing evil is higher than the normal benefit of not doing evil).

Order sharing

In order to solve the performance problem, 0x protocol uses under-chain orderbook, but the problem is the separation of orders. Different participants in 0x protocol will not share their own users' orders for their own interests, thus affecting the overall transaction depth, while mov uses on-chain orderbook, all user orders are on the chain, open and transparent, and all consensus nodes involved in matchmaking can share this depth. Thereby enhancing the liquidity of assets on the mov.

Advantages of magnetic contract

Because the UTXO model is based on bitcoin than the original chain, it has a greater advantage to use the magnetic contract on the UTXO model as the exchange protocol, because the UTXO model itself takes assets as the basic unit, and compared with the account model, it is easier and convenient to operate assets. Let's compare the two processes.

Take 0x as an example, the whole interaction process of 0x:

Maker authorizes DEX contract access to its own Token A balance

Maker creates an order (the order has a fixed format) and signs it with a private key

Maker broadcasts orders using any means of communication

Taker accepts the order and is willing to execute it

Taker authorizes DEX contract access to its own Token B balance

Taker submits an order to DEX

DEX verifies the validity of the order and transfers money between two accounts according to the exchange rate on the order.

Then the whole process of magnetic contract is much easier:

Maker creates a magnetic contract (puts its own assets in the magnetic contract and specifies the assets and quantities to be exchanged)

Taker creates a magnetic contract (puts its own assets in the magnetic contract and specifies the assets and quantities to be exchanged)

According to the price and quantity in the contract, the consensus node triggers the magnetic contract that can match and exchanges the assets of the two.

Not only is the process simple, but the poundage will also be lower because of the simplification of the process. We only need to charge a poundage when users set up a magnetic contract. In fact, we can also try a zero poundage, because using the DPoS model, the game between nodes will not be too complicated.

Ecology of cross-chain assets

When we observe the current decentralized exchange protocol on Ethernet Square, we still stay in the ecology of Ethernet Fang. although we cannot deny the ecological strength of Ethernet Square, in fact, the outside world is the larger world. of course, cross-chain is the follow-up main theme, including Cosmos and Polkdot want to do cross-chain things, so MOV considered cross-chain things at the very beginning, mapping assets outside the original chain to the original chain through OFMF. Then form a big ecology that includes all digital assets, users experience the same experience as centralization in mov, and they can trade a variety of assets, and these assets are not in a single chain of ecology.

Detailed explanation of MOV Magnetic contract

Here is a detailed expansion of the MOV magnetic contract to see how it is implemented.

MOV magnetic contract is essentially a pending contract. Both Taker and Maker need to generate such a contract. In essence, there is no distinction between Maker and Taker, but between Maker and Taker according to the sequence of pending orders. In fact, both of them enhance the transaction depth on opposite trading pairs. In fact, they can also be considered to be Maker.

Hanging order trading contract is an advanced version of currency trading contract, the essential purpose of the contract is to lock any number of assets A, willing to exchange assets B at a specific exchange rate. There should be four constants stored inside the contract (the ID of asset A does not need to be stored because the contract locks asset A): the ID of asset B that is expected to be exchanged, the exchange rate that is expected to be exchanged (using the numerator denominator to solve the floating point support problem), and the public key of the hanging user, and the address of asset B accepted by the single user. Contracts can be unlocked in three modes:

All unlocked: asset An in all contracts is converted into asset B and transferred to the address of the pending user.

Partial solution: asset An in part of the contract is converted into asset B and transferred to the address of the pending user, and the remaining asset A locks the round itself (the newly generated UTXO) through the recursive contract mode.

Cancel the hanging order: the hanging user transfers all the assets An in the contract back to their own address through the private key signature.

The code of the magnetic contract Equity is as follows:

MagneticContract source code:contract MagneticContract (requestedAsset: Asset, ratioNumerator: Integer, ratioDenominator: Integer, sellerProgram: Program, standardProgram: Program, sellerKey: PublicKey) locks valueAmount of valueAsset {clause partialTrade (exchangeAmount: Amount) {define actualAmount: Integer = exchangeAmount * ratioDenominator / ratioNumerator verify actualAmount > 0 & & actualAmount

< valueAmount lock exchangeAmount of requestedAsset with sellerProgram lock valueAmount-actualAmount of valueAsset with standardProgram unlock actualAmount of valueAsset } clause fullTrade() { define requestedAmount: Integer = valueAmount * ratioNumerator / ratioDenominator verify requestedAmount >

0 lock requestedAmount of requestedAsset with sellerProgram unlock valueAmount of valueAsset} clause cancel (sellerSig: Signature) {verify checkTxSig (sellerKey, sellerSig) unlock valueAmount of valueAsset}}

FullTrade () is a fully unlocked method; partialTrade () is a partially unlocked method. When a partial unlock is triggered, the unlocked asset is put into a newly generated magnetic contract and waits for the next match; the cancel () method transfers the user's asset back to its own address and cancels the contract.

We are looking at the input parameters of the magnetic contract:

Type MagneticContractArgs struct {RequestedAsset bc.AssetID RatioMolecule int64 RatioDenominator int64 SellerProgram [] byte SellerKey [] byte}

RequestedAsset is the asset you want to exchange, and RatioMolecule,RatioDenominator is the exchange rate of the asset you want to exchange (RatioMolecule/RatioDenominator is the exchange rate). Because the current BVM does not support floating point, this parameter is used as the ratio. SellerProgram,SellerKey is the contract and address of the contract creator, and the target asset must be locked into the contract creator's own account. Careful friends may find that this and Equity contract missing a parameter, that is, standardProgram, then this parameter does not need to be entered by the user, the system will default to complete, standardProgram actually represents the original contract, because part of the match will make part of the asset is still unused, it will still return to the contract.

Finally, a picture is used to describe the magnetic contract more bluntly:

Thank you for your reading, the above is the content of "how to understand the exchange protocol on the bytom MOV chain". After the study of this article, I believe you have a deeper understanding of how to understand the exchange protocol on the bytom MOV chain, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report