深入Monad:重新定义交易速度的 EVM 创新

币圈资讯 阅读:64 2024-04-29 06:42:09 评论:0
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

作者:Decentralised.Co 来源:X,@Decentralisedco 翻译:善欧巴,虚拟币交易所平台,数字货币,NFT

大家一直在谈论交易处理速度的问题,最近我们一直在探讨Monad如何提升TPS。这篇文章详细解释了Monad的运作方式。

TPS一直是一个我们关注的指标。我们希望区块链能够支持更高的TPS,以容纳更多用户和应用。下面的图片显示了以太坊和L2的TPS数字。到目前为止,还没有一条链达到100TPS的标准。需要记住的是,TPS只是一个衡量可扩展性的通用概念。因为不是所有交易都一样复杂,所以仅仅使用TPS数据并不十分精确。但是为了方便起见,我们仍然将TPS视为衡量可扩展性的指标。

V3vZLCzlWlfHNYVzS0rP0upjXevPPKWV9SHKQB7f.png

那么提高TPS的方法有哪些呢?

一种方法是像Solana一样,从零开始构建一个全新的系统。Solana为了速度而放弃了与以太坊虚拟机(EVM)的兼容性。它采用多线程执行而不是单线程执行(就好比多核CPU和单核CPU),并行处理交易,并采用不同的共识机制。

第二种方法是使用链下执行并使用中心化排序器来扩展以太坊。

第三种方法是将EVM分解为单独的部分并进行优化以提高可扩展性。

Monad是一条新的EVM兼容的L1区块链,最近筹集了2.25亿美元,它选择从头开始构建EVM而不是直接使用现有版本。Monad采用了第三种方法来提高可扩展性。

接下来我们将讨论Monad引入的一些重大变化。

并行执行

以太坊虚拟机(EVM)串行执行交易。在一个交易执行完成之前,下一个交易必须等待。可以举个例子:想象一个摩托车组装仓库的平台。多辆卡车运来摩托车零件(每辆卡车都装有制造50辆摩托车所需的所有零件)。装配仓库有四个不同的功能,每个功能都由专门的团队负责 - 卸载、分类、组装和装载。

EVM

在当前的EVM设置中,只有一个平台,同一个地点用于装卸货物。因此,当卡车停下来时,摩托车零件会在同一个卡车上卸载、分类、组装和装载。当分类团队工作时,其他团队都在等待。因此,如果把他们的工作视为不同的插槽,那么每个团队每四个插槽中只会工作一次。这导致了严重的效率低下,凸显了需要一种更加简化的方式。

现在想象有四个拥有独立装卸区域的平台。即使卸载团队一次只能处理一辆卡车,他们也不必等待接下来的三个插槽才能进行工作。他们可以直接移到下一辆卡车旁开始工作。

分类、组装和装载团队也是如此。当卡车完成卸载后,它会驶向装载区,等待装载团队装载组装好的摩托车。因此,只有一个平台和装卸区域的仓库会按顺序执行所有操作,而拥有4个平台和不同装卸区域的仓库则可以并行处理任务。

EVM

可以将Monad视为拥有多个卡车平台的仓库基础设施,但它比这个例子复杂得多。当卡车之间存在依赖关系时,复杂性就会增加。例如,如果一辆卡车上没有制造50辆摩托车所需的所有零件怎么办?交易并不总是独立的。因此,当Monad并行执行它们时,它必须处理相互依赖的交易。

如何做到这一点?它执行一种称为乐观并行执行的操作。该协议只能并行执行独立的交易。例如,考虑4笔交易,其中乔尔(Joel)的余额为1 ETH:

  • 乔尔向萨乌拉夫(Saurabh)发送0.2 ETH。

  • 西德(Sid)铸造一个NFT。

  • 乔尔向西德发送0.1 ETH。

  • 什洛克(Shlok)购买PEPE。

所有这些交易都并行执行,具有挂起的待确认结果,这些结果将逐个提交。如果待处理的结果输出与任何交易的原始输入冲突,则会重新执行交易。交易2和4彼此独立,因此它们的待处理结果不会与其他交易的输入冲突。但1和4不是独立的。

请注意,由于所有4笔交易都从相同的初始状态(乔尔余额为1 ETH)开始,因此这里关注的是乔尔的余额。发送0.2 ETH后乔尔的余额变为0.8 ETH。在向西德发送0.1 ETH后,他的余额变为0.9 ETH。结果逐个提交,确保输出不会与任何输入冲突。在1的待处理结果提交后,乔尔的新余额变为0.8 ETH。

这个输出与3的输入冲突。因此,现在用0.8 ETH的输入重新执行3。执行完3之后,乔尔的余额变为0.7 ETH。

MonadDb

EVM

至此,一个明显的问题是,我们如何知道不必重新执行大部分交易?答案在于重新执行并不是瓶颈。瓶颈在于访问以太坊的内存。事实证明,以太坊在数据库中存储其状态的方式使得访问状态变得困难(耗时且昂贵)。这就是Monad另一项改进发挥作用的地方 - MonadDb。Monad以一种减少读取操作相关开销的方式构建了其数据库。

当一个交易需要重新执行时,所有输入都已经缓存在缓存内存中,与访问整体状态相比,缓存内存的访问速度要快得多。

Solana在测试网上拥有5万TPS,但在主网上只有约1千TPS。Monad声称在其内部测试网上实现了1万个实际TPS。尽管这并不总是代表实际性能,但我们迫不及待地想看看Monad在实际应用中的表现。


Digital currency, the platform of Shanouba Virtual Coin Exchange, has been talking about the speed of transaction processing. Recently, we have been discussing how to improve the operation mode explained in detail in this article, which has always been an indicator of our concern. We hope that the blockchain can support higher to accommodate more users and applications. The following picture shows the number of Ethereum. So far, there is no standard reached by a chain. What needs to be remembered is only a general overview to measure scalability. Because not all transactions are equally complicated, it is not very accurate to only use data, but for convenience, we will still regard it as an indicator to measure scalability. So what are the ways to improve it? One way is to build a brand-new system from scratch as usual, and give up compatibility with Ethereum virtual machine for speed. It adopts multi-threaded execution instead of single-threaded execution, just like multi-core and single-core parallel processing transactions and adopting different consensus mechanisms. The second way is to use. The third method to expand Ethereum by executing under the chain and using centralized sorter is to decompose it into separate parts and optimize it to improve the scalability. It is a new and compatible blockchain, which recently raised hundreds of millions of dollars. It chose to build from scratch instead of directly using the existing version, and adopted the third method to improve the scalability. Next, we will discuss some major changes introduced and execute Ethereum virtual machines in parallel to execute transactions. Before one transaction is executed, the next transaction must be completed. Waiting can be an example. Imagine a platform of a motorcycle assembly warehouse. Many trucks transport motorcycle parts. Each truck is equipped with all the parts needed to make a motorcycle. The assembly warehouse has four different functions, and each function is unloaded, classified, assembled and loaded by a special team. In the current setting, there is only one platform and one place for loading and unloading goods, so when the truck stops, motorcycle parts will be unloaded, classified, assembled and loaded on the same truck. His team are all waiting, so if their work is regarded as different slots, each team will only work once every four slots, which leads to serious inefficiency and highlights the need for a more simplified way. Now imagine that there are four platforms with independent loading and unloading areas. Even if the unloading team can only handle one truck at a time, they don't have to wait for the next three slots to start their work. They can directly move to the next truck and start their work. So can the assembly and loading team. In this way, when the truck finishes unloading, it will drive to the loading area and wait for the loading team to load the assembled motorcycle, so the warehouse with only one platform and loading and unloading area will perform all operations in sequence, while the warehouse with two platforms and different loading and unloading areas can process tasks in parallel. It can be regarded as the warehouse infrastructure with multiple truck platforms, but it is much more complicated than this example. When there is a dependency between trucks, the complexity will increase, for example, if a truck does not have a motorcycle factory. What about all the parts needed? Transactions are not always independent, so when they are executed in parallel, it must deal with interdependent transactions. How to do this? It performs an operation called optimistic parallel execution. The protocol can only execute independent transactions in parallel, for example, considering a transaction, in which Joel's balance is Joel's sending a West Germany foundry to Saura, Joel's sending a West Germany Shrock to buy. All these transactions are executed in parallel with pending results. These results will be submitted one by one if. If the output of the pending result conflicts with the original input of any transaction, the transaction will be re-executed and independent of each other, so their pending results will not conflict with the input of other transactions, but the sum is not independent. Please note that since all transactions start from the same initial state, Joel's balance will become the pending settlement after Joel's balance is sent to West Germany, and his balance will be submitted one by one to ensure that the output will not conflict with any input. If Joel's new balance becomes a conflict between the output and the input after submission, Joel's balance becomes so far after the current input is re-executed. The obvious question is how do we know that it is not necessary to re-execute most transactions? The answer is that re-execution is not the bottleneck, but the bottleneck lies in accessing the memory of Ethereum. It turns out that the way Ethereum stores its state in the database makes it difficult, time-consuming and expensive to access the state. This is where another improvement comes into play. When a transaction needs to be re-executed, all the inputs have been cached in the cache memory, and the access speed of the cache memory is much faster than that of accessing the overall state. There are 10,000 in the test network, but only about 1,000 in the main network claim to have realized 10,000 in its internal test network. Although this does not always represent the actual performance, we can't wait to see the performance in practical applications. 比特币今日价格行情网_okx交易所app_永续合约_比特币怎么买卖交易_虚拟币交易所平台

文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明 网址:https://netpsp.com/?id=63690

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
可以去百度分享获取分享代码输入这里。
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
关注我们

若遇到问题,加微信客服---清歌

搜索
排行榜
扫一扫,加我为微信好友加我为微信好友