Translation of the article: «A Vision for DeFi in Chia» — Vision of DeFi in Chia by Bram Cohen

  • Novembro 21, 2023

This article will be a translation of the original article “A Vision for DeFi in Chia“ by Bram Cohen about his vision of Chia in the DeFi market. The translation is partially completed and may contain inaccuracies or errors. But you can always read the original article on the official website of Chia or write your comments in the comments.

Chia is attractive not only due to the new Proof of Space and Time algorithm and environmental friendliness, but also its own programming language Chialips. The new programming language is not inferior to Solidity (an object-oriented, subject-oriented programming language for self-executing contracts for the Ethereum platform.), even on the contrary, it is more scalable and flexible in management. We will look at Chialips and its advantages over other systems. How is a decentralized exchange with protection from MEV (miner/farmer extracted value). The topic of automated market makers in Chia (Automated or Automated Liquidity provider (in English «Automated Market Maker» or AMM — is a system that provides liquidity on the exchange where it operates, due to automatic trading)

Chia operates on a coin set model (similar to the UTXO solidity model as Bitcoin and Ethereum): the only constant data is the current set of unspent Chia XCH coins, which have sizes and rules for their use. When we send a coin, we create a new one based on it, and the old one is destroyed forever. All permanent data is stored in coins. This is much better and easier to scale because the data that full nodes need to track is simpler and smaller. Checking the block requires performing all its transactions, the result will be a list of spent and destroyed coins. This allows us to have an effective transaction speed higher than that of Ethereum, while allowing us to easily run the main node on a regular desktop computer. At first glance, it seems that this makes it much more difficult to develop smart coins in Chia, but the alignment of data types provides some advantages.

The main tool of commerce in Chia are colored coins (colored coins). A color coin is a kind of altcoin, a token created on the basis of the Chia blockchain network. A colored coin represents a kind of tokenization with coins of such quantity, whose value when divided is extremely small, but represents something else. By default, a colored coin is divided by a billion. That’s because the maximum division Chia is a trillion mojo (mojo), the smallest indivisible unit, as in bitcoin it is Satoshi.  At first glance, it resembles the Omni protocol (a digital currency and communication protocol that exists on top of the Bitcoin block chain). The main difference from Omni, Chia does not need to run a full node to check coins for fraud. In Chia, all data is stored in the coin itself.

One of the new functionality that our implementation with colored coins provides is the ability to “offer” offers (it’s like placing orders on an exchange where you want to buy or sell an asset). For example, if you want to exchange some Chia for some colored coin, you can create an incomplete transaction that burns some XCH and creates a colored coin instead. The transaction itself will be unconfirmed, but you can send your “offers” to the exchange, email a friend or post on Reddit. Anyone who sees it will be able to accept it by making their partial transaction. The number of planted Chia coins will be equal to the number of issued colored coins, this is called balancing only under such conditions the transaction will take place in the Chia blockchain. This is true, because in the Chia block everything happens at the same time, so the funds “move” in one step from one entrance to another exit, and there is no moment where the coin exists in two places at the same time.

Now let’s talk a little bit about MEV, what is the problem and what can be done about it. Let’s look at a simple example.  Imagine that the current price of Chia is $ 1000, and there is a position to sell 1 XCH at a price from $ 900 to $ 1200 and one offer to buy 1 XCH at a price from $ 800 to $ 1100. The most honest exchange will look like if the buyer and seller conclude a deal at a price of $ 1000 for 1 XCH.  But there is another type of transaction, greedy dishonest is when a person buys Chia for $ 900 and sells for $ 1200, the difference between the prices (spread) is put in his pocket. In normal trading, such an action is called “Spread Assignment” and it is considered a fraudulent scheme. (Link to the Russian-language article where this fraudulent scheme is described in detail тык). In blockchain systems, this is called miner extracted value, abbreviated MEV.

Important note, reasoning about prices: there is no single true fair price for a product. If someone buys a product for a certain price, it means that at the moment there is no product with a cheaper, favorable price, and vice versa if you are a seller,read there is no demand for a product if with a higher price. There are always some errors, failures and noises in the system. In theoretically ideal conditions, markets become very efficient. But theory is always far from practice.  And finding out what the exact or approximate price of a product should be is a complex mechanism of the entire market, and one person cannot determine the price of a product, even if it is verified.

There are exchanges on the market that are trusted, reputation is very important to them and they always support it. They do not put the spread in their pocket, but try to make the price attractive so that it reasonably reflects the supply market.

The mechanism of “Offers” in Chia assumes that the exchange will be able to combine several offers into a single whole and send them to the blockchain so that MEV bots will not be able to divide and extract their profit from this. An exchange that adheres to these rules is always more attractive to the user. Unfortunately, not everyone works honestly and according to such a mechanism, and often the spread is in the pocket of the trading exchange.

Another way to reduce the impact of MEV, which works synergistically with the above, is to use price oracles. (Oracles are services that connect blockchains to the outside world: decentralized applications, other blockchains, trading platforms, cloud providers, IoT devices, payment and corporate systems). In our case, the price oracle reports the current exchange rate. To understand how this works, we first need to explain singletons.

Singleton (singleton) is an identity, an object that is present in exactly one coin at any given time, and where coins can confirm that they interact with the current representative of this identity, the object. NFT is also a singleton, as well as singletons are used in oracles, wallets with a limited tariff.

You can read the technical details of the singleton implementation here. This function has already been created and is used for our standard pool protocol.

window.yaContextCb.push(()=>{
Ya.Context.AdvManager.render({
renderTo: ‘yandex_rtb_R-A-1290038-5’,
blockId: ‘R-A-1290038-5’
})
})

@media screen and (min-width: 1201px) { .arixt64e920790b60c { display: block; } } @media screen and (min-width: 993px) and (max-width: 1200px) { .arixt64e920790b60c { display: block; } } @media screen and (min-width: 769px) and (max-width: 992px) { .arixt64e920790b60c { display: block; } } @media screen and (min-width: 768px) and (max-width: 768px) { .arixt64e920790b60c { display: block; } } @media screen and (max-width: 767px) { .arixt64e920790b60c { display: block; } }

No matter how ridiculous it may sound, but the price oracle, which does not have any protection, informs us about the current price for the product, and it provides significant resistance to MEV.  The number of offers may contain a range of possible prices, but use only the price that is provided by the designated oracle. Since all transactions in the block in Chia occur simultaneously, this means that the miner will be able to make the price too low or too high, but not both options at the same time. In the example above, they could either buy one XCH for $900 and sell it somewhere else for $1000, getting $100 spread, or buy one Chia elsewhere and sell it for $1100, also getting $100. If they had used the capabilities of the price oracle in the example above, they would have been able to earn 2 times more, $ 200.

Ideally, in a healthy market, you should constantly place purchase and sale orders. For a permanent income, the user needs to constantly conduct active trading, have access to the market, have liquidity (this is a characteristic of an economic object or process that describes the ability to quickly and seamlessly carry out certain economic operations), have experience in trading and understand its processes. There are simpler solutions that do not require all of the above said about this now we will burn.

Automated Market makers (AMM), which are network programs that follow a specific trading strategy, have been successfully used for several days. They usually work by having deposits in two different currencies, in our example it can be Chia XCH and a colored coin. AMM accepts deposits and withdrawals according to the rules according to which:

(a) If someone makes a deposit, the rights to the funds that AMM holds are transferred to him in proportion to their contribution,

(b) AMM assumes that the value of the amounts of the two currencies that he holds are equal in order to conduct an exchange. AMM has proven itself well in practice, despite a simple trading strategy. Currency holders can easily provide them with liquidity, being sure that assets will not be stolen.

AMM implementation in Chia

It is not difficult to implement the AMMs (automated market maker) mechanism in Chia, and we will develop it in the foreseeable future.  Deposits are stored by a pair of singletons (for Chia it will be XCH and any color coin), these coins are interconnected, and theirthe movement will be synchronous.

Unlike Solidity, which is used in the Ethereum model, instead of singletons that require information about current deposits, we propose to create our own colored coin for internal use.

Thus, the automated market maker itself needs to know the total amount of its deposits, and user deposits can be stored separately. This approach gives access to the intelligent functions of Chialips, for example, using wallets with limited speed or connecting to other AMMS.

When a user wants to make a deposit using AMM, he creates an offer to exchange part of the funds for some internal use token. The only logic that AMM has to do is to make a transaction decision based on the amount of Chia associated with the colored coin and the coin for internal use. The current AMM markets operate on a similar system, only there are no coins for internal use.

But in practice, the mechanism of proposals will be a little more complicated. The market maker will act as a price oracle, and the offers will use it. In addition, different transactions may conflict, the best approach would be if the exchange combines several small offers, transactions into one large one and sends it to the network. You can even create a hybrid «basically» automatic market maker that requires a specific key to sign all transactions, but follows a predefined business logic about how deposits are moved. This approach expands the possibilities of small exchanges, where the spread is very large due to the possibility of combining several transactions into one and also opens up opportunities for interaction between other exchanges by providing their liquidity while not having to worry about their funds, since the internal mechanism of funds movement works on a colored coin.

From the above, it can be imagined that chia will become a much safer and more liquid market for tokens and there are no analogues to it on the market now. There is a long way of development ahead, but it’s worth it.

You must be logged in to post a comment.