4.4FuelVM和EVM, 轻松搞明白(FuelVM vs. EVM, Explained)

FuelVM learns from the EVM, Solana, WASM, Bitcoin, and Cosmos.

FuelVM向EVM、Solana、WASM、Bitcoin和Cosmos学习。

This page is meant to outline the ways the FuelVM differs compared to the EVM in simple terms.

本页旨在以简单的术语概述FuelVM与EVM相比的不同之处。

FuelVM vs. EVM

FuelVM有一个全局共享的内存结构,而不是情景中的本地内存 (The FuelVM has a globally shared memory architecture instead of context-local memory)

The FuelVM has a globally shared memory architecture. Instead of every contract call having its own separate memory space, call data, and return data, all contract call frames share global memory. This chunk of memory is shared amongst all call frames and is globally readable. This allows you to pass data around between contracts without expensive storage and pass chunks of data without having to serialize, copy from call data to memory, etc. Read more about the FuelVM memory model here.

FuelVM有一个全局共享的内存架构。每个合约调用都有自己独立的内存空间、调用数据和返回数据,而不是所有合约调用框架都共享全局内存。这块内存在所有调用框架之间共享,并且是全局可读的。这允许你在合约之间传递数据,而不需要昂贵的存储,传递数据块也不需要序列化和从调用数据复制到内存,等等。这里阅读更多关于FuelVM内存模型的信息。

FuelVM 专为欺诈证明而设计 (The FuelVM is designed for fraud-provability)

The EVM is a complicated machine to construct fraud proofs for. It usually requires a second layer such as WASM or MIPS to be interpreted into a fraud provable system. Check out User Sovereignty with Fraud Proofs and how fraud proofs unlock key functionality.

构建欺诈证明,对EVM 来说就十分复杂。它通常需要第二层,如 WASM 或 MIPS,才能被解释为欺诈可证明的系统。查看带有欺诈证明的用户主权欺诈证明如何解锁关键功能

FuelVM 有多个原生资产 (FuelVM has multiple native assets)

In Ethereum, the only native asset is Ether. It’s the only one that gets first-class treatment in terms of cost and ability to be pushed and pulled through a call. In Fuel, any contract can mint its UTXO-based native asset using a set of easy asset opcodes. All of which can gain the benefits of native-level call and optimization. Read more about support for multiple native assets in the Sway docs, and here.

在以太坊中,唯一的原生资产是以Ether。它是唯一在成本与通过调用来“折腾”的能力两方面,(都)获得一流待遇的产品。在 Fuel 中,任何合约都可以使用一组简单的资产操作码来铸造其基于 UTXO 的原生资产。所有这些都可以获得原生级别调用和优化的好处。查看 Sway 文档此处

FuelVM使用64位字而不是256位 (FuelVM uses 64-bit words instead of 256-bit)

Modern processors have 64-bit registers, and all of the instruction set operates on 64 bits. Those are the most efficient instructions, and when you deal with 256 bits, you’re dealing with big numbers, and since modern processors aren't made to handle those numbers natively, it means you have to do more in the software.

现代处理器有64位寄存器,所有的指令集都在64位上运行。这些都是最有效的指令,当你处理256位时,你要处理的是大数字,由于现代处理器不是用来处理这些数字的,这意味着你必须在软件中做更多的工作。

FuelVM是基于寄存器而不是基于堆栈的 (The FuelVM is register-based instead of stack-based)

Register-based VMs typically require fewer instructions to do the same work than stack-based VMs. Because every operation is priced, optimizing to reduce the number of operations needed to do the same amount of work has outsized benefits.

与基于堆栈的虚拟机相比,基于寄存器的虚拟机通常需要更少的指令来完成同样的工作。因为每一个操作都是有价的,优化进而减少做同样数量的工作所需的操作数量有很大的好处。

FuelVM从一开始就以原子UTXO范式构建

Fuel uses a system of UTXOs which enable a more efficient system fo transfer and ownership of assets, where the accounts tree doesn't have to be rebuilt every time funds are transferred.

Fuel使用一个UTXO系统,该系统能够实现更有效的资产转移和所有权,账户树不必在每次资金转移时都被重新建立。

The FuelVM移除了 approve, transferFrom (The FuelVM removes approve, transferFrom)

The FuelVM removes the need for approve/transferFrom UX with scripts. Unlike the EVM, the FuelVM has scripts, which allow many actions to happen from an origin sender without a contract being deployed. Read more in the Fuel Specification here.

FuelVM通过脚本消除了对approve/transferFrom用户体验的需求。与EVM不同,FuelVM有脚本,它允许许多行动从原发端发生,而不需要部署合同。在Fuel规范中阅读更多内容这里

在Fuel中实现的EIPs(EIPs Implemented in Fuel)

The FuelVM implements several EIPs that have been suggested and supported by the community but couldn't be implemented due to the need to maintain backward compatibility. Check out a non-exhaustive list, also available here:

FuelVM实现了几个EIPs,这些EIPs已经被社区建议并支持,但由于需要保持向后的兼容性而无法实现。请看一个非详尽的列表,可以在这里 查询:

Last updated