Substrate开发者中心

Substrate开发者中心

  • 教程
  • 知识库
  • 菜谱
  • 接口手册

›智能合约

开始

  • 概述
  • 安装
  • Getting Started on Windows
  • Glossary

学习 Substrate

  • 外部调用
  • Transaction Pool
  • Account Abstractions
  • Session Keys
  • Transaction Weight
  • Off-Chain Workers

Runtime

  • Runtime Overview
  • Runtime Primitives
  • FRAME
  • Pallets
  • Runtime Macros
  • Runtime Metadata
  • Runtime Storage
  • Runtime Origin
  • Runtime Execution
  • Runtime Events
  • Runtime Errors
  • Transaction Fees
  • Off-Chain Workers
  • Debugging
  • Runtime Tests
  • On-Chain Randomness
  • Runtime Upgrades

智能合约

  • Overview
  • ink! Smart Contracts
  • ink! Concepts
  • ink! Development
  • EVM Pallet
  • ink! F.A.Q.

集成

  • Polkadot-JS
  • Client Libraries
  • Chain Specification
  • The Subkey Tool
  • Memory Profiling

高级

  • SCALE编解码器
  • 共识
  • The Block Import Pipeline
  • Executor
  • Cryptography
  • Storage
  • SS58 Address Format

Contribute

  • Help Translate
Edit

EVM Pallet

FRAME provides an EVM execution module that allows unmodified EVM code to be executed in a Substrate-based blockchain.

EVM Engine

The EVM module uses SputnikVM as the underlying EVM engine. The engine is overhauled so that it's modular. In the future, we will want to allow users to swap out components like gasometer, and inject their own customized ones.

Execution Lifecycle

There are a separate set of accounts managed by the EVM module. Substrate based accounts can call the EVM Module to deposit or withdraw balance from the Substrate base-currency into a different balance managed and used by the EVM module. Once a user has populated their balance, they can create and call smart contracts using this module.

There's one-to-one mapping from Substrate accounts and EVM external accounts that is defined by a conversion function.

EVM Module vs Ethereum Network

The EVM module should be able to produce nearly identical results compared to the Ethereum mainnet, including gas cost and balance changes.

Observable differences include:

  • The available length of block hashes may not be 256 depending on the configuration of the System module in the Substrate runtime.
  • Difficulty and coinbase, which do not make sense in this module and is currently hard coded to zero.

We currently do not aim to make unobservable behaviors, such as state root, to be the same. We also don't aim to follow the exact same transaction / receipt format. However, given one Ethereum transaction and one Substrate account's private key, one should be able to convert any Ethereum transaction into a transaction compatible with this module.

The gas configurations are currently hard-coded to the Istanbul hard fork. It can later be expanded to support earlier hard fork configurations.

Next Steps

Learn More

  • Learn about our Contracts pallet, which supports deployment and execution of Wasm smart contracts.

Examples

  • Follow a tutorial to add a pallet to your FRAME runtime.

References

  • Visit the reference docs for the EVM module.

  • Visit the reference docs for SputnikVM's evm crate.

Last updated on 2020-8-22 by Dan Forbes
← ink! Developmentink! F.A.Q. →
  • EVM Engine
  • Execution Lifecycle
  • EVM Module vs Ethereum Network
  • Next Steps
    • Learn More
    • Examples
    • References
Substrate开发者中心
开发者中心
教程知识库菜谱API 手册
社区
Community HomeStack OverflowTwitterEvents
更多
Substrate Builders ProgramBlogSubstrate GitHubDeveloper Hub GitHubPrivacy PolicyTerms of UseCookie Settings
本Substrate中文文档由登链社区翻译