[TEVM] An EVM deployed on TON
Abstract
TEVM is a virtual machine built on the Ton blockchain, fully compatible with the Ethereum environment, providing a solution for Ethereum contracts with Ton’s throughput, fast block speeds, and low Gas prices. It is fully compatible with interactions for regular users, allowing developers to seamlessly deploy native Ethereum smart contract code.
Feasibility
The TON Blockchain features lower transaction costs and higher TPS, and supports Turing-complete smart contracts, along with various native cryptographic functions. This makes the development of a fully compatible EVM on TVM not only feasible but also efficient. This will reduce the cost for Ethereum developers to enter the TON ecosystem, which will bring tremendous vitality to the TON community.
Advantages
Ethereum Compatibility:
TEVM is fully compatible with Ethereum’s RPC API, allowing users to seamlessly integrate their existing tools like MetaMask for transactions without needing additional training.
Enhanced Performance:
TEVM offers faster transaction speeds and lower costs, with transaction fees as low as $0.008 and a throughput of 100,000 TPS, making it more economical and scalable than Ethereum.
Developer-Friendly:
Developers can deploy existing Ethereum smart contracts on TEVM without modification, utilizing TON blockchain’s security and high transaction capacity without learning new programming languages.
Cross-Chain Functionality:
TEVM is integrated directly on the TON Blockchain, enabling instant cross-chain operations like asset transfers without relying on external services.
Framework
TEVM RPC Adpater
The TEVM RPC Adapter acts as a converter for requests between the EVM RPC API and the TVM RPC API, providing an EVM RPC API service that is compliant with standards, appearing externally as a standard EVM RPC node. EVM-compatible wallets (like MetaMask) and Dapps can connect directly through the frontend. It also translates execution results from TVM into EVM-compatible formats.
- When the TON EVM RPC Adapter receives a transaction request from the user end in EVM format, it wraps the EVM-formatted transaction into TVM’s transaction format, then sends it to the TEVM entry contract on the TON chain.
- When the TEVM RPC Adapter receives a contract read request from the user end in EVM format, it converts the read request into a corresponding request for a TVM contract. After reading data from the corresponding storage state of the contract in TVM, it then wraps this data in an EVM format before returning it to the user end.
TEVM
TEVM is essentially a series of smart contracts on TON that implement the full functionality of the EVM.
- The instruction execution part of TEVM is realized through a series of TON contracts, implementing and optimizing all 140 Ethereum Virtual Machine Opcodes. The corresponding stack is also implemented by these TON contracts. The gas consumption of all Ethereum Virtual Machine Opcodes is consistent with the Ethereum Mainnet, meaning precompiled binary code can be directly deployed on TEVM. At the same time, TEVM provides reserved support for unused opcodes to accommodate potential future upgrades of the EVM.
- The storage component of TEVM is implemented by a series of TON contracts, which simulate K-V storage through reading and writing these TON values for EVM use. This includes information on different EOA accounts, contract accounts, and the state of the EVM, among other things. Due to TON’s storage characteristics, dynamically expanding storage is extended in the form of TON subcontracts.
- Gas consumption on TEVM is paid for with its native token.