> For the complete documentation index, see [llms.txt](https://learn.mvs.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.mvs.org/developer-guides/smart-contracts/metaverse-vm-an-ethereum-compatible-vm.md).

# Metaverse VM: An Ethereum Compatible VM

## Introduction

The Metaverse VM (MVM)  is based on Ethereum-compatible smart contract Substrate pallet and SputnikVM: A Blockchain Virtual Machine.

SputnikVM is an implementation of an Ethereum Virtual Machine. It aims to be an efficient, pluggable virtual machine for different Ethereum-based blockchains.

A VM can be started given a Context and a BlockHeader. The user can then fire or step to run it. Those functions would only fail if it needs some information (accounts in the current block, or block hashes of previous blocks). If this happens, one can use the function commit\_account and commit\_blockhash to commit that information to the VM, and fire or step again until it succeeds. The current VM status can always be obtained using the status function.

MVM is a developer-oriented blockchain that strives to provide compatibility with the existing Ethereum developer toolchain and network. It does this by providing a full EVM implementation, a Web3-compatible API, and bridges that connect the MVM to existing Ethereum networks. This allows developers to deploy existing Solidity smart contracts and DApp frontends to MVM with minimal changes.

## Features

* Standalone - can be launched as an independent process or integrated into other apps
* Universal - supports different Ethereum chains, such as ETC, ETH or private ones
* Stateless - only an execution environment connected to independent State storage
* Fast - main focus is on performance
* IoT compatible - designed to support hardware used in embedded devices
* FFI, Protobuf and JSON interface
* Written in Rust, can be used as a binary, cargo crate or shared library

### Structs

| Structs Name                                                                                                          | Description                                                                                                            |
| --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| [AccountState](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.AccountState.html)                                   | A struct that manages the current account state for one EVM.                                                           |
| &#xD; [BlockhashState](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.BlockhashState.html)                         | A struct that manages the current blockhash state for one EVM.                                                         |
| [Context](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.Context.html)                                             | A VM context. See the Yellow Paper for more information.                                                               |
| [ContextVM](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.ContextVM.html)                                         | A VM that executes using a context and block information.                                                              |
| [ECRECPrecompiled](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.ECRECPrecompiled.html)                           | ECREC precompiled contract.                                                                                            |
| [EmbeddedAccountPatch](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.EmbeddedAccountPatch.html)                   | Mainnet account patch                                                                                                  |
| [EmbeddedByzantiumAccountPatch](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.EmbeddedByzantiumAccountPatch.html) | Mainnet account patch                                                                                                  |
| [EmbeddedByzantiumPatch](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.EmbeddedByzantiumPatch.html)               | Embedded Patch                                                                                                         |
| [EmbeddedPatch](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.EmbeddedPatch.html)                                 | Embedded Patch                                                                                                         |
| [HeaderParams](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.HeaderParams.html)                                   | Block Header                                                                                                           |
| [IDPrecompiled](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.IDPrecompiled.html)                                 | ID precompiled Contract                                                                                                |
| [Log](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.Log.html)                                                     | Log                                                                                                                    |
| [Machine](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.Machine.html)                                             | A VM state with PC.                                                                                                    |
| [PC](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.PC.html)                                                       | Represents a program counter in EVM.                                                                                   |
| [PCMut](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.PCMut.html)                                                 | Represents a mutable program counter in EVM.                                                                           |
| [RIP160Precompiled](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.RIP160Precompiled.html)                         | RIP160 precompiled contract                                                                                            |
| [Runtime](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.Runtime.html)                                             | A VM runtime. Only available in eval.                                                                                  |
| [SHA256Precompiled](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.SHA256Precompiled.html)                         | SHA256 precompiled contract.                                                                                           |
| [SeqMemory](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.SeqMemory.html)                                         | A sequential memory. It uses Rust's Vec for internal representation.                                                   |
| [Stack](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.Stack.html)                                                 | Represents an EVM stack.                                                                                               |
| [State](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.State.html)                                                 | A VM state without PC.                                                                                                 |
| [Storage](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.Storage.html)                                             | Internal representation of an account storage. It will return a RequireError if trying to access non-existing storage. |
| [TransactionVM](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.TransactionVM.html)                                 | A VM that executes using a transaction and block information.                                                          |
| [UntrustedTransaction](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.UntrustedTransaction.html)                   | Represents an untrusted Ethereum transaction.                                                                          |
| [VMTestPatch](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.VMTestPatch.html)                                     | Patch sepcific for the jsontests crate.                                                                                |
| [ValidTransaction](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.ValidTransaction.html)                           | Represents an Ethereum transaction.                                                                                    |
| [Valids](https://docs.rs/sputnikvm/0.10.1/sputnikvm/struct.Valids.html)                                               | Mapping of valid jump destination from code.                                                                           |

### Enums

| Enums Name                                                                                  | Description                                                                                                   |
| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| [AccountChange](https://docs.rs/sputnikvm/0.10.1/sputnikvm/enum.AccountChange.html)         | Represents an account. This is usually returned by the EVM.                                                   |
| [AccountCommitment](https://docs.rs/sputnikvm/0.10.1/sputnikvm/enum.AccountCommitment.html) | A single account commitment.                                                                                  |
| [Instruction](https://docs.rs/sputnikvm/0.10.1/sputnikvm/enum.Instruction.html)             | Instructions for the program counter. This is the same as Opcode except PUSH, which might take longer length. |
| [MachineStatus](https://docs.rs/sputnikvm/0.10.1/sputnikvm/enum.MachineStatus.html)         | Represents the current runtime status.                                                                        |
| [Opcode](https://docs.rs/sputnikvm/0.10.1/sputnikvm/enum.Opcode.html)                       | Opcode enum. One-to-one corresponding to an u8 value.                                                         |
| [TransactionAction](https://docs.rs/sputnikvm/0.10.1/sputnikvm/enum.TransactionAction.html) | Transaction Actions                                                                                           |
| [VMStatus](https://docs.rs/sputnikvm/0.10.1/sputnikvm/enum.VMStatus.html)                   | VM Status                                                                                                     |

### Statics

| Statics Name                                                                                           | Description                                  |
| ------------------------------------------------------------------------------------------------------ | -------------------------------------------- |
| [ECREC\_PRECOMPILED](https://docs.rs/sputnikvm/0.10.1/sputnikvm/static.ECREC_PRECOMPILED.html)         | Static value of ECREC precompiled contract.  |
| [EMBEDDED\_PRECOMPILEDS](https://docs.rs/sputnikvm/0.10.1/sputnikvm/static.EMBEDDED_PRECOMPILEDS.html) | Default precompiled collections.             |
| [ID\_PRECOMPILED](https://docs.rs/sputnikvm/0.10.1/sputnikvm/static.ID_PRECOMPILED.html)               | Static value of ID precompiled contract.     |
| [RIP160\_PRECOMPILED](https://docs.rs/sputnikvm/0.10.1/sputnikvm/static.RIP160_PRECOMPILED.html)       | Static value of RIP160 precompiled contract. |
| [SHA256\_PRECOMPILED](https://docs.rs/sputnikvm/0.10.1/sputnikvm/static.SHA256_PRECOMPILED.html)       | Static value of SHA256 precompiled contract. |

### Traits

| Traits Name                                                                        | Description                                                                         |
| ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| [AccountPatch](https://docs.rs/sputnikvm/0.10.1/sputnikvm/trait.AccountPatch.html) | Account patch for account related variables.                                        |
| [Memory](https://docs.rs/sputnikvm/0.10.1/sputnikvm/trait.Memory.html)             | Represent a memory in EVM. Read should always succeed. Write can fall.              |
| [Patch](https://docs.rs/sputnikvm/0.10.1/sputnikvm/trait.Patch.html)               | Represents different block range context.                                           |
| [Precompiled](https://docs.rs/sputnikvm/0.10.1/sputnikvm/trait.Precompiled.html)   | Represent a precompiled contract.                                                   |
| [VM](https://docs.rs/sputnikvm/0.10.1/sputnikvm/trait.VM.html)                     | Represents an EVM. This is usually the main interface for clients to interact with. |

### Type Definitions

| Type                                                                                      | Description                                                                                    |
| ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| [SeqContextVM](https://docs.rs/sputnikvm/0.10.1/sputnikvm/type.SeqContextVM.html)         | A sequencial VM. It uses sequencial memory representation and hash map storage for accounts.   |
| [SeqTransactionVM](https://docs.rs/sputnikvm/0.10.1/sputnikvm/type.SeqTransactionVM.html) | A sequencial transaction VM. This is same as SeqContextVM except it runs at transaction level. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://learn.mvs.org/developer-guides/smart-contracts/metaverse-vm-an-ethereum-compatible-vm.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
