# EVM Integration

By using crates from the Frontier project and adding the EVM and Ethereum pallets to your runtime, you can build a Substrate-based blockchain that supports Ethereum-based accounts and and allows for the execution of Solidity-based smart contracts.

The Ethereum Virtual Machine (EVM) is a virtual computer with the components that enable Ethereum network participants to store data and agree on the state of the data. For a Substrate-based blockchain, the core responsibilities of the EVM are implemented in the **EVM pallet**. The EVM pallet is responsible for executing Ethereum contract bytecode for smart contracts that are written in a high level language like Solidity, then compiled to EVM bytecode. The following diagram provides a simplified overview to illustrate how the EVM pallet and Ethereum RPC calls can be integrated into your Substrate runtime.

![Ethereum-compatible runtime architecture](https://3394686052-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5FcHUSDzEQOuSRhER7FQ%2Fuploads%2Fgit-blob-cd916dd54ab387025654fc809ab7cc5e08c21718%2Fpallet-evm.png?alt=media)

In addition to the EVM pallet, an Ethereum pallet is responsible for storing Ethereum-formatted blocks, transaction receipts, and transaction statuses. When a user submits a raw Ethereum transaction, the transaction is first converted into a Substrate transaction by calling the `transact` function in the `pallet_ethereum` in the runtime.

![Ethereum pallet](https://3394686052-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5FcHUSDzEQOuSRhER7FQ%2Fuploads%2Fgit-blob-15c3cfcc7b17380f6f348bab5649e5dba602abbd%2Fpallet-ethereum.png?alt=media)

Note that Ethereum accounts and Substrate accounts are not directly compatible for using a single private key. For information about mapping Ethereum accounts and keys to Substrate accounts and keys, see [Unified Accounts](https://docs.moonbeam.network/learn/unified-accounts/#substrate-evm-compatible-blockchain) in the Moonbeam documentation.

### Ethereum-specific runtime APIs and RPCs

The runtime stores all of the Ethereum-formatted information that can be queried. You can call into the runtime and retrieve that information using the node RPC server and runtime API and RPC client calls.

![Remote procedure calls to access Ethereum-formatted information](https://3394686052-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5FcHUSDzEQOuSRhER7FQ%2Fuploads%2Fgit-blob-5a0143594596fdefaf36ca0b72f9e9f46b5b39ed%2Frpc.png?alt=media)

### Frontier block import

![Block import process](https://3394686052-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5FcHUSDzEQOuSRhER7FQ%2Fuploads%2Fgit-blob-e61f155c16d72cab1e583f745ed90b52075b0ed9%2Fblock-import.png?alt=media)

### Where to go next

* [Moonbeam: Ethereum compatibility](https://docs.moonbeam.network/learn/features/eth-compatibility/)
* [Ethereum virtual machine (EVM)](https://ethereum.org/en/developers/docs/evm/)
* [Access EVM accounts](https://docs.infrablockchain.net/infrablockchain-docs/infrablockchain/learn/substrate/tutorials/integrate-with-tools/access-evm-accounts)
* [Substrate EVM utilities](https://github.com/paritytech/frontier/blob/master/template/utils/README.md#substrate-evm-utilities)
* [Frontier rpc and rpc-core](https://github.com/paritytech/frontier/tree/master/client/)
* [Frontier consensus](https://github.com/paritytech/frontier/tree/master/primitives/consensus)
