Becoming the best-performing EVM, the ambition of Trust EVM
Author: EOS Network Foundation
On June 16, 2022, Trust EVM officially launched a live event on Twitter Space themed "How Trust Achieves the Fastest EVM." Matias Romeo, the technical lead of EVM+, and Esteban Saá B, the developer representative from Trust Swap on Trust EVM, attended the event to share insights on the development progress of Trust EVM, the existing architecture of the testnet, real experiences of deploying applications based on Trust EVM, and the follow-up operations on how Trust achieves the fastest EVM.
As an Ethereum Virtual Machine based on the EOS network, Trust EVM provides developers with a turnkey solution. Thanks to its high compatibility, Ethereum native applications can be seamlessly migrated to Trust EVM while offering users low transaction costs. Consequently, after the developer preview version was released on the testnet, many developers have been closely monitoring the performance and future development of Trust EVM. What updates has Trust EVM brought recently? How will the future progress unfold?
The following is the complete content of this event, organized for readers.
Highlights of the Event:
The official will create a plugin for nodes using Silkworm, responsible for providing JSON-RPC requests to the EVM;
Mandel 3.1 RC 1 integrates two new protocol features, and the official plans to activate the new features in the coming week or weeks, while deploying the new EVM runtime on Jungle;
Trust EVM is the perfect infrastructure for EOS, supporting applications for all new ideas. Therefore, we do not want to rest on our laurels. We want to innovate and create, and I believe we can do it.
The process of applying for ENF Grant funding is very simple, thanks to the good organization of the funding framework by the EOS Network Foundation.
Sharing by Matias Romeo, Technical Lead of EVM+
Hello everyone, my sharing will revolve around the progress of the Trust EVM testnet, the upcoming version to be released in the next phase, and how to become the fastest EVM on the EOS network.
Progress of the Trust EVM Testnet
We are integrating some projects into Trust EVM and the new protocol features to be released next month. At the start of the project, we had two directions regarding how to implement a compatibility layer on EOS and how to implement Trust EVM. One option is to implement it on EOS, and the other is to take the form of smart contracts, which are the conventional contracts on EOS. We know that native performance is higher and runs very fast. However, on the other hand, its flexibility is relatively low, and when a new EVM version comes out, it forces all node operators to update their software.
So we decided to adopt the smart contract model. As we all know, EOS has excellent performance and provides us with great flexibility, as EOS contracts can be updated to new versions. Therefore, after considering multiple factors, we believe this is the path we should take.
We developed a C++ smart contract, which can be said to integrate EVM One. EVM One is the fastest Ethereum virtual machine deployed in C++, and its codebase is optimized to provide faster and more efficient EVM smart contracts. However, supporting EVM requires not only an EVM compatibility layer but also a way for developers to access the current state and query history. This is where Web3 JSON-RPC comes into play.
Existing architecture of the Trust EVM testnet
Every Ethereum client implements the JSON-RPC specification. Applications can rely on a set of unified methods to query state information and send transactions, and due to the state of the EVM, smart contracts persist in the EOS state. One possible solution is to map each JSON-RPC request to an EOS state query of the EVM contract. But it is not that simple, as there are specific calls in the JSON-RPC specification that require access to historical states. For example, you can query what is stored at a certain position in a contract, not the current state of the head block, but the past.
Additionally, you can query a specific balance history of an account, or execute a transaction and view the trace, and you can execute that transaction at any block height. So we decided to use a regular Ethereum client in this version of the testnet to serve those tracking JSON-RPC requests. So basically, what we are doing now is having an EVM runtime contract on-chain. After transactions are executed on-chain, we can extract them from the EOS blockchain and the Jungle blockchain.
In this case, once they are applied, we will provide them to the Ethereum client using a peer-to-peer network protocol. We have a Gas node, which is one of the regular Ethereum clients, capable of receiving all transactions applied to EVM contracts on the EOS blockchain and the Jungle blockchain.
Some Existing Limitations
Currently, this solution works well, but we have also identified some limitations. To simplify the Trust EVM architecture we are testing on Jungle, we used the C++ smart contract of EVM One. At the same time, we launched a special service called translation service, which extracts transactions from the blockchain and delivers them to a Gas node.
This Gas node is a node that showcases the JSON-RPC interface to the world, the one you use when connecting with Metamask. You point to one of the Ethereum nodes, and then we have a packager that handles incoming transactions and packages them into an EOSIO TX transaction. Then it pushes it to the runtime contract. But even though the architecture runs well, it has many uncertainties.
Solutions in the Next Version
Therefore, we started to consider using a simpler and more integrated new type of operator. This is where the previous design of EOSIO truly comes into play. A cool feature of the EOS node program is that it is built using Appbase. Appbase is a library that provides a basic framework for building applications from a set of plugins. Appbase manages the plugin lifecycle and ensures that all plugins are in the initial configuration and closed in the propagator.
Thus, you can build an application from a set of plugins. We extend the functionality of the EOS node by writing a custom plugin, which node operators can choose to enable or disable when running their nodes. This is the first part, where we extend the functionality of the EOS node by writing custom C++ plugins. In fact, there are already many plugins, each targeting specific addresses proposed on the EOS node.
Surprises from Silkworm
As we all know, Silkworm is a C++ implementation of the Ethereum protocol, a client written from scratch based on the Erigone architecture, aiming to be the fastest Ethereum client while maintaining high-quality readability of its source code. It has now attracted a lot of attention. Since EOS nodes can be extended with plugins, we have an Ethereum C++ that focuses on solving efficiency issues. We decided to create a plugin for nodes using Silkworm, responsible for providing JSON-RPC requests to the EVM.
Once this plugin is ready, if you want to run your own Trust EVM node, you just need to run the official EOS node with this new plugin, and you will be able to handle JSON-RPC requests, or use it for development purposes, displaying the testnet or mainnet, or even using any other type of configuration.
This greatly simplifies the previous architecture, as all necessary functionalities will be bundled in the same EOS node. If you consider wanting to list some token transactions on Trust EVM, we also considered the operational issues that many moving parts for specific deployments might bring to the development team. Therefore, having only one node with a known configuration is a better architecture than what we currently have, and it is where we ultimately want to go.
New Protocol Features of Mandel
Mandel is the upcoming official EOSIO version that will help us execute EVM runtime. Some special types of contracts are bundled in the fixed address EVM, providing a set of advanced features that are very expensive in terms of computation time. Most of these features, such as hashing and key recovery algorithms, are already supported on EOS. The EVM runtime contracts simply use them, link to them, and utilize these specialized functions. However, some others are not, so we must implement them at the WebAssembly level rather than natively implementing those precompiled contents. The EOSIO protocol has a very good feature that allows it to be extended by adding new protocol features, enabling block producers to activate them at will.
So we have submitted two new protocol features to the official EOS, indicating that we have this new native functionality. At the same time, new features will be added to the EOSIO protocol, which will help accelerate calls to Ethereum precompiled contracts bundled in the EVM. Mandel 3.1 RC 1 integrates all these new features and begins deploying the testnet on Jungle. Therefore, once the BP updates to the newer version and activates these protocol features, the EVM runtime will start using them. For this newer version, we plan to activate these features on June 22. So I believe that within a week or a few weeks, we will see the protocol features activated and the new EVM runtime deployed on Jungle.
I believe we will have a very good combination of flexibility in keeping up with EVM updates because we implemented EVM at the smart contract level. However, these things are computationally expensive, and Ethereum precompiled contracts will be easier to support inherently in these new protocol features. For the RPC part, integrating this new Silkworm plugin into the mainnet will make life easier for node operators who want to run Trust EVM nodes.
Host: Next, let us welcome Mr. Esteban, the head of TrustSwap. Congratulations to the TrustSwap team for receiving funding from the EOS Network Foundation Grant.
Sharing by Esteban Saá B, Head of TrustSwap
Esteban's Connection with Trust EVM
Not long ago, while checking the news, I came across news about Trust EVM, which caught my attention.
I was very curious because there was some interesting information about how we work, how we connect, and some technical decisions surrounding it. So I said, okay, I want to test this out and see what it's all about. I went ahead and configured it, and a few minutes later, I got some coins. I did well. Then I said, okay, I will try to deploy some Solidity contracts. The first smart contract I tried ran very quickly and was very easy to operate. Because of this, I began to value Trust EVM, as I had previously worked with other Ethereum EVMs and Binance Smart Chain. So I could feel how fast this EVM is. I thought, what is this? How can they make it work so fast? So I planned to do one more thing. I started testing some other contracts. Unsurprisingly, everything was running smoothly, and there were no issues with compatibility.
So I began to delve deeper into EOS, joined the community, and started sharing all these things I was doing with the community. I said, "Hey, I deployed this contract, and Trust EVM looks very interesting."
The community was very responsive and provided me with a lot of information. I started testing more contracts and getting feedback from the community. Then we began this information loop; I had never seen such a well-organized community with all these projects, ideas, and progress.
I think this is a fantastic community, and I should go beyond testing and try more challenging things. So the next idea was to try deploying fast-use contracts, and everything performed normally. Then I got the code from UniSwap and easily combined them. It worked like magic—fast, stable, and amazing. When we transact on Trust EVM, the user experience is excellent.
In the end, I think I created something in the community and became a part of it.
Unexpected Progress: Receiving Funding from the EOS Network Foundation
I wanted to build a company around the community, but our team needed some resources, guidance, and support to achieve that. Later, we were guided to the ENF Grant, and the process of applying for funding was very simple. This is thanks to the good organization of the funding framework by the EOS Network Foundation.
If you are also interested, I can roughly describe it: You can clone the GitHub repository, and inside the clone, code, or text, there is a basic information layout, and then fill it out and create a pull request.
That's roughly the process, very simple and smooth. We sent the project outline, which was reviewed by ENF. Then we received some feedback, and later we got the funding. We now have the financial and technical support to create something really great. That is what we are doing.
Features of TrustSwap
TrustSwap is an exciting new AMM exchange built on Trust EVM by me and many active members of the EOS community. We also hope to go further to address an important issue in the ecosystem, which is to showcase the cool aspects within the Trust EVM ecosystem.
We are trying to create services on top of Trust EVM that provide an amazing user experience, allowing your transactions to be fast and low-cost while also informing you during the transaction about "what's cool, what the next star project is, which projects are on the rise, or which projects have peaked." Trust EVM allows us to create these things. Having this compatibility layer is very important for us because you can go further here. You can bring value and export your ideas and products. What we are doing is not just basic trading services, but also providing other more important services, such as current hot projects, which projects are underperforming, etc., allowing you to trade selectively from a wide range of project listings.
This is what we currently have. But we are still striving to improve because we have a solid foundation of a truly fast, scalable, and compatible EVM on which we can build more exciting content. There are a lot of contracts and ideas that can be easily ported to Trust EVM. Good compatibility means you can raise questions and improve them, which will greatly enhance the user experience.
Thanks to the EOS community and the infrastructure they are creating. Because of them, we can turn these ideas into reality and leverage them to create a powerful impact to improve the development of this world. Thank you.