【重温】Bram对Chia DEFI的愿景

In addition to a new consensus algorithm, with Chia we’ve also built a new on-chain programming environment called Chialisp which is just as powerful as Solidity while also being far more auditable, and scalable. It also fosters much better software development practices. As an example of the power of on-chain programming in Chia, and how it differs from Solidity, in this post I’ll give an overview of how it enables truly decentralized exchange with significant defenses against miner/farmer extracted value (MEV). I will also explain the possibilities of automated market makers (AMMs) in Chia.

除了新的共识算法之外,我们还与 Chia 一起构建了一个名为Chialisp 的新链上编程环境,它与 Solidity 一样强大,同时也更具可审计性和可扩展性。它还促进了更好的软件开发实践。作为 Chia 链上编程强大功能的一个例子,以及它与 Solidity 的不同之处,在这篇文章中,我将概述它如何实现真正的去中心化交易,并能明显防御矿工/农民提取价值 (MEV)。我还将解释 Chia 自动化做市商 (AMM) 的可能性。

Chia works in the coin set model (similar to Bitcoin’s UTXO model): The only persistent data is the current set of unspent coins, which have sizes and rules about how they can be spent. When a coin is spent it can make new coins using its value but the original coin is gone forever. All persistent data has to be kept in coins. This is much better for scaling because the data which full nodes have to keep track of is simpler and smaller than the objects which the EVM has to store. Validating a block requires running all of its transactions but the only output is a list of coins which are spent and destroyed. This allows us to have an effective transaction rate greater than Ethereum’s while still allowing a full node to be easily run on an average desktop. At first it looks like this makes it much harder to develop smart coins in Chia, but the flattening of data types comes with some great benefits. Everything interoperates with everything else, and pieces of functionality can be reused and composed on top of each other.

Chia 采用硬币模型(类似于比特币的 UTXO 模型):唯一的持久数据是当前未使用的硬币集,其中包含了币的大小和如何使用它们的规则。当一枚硬币被支付后,它可以使用其价值制造新硬币,但原始硬币将永远消失。所有持久数据都必须保存在硬币中。这对于扩展来说要好得多,因为全节点必须跟踪的数据比 EVM 必须存储的对象更简单且更小。验证一个区块需要运行其所有交易,但唯一的输出是已花费和销毁的代币列表。这使我们能够拥有比以太坊更高的有效交易率,同时仍然允许全节点在普通桌面电脑上就可以轻松运行。乍一看,这使得在 Chia 开发智能货币变得更加困难,但数据类型的扁平化带来了一些巨大的好处。所有事物都可以与其他事物互操作,并且功能片段可以重用并相互组合。

A fundamental tool for doing commerce in Chia is coloured coins. A coloured coin represents a tokenization of some kind, with coin sizes whose melt value is extremely small but represent something else at a high ratio. (The default divisibility of a coloured coin is a billion. There’s room for this because a Chia is a trillion Mojo, which is the smallest indivisible unit, comparable to a Satoshi in Bitcoin). Superficially this sounds like Omni protocol (a colouration format on Bitcoin), but the colouration of coins can be validated in a very lightweight manner. In fact it is so lightweight that even smart coins can do it, unlike in Omni protocol which requires running a full node to find out which coloured coins aren’t counterfeit. This is done while preserving the ability of coloured coins to have just as smart of functionality as non-coloured coins. You could even have a coloured coin implemented in a coloured coin.

在Chia开展商业活动的基本工具是彩色硬币。彩色硬币代表了一种代币化,其硬币尺寸的熔化值极小,但可以很高的比例代表其他东西。(彩色币的默认整除性是十亿。这是有空间的,因为一枚 Chia 是一万亿 Mojo,Mojo是最小的不可分割单位,相当于比特币中的 Satoshi)。表面上这听起来像 Omni 协议(比特币的一种着色格式),但硬币的着色可以以非常轻量级的方式进行验证。事实上,它是如此轻量级,甚至智能硬币也可以做到这一点,这与 Omni 协议不同,Omni 协议需要运行一个完整的节点来找出哪些彩色硬币不是伪造的。这样做的同时保留了彩色硬币与非彩色硬币一样的智能功能。您甚至可以在彩色硬币中植入彩色硬币。

One of the new pieces of functionality which our coloured coin implementation enables is that it allows ‘offers’. For example, if you want to trade some chia for some of a coloured coin, you can make an unfinished transaction which burns some chia and prints some of the coloured coin. This will be an invalid transaction by itself but you can take your offer and send it to an exchange, or email it to a friend, or post it on reddit. Whoever receives it will be able to accept the offer by making their own partial transaction which prints a counterbalancing amount of chia and burns a counterbalancing amount of coloured coin and combining with yours to make a valid transaction which will go through on the blockchain. This is valid because in Chia everything in a block happens simultaneously so the funds ‘move’ in one step from one input to the other output without there being any moment where too many coins exist. In fact it’s possible for a third party to do bookmaking of multiple offers of a variety of different assets and as long as the amounts add up, everything will go through.

我们的彩色硬币所实现的新功能之一是它允许“Offer(报价)”。例如,如果您想用一些Chia交换一些彩色硬币,您可以进行未完成的交易,燃烧一些Chia并打印一些彩色硬币。它本身是无效交易,但您可以接受您的报价并将其发送到交易所,或通过电子邮件发送给朋友,或将其发布在 reddit 上。无论谁收到它,都可以通过进行自己这部分的交易来接受报价,这部分交易会打印对等数量的Chia并燃烧对等数量的彩色硬币,并与您的这部分结合起来形成有效的交易,该交易将在区块链上进行。这是有效的,因为在 Chia 中,一个区块中的所有内容都是同时发生的,因此资金一步步从一个输入“移动”到另一个输出,而不会存在太多代币。事实上,第三方可以对各种不同资产的多个报价进行登记,只要金额加起来,一切都会顺利通过。

To understand miner extracted value, how it’s a problem, and what can be done about it, let’s go through an example. Let’s say the current ‘true’ price of chia (which it’s trading at in high volumes elsewhere) is $1000, and there’s one offer to sell one chia for anywhere between $900 and $1200 and one offer to buy one chia for between $800 and $1100. This can be done through offers on chain if there’s a reasonably trustworthy stablecoin. In this case a completely honest/altruistic exchange would match the buyer and seller at a price of $1000 while a maximally greedy/dishonest one would buy one chia for $900 and sell it for $1100 and pocket the $200 difference. If miners/farmers are the ones doing bookmaking they have no reputation to maintain and should be assumed to be maximally greedy. In blockchains this is called ‘miner extracted value’ while in finance it’s called ‘pocketing the spread’.

为了了解矿工提取的价值,它如何成为了一个问题,以及可以采取哪些措施,让我们看一个例子。假设当前Chia的“真实”价格(在其他地方大量交易的价格)为 1000 美元,有一份报价以 900 至 1200 美元之间的价格出售一枚Chia,另一份报价以 800 至 1100 美元之间的价格购买一枚Chia。如果有相当值得信赖的稳定币,这可以通过链上报价来完成。在这种情况下,完全诚实/无私的交换将以 1000 美元的价格匹配买家和卖家,而极度贪婪/不诚实的交易会以 900 美元购买一枚Chia,然后以 1100 美元出售,从而将 200 美元的差价收入囊中。如果矿工/农民是做登记簿的人,由于他们没有声誉需要维护,应该可以认为是最大程度的贪婪。在区块链中,这被称为“矿工提取价值”,而在金融领域,这被称为“将价差装进口袋”。

An important note about prices: There is no one true fair price of a thing. There are prices paid for things, and ideally when someone buys a thing there isn’t a cheaper price they could have bought an identical thing for and when someone sells a thing there isn’t a greater price they could have sold it for. There’s always some noise and slop in the system and even in theoretically ideal circumstances markets become very efficient but not so efficient that whoever’s putting the market together doesn’t have a way of staying in business doing so. Figuring out what prices ‘should’ be, or at least approximating that reasonably, is the whole job of a marketplace. Designating someone to report a ‘true’ price of a thing doesn’t fix the problem. Even if that person is ‘honest’ no one individual knows all the information in the world or has all the insights into how to guess future prices. That individual’s weaknesses will be a direct opening into market participants getting exploited.

关于价格的一个重要注意事项:一件东西没有一个真正公平的价格。东西是有价格的,理想情况下,当有人买东西时,他们不可能以更便宜的价格购买同样的东西,而当有人出售东西时,他们不可能以更高的价格出售它。系统中总是存在一些噪音和偏差,即使在理论上理想的情况下,市场也会变得非常有效,但效率并不高,以至于无论谁将市场整合在一起,都无法继续经营下去。弄清楚价格“应该”是什么,或者至少合理地接近这个价格,是市场的全部工作。指定某人报告某物的“真实”价格并不能解决问题。即使这个人是“诚实的”,也没有人知道世界上所有的信息,或者拥有如何猜测未来价格的所有见解。这个人的弱点将是直接让市场参与者受到剥削。

There is a real role in markets for large bookmakers which, unlike miners/farmers, have a reputation to maintain and are trusted to not pocket the spread and set prices in a way which is reasonably representative of the total set of offers. With Chia offers it’s possible for a bookmaker to aggregate several offers together and introduce them to the blockchain as a single unit so a farmer can’t piecemeal remove some of them to their own advantage. An exchange which does this is trusted a little but the worst thing they could do is pocket the spread. A more traditional trusted blockchain exchange can simply pocket everyone’s money or treat deposits as a no interest loan and invest them in high risk investments on the back end and keep the returns for themselves.

大型登记公司在市场中发挥着真正的作用,与矿工/农民不同,大型登记公司享有良好的声誉,并且被信任不会将点差收入囊中,并以合理代表全部报价的方式设定价格。通过 Chia 报价,登记公司可以将多个报价聚合在一起,并将它们作为一个单元引入区块链,这样农民就无法为了自己的利益而零碎地删除其中一些报价。这样做的交易所会受到一些信任,但他们能做的最糟糕的事情就是将点差收入囊中。更传统的可信区块链交易所可以简单地将每个人的钱装进口袋或将存款视为无息贷款,并将其投资于后端的高风险投资,并为自己保留回报。

Another way of reducing MEV which works synergistically with the above is to have price oracles. (In computer science, things which report difficult to find or compute information are called ‘oracles’.) A price oracle reports a current exchange rate. To understand how this works we first need to explain singletons.

与上述方法协同作用的另一种减少 MEV 的方法是使用价格预言机。(在计算机科学中,报告难以查找或计算信息的事物被称为“预言机”。)价格预言机报告当前汇率。为了理解它是如何工作的,我们首先需要解释单例。

A singleton is an identity which is embodied by exactly one coin at any given time, and where it’s possible for coins to validate that they’re interacting with the current representative of that identity. It’s similar to, but simpler than, coloured coins. An NFT is barely more than a raw singleton. Singletons are also the foundation of rate limited wallets, distributed identities, pool protocol, and price oracles.

单例是一种在任何给定时间由一枚代币体现的身份,并且代币可以验证它们是否正在与该身份的当前代表进行交互。它类似于彩色硬币,但比彩色硬币更简单。NFT 只不过是一个原始的单例。单例也是限速钱包、分布式身份、矿池协议和价格预言机的基础。

You can read the technical details of how singletons are implemented here. This functionality has already been built and used for our standard pooling protocol. You can review the source of how we’ve implemented a prototype of coloured coins that I originally introduced here. We will update this once we update our coloured coin implementation details on chialisp.com.

您可以在此处阅读有关如何实现单例的技术细节(https://chialisp.com/docs/puzzles/singletons)。此功能已经构建并用于我们的标准矿池协议。您可以回顾一下我最初在这里介绍的我们如何实现彩色硬币原型的来源。一旦我们在 chialisp.com 上更新了彩色硬币的实施细节,我们就会更新这一点。

As ridiculous as it sounds, a price oracle which has no security on it whatsoever other than that it only reports one price per block provides significant resistance to MEV. Offers can be made to support a range of possible prices but only use the one provided by the designated oracle. Because all transactions in a block in Chia happen simultaneously, this means a malicious miner can make the price too low or too high but not both. In the example given above they could either buy one chia for $900 and sell it elsewhere for $1000 making $100 or buy one chia elsewhere and sell it for $1100 also making $100 but both are better than the example with no price oracle where they could pull off both and make $200 without even having to make an external transaction.

尽管听起来很荒谬,但除了每个区块只报告一个价格之外没有任何安全保障的价格预言机对 MEV 产生了巨大的阻力。可以提供支持一系列可能价格的报价,但仅使用指定预言机提供的价格。由于 Chia 区块中的所有交易同时发生,这意味着恶意矿工可以使价格过低或过高,但不能两者兼而有之。在上面给出的示例中,他们可以以 900 美元的价格购买一枚Chia,然后以 1000 美元的价格在其他地方出售,从而赚取 100 美元,或者在其他地方购买一枚Chia,然后以 1100 美元的价格出售,同样赚取 100 美元,但这两种方式都比没有价格预言机的示例更好,他们可以在其中实现两者都可以赚取 200 美元,甚至无需进行外部交易。

Ideally in a healthy market you want offers to buy and sell posted at all times. In order for someone to successfully turn a profit actively trading at all times, they need access to orders, liquidity of their own to trade, and expertise in trading. Or maybe they don’t need expertise in trading and one weird trick will do. Automated market makers (AMMs), which are on-chain programs which follow a defined trading strategy have been very successful. Generally they work by having deposits of two different currencies, in our example they could be chia and a coloured coin. The AMM then accepts deposits and withdrawals with the rules that (a) If someone makes a deposit they’re given claims to the funds the AMM holds in proportion to their contribution and (b) The AMM assumes that the value of the amounts of the two currencies it’s holding are equal to get an exchange rate. AMMs in practice have worked well despite the simple trading strategy because they have a lot of order flow and due to their accessibility. It’s easy for currency holders to provide them liquidity while having confidence that they won’t get ripped off.

理想情况下,在健康的市场中,您希望可以随时发布报价用于买卖。为了让某人在任何时候都能积极交易并成功获利,他们需要获得订单、自己的交易流动性以及交易专业知识。或者也许他们不需要交易方面的专业知识,一个小技巧就可以了。自动做市商(AMM)是遵循既定交易策略的链上程序,非常成功。一般来说,他们通过存有两种不同货币的存款来运作,在我们的例子中,它们可能是Chia和彩色硬币。然后,AMM 接受存款和取款,规则如下:(a) 如果有人存款,他们将按照其出资比例获得 AMM 持有的资金索取权,以及 (b) AMM 假设存款金额的价值它持有的两种货币相等即可获得汇率。尽管交易策略很简单,但 AMM 在实践中运作良好,因为它们有大量订单流并且易于访问。货币持有者很容易为他们提供流动性,同时确信自己不会被敲诈。

Implementing an AMM in Chia

在 Chia 实施 AMM

It is straightforward to implement AMMs in Chia, and will be part of future development. The deposits are held by a pair of singletons (in the case of pairing chia with a coloured coin, one coloured and one not) which spend in unison and work together. Unlike in Solidity, instead of the singletons remembering all deposits it’s far more elegant and powerful for the pairing to have its own internal use coloured coin. That way the AMM itself only needs to remember its total deposits and the user deposits can be self-custodied and even support smart functionality like rate limited wallets and ridiculous things like pairing with other AMMs. When a user wants to make a deposit with the AMM, they make an offer to trade some of their own funds for some of the AMM’s internal use token and aggregate that with the AMM accepting the offer. The only logic the AMM has to do is be told by the solution what the new amounts of chia, paired coloured coin, and its internal use coloured coin are and decide whether it’s okay with that. Using the AMM for a currency exchange is the same but the offer is for the tokens being paired without using the internal coin.

在 Chia 实施 AMM 非常简单,并且将成为未来开发的一部分。存款由一对单例持有(在将Chia与彩色硬币配对的情况下,一个有色,一个无色),他们一致支出并共同工作。与 Solidity 不同,交易对拥有自己的内部使用的彩色硬币,而不是让单例记住所有存款,这要优雅和强大得多。这样,AMM 本身只需要记住其总存款,用户存款就可以自我托管,甚至支持诸如限速钱包之类的智能功能以及与其他 AMM 配对等夸张的功能。当用户想要向 AMM 存款时,他们会提出用自己的一些资金换取 AMM 的一些内部使用代币的报价,并将其与接受报价的 AMM 进行汇总。AMM 必须做的唯一逻辑是通过解决方案告知Chia、配对彩色硬币的新数量以及其内部使用的彩色硬币的数量,并决定是否可以接受。使用 AMM 进行货币兑换是相同的,但报价是针对不使用内部硬币进行配对的代币。

In practice offers are likely to be a bit more complicated. The AMM should act as a price oracle and offers should use that. Also, different transactions using the AMM will all conflict so it’s best if there’s an exchange which aggregates them all and introduces the one big transaction to the blockchain. It’s even possible to make a hybrid ‘mostly’ automatic market maker which requires a specified key to sign off on all transactions but follows predefined business logic about how deposits move. That gets the benefits of a lightly trusted exchange which isn’t able to exit scam with everyone’s money, but can still help reduce the spread. This further allows others to provide the liquidity which that exchange uses while still having confidence that their funds are being held properly.

实际上,报价可能会更复杂一些。AMM 应该充当价格预言机,并且报价应该使用它。此外,使用 AMM 的不同交易都会发生冲突,因此最好有一个交易所将所有交易聚合起来并将一笔大交易引入区块链。甚至可以创建一个混合“大部分”自动做市商的AMM,它需要指定的密钥来签署所有交易,但遵循有关存款如何移动的预定义业务逻辑。这样可以利用轻信任度交易所的好处,这种交易所无法保证每个人的钱都退出骗局,但仍然可以帮助减少利差。这进一步允许其他人提供该交易所使用的流动性,同时仍然相信他们的资金被妥善持有。

The combination of all of the above will lead to chia being a far more secure and liquid marketplace for tokens than has ever existed before. There’s a long road ahead to build it but it will be well worth it.

上述所有因素的结合将使 chia 成为一个比以往任何时候都更加安全和流动的代币市场。建设它还有很长的路要走,但这是非常值得的。

 

原创文章,作者:admin,如若转载,请注明出处:https://news.chiahub.co/202307121026041196.html

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

联系我们

400-800-8888

在线咨询:点击这里给我发消息

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息