2018-08-13 15:09:02 +00:00
|
|
|
|
# EVMC – Ethereum Client-VM Connector API {#mainpage}
|
|
|
|
|
|
2019-04-24 20:20:18 +00:00
|
|
|
|
**ABI version 6**
|
|
|
|
|
|
2018-09-06 14:13:45 +00:00
|
|
|
|
The EVMC is the low-level ABI between Ethereum Virtual Machines (EVMs) and
|
2018-10-23 16:52:34 +00:00
|
|
|
|
Ethereum Clients. On the EVM-side it supports classic EVM1 and [ewasm].
|
2018-10-18 12:49:10 +00:00
|
|
|
|
On the Client-side it defines the interface for EVM implementations
|
2018-08-13 15:09:02 +00:00
|
|
|
|
to access Ethereum environment and state.
|
|
|
|
|
|
|
|
|
|
|
2018-11-12 11:04:42 +00:00
|
|
|
|
# Guides {#guides}
|
2018-10-05 14:28:32 +00:00
|
|
|
|
|
|
|
|
|
- [Host Implementation Guide](@ref hostguide)
|
2018-10-18 12:49:10 +00:00
|
|
|
|
- [VM Implementation Guide](@ref vmguide)
|
2018-10-05 14:28:32 +00:00
|
|
|
|
|
|
|
|
|
|
2018-09-06 14:13:45 +00:00
|
|
|
|
# Versioning {#versioning}
|
|
|
|
|
|
|
|
|
|
The EVMC project uses [Semantic Versioning](https://semver.org).
|
2019-01-18 13:31:47 +00:00
|
|
|
|
The version format is `MAJOR.MINOR.PATCH`.
|
|
|
|
|
|
|
|
|
|
The _MAJOR_ version number is also referenced as the **EVMC ABI version**.
|
2018-09-06 14:13:45 +00:00
|
|
|
|
This ABI version is available to VM and Host implementations by ::EVMC_ABI_VERSION.
|
|
|
|
|
For example EVMC 3.2.1 would have ABI version 3 and therefore this project release
|
|
|
|
|
can be referenced as EVMC ABIv3 or just EVMC 3.
|
2019-01-18 13:31:47 +00:00
|
|
|
|
Every C ABI breaking change requires increasing the _MAJOR_ version number.
|
|
|
|
|
|
|
|
|
|
The releases with _MINOR_ version change allow adding new API features
|
|
|
|
|
and modifying the language bindings API.
|
|
|
|
|
Backward incompatible API changes are allowed but should be avoided if possible.
|
|
|
|
|
|
|
|
|
|
The releases with _PATCH_ should only include bug fixes. Exceptionally,
|
|
|
|
|
API changes are allowed when required to fix a broken feature.
|
2018-09-06 14:13:45 +00:00
|
|
|
|
|
|
|
|
|
|
2018-11-12 11:04:42 +00:00
|
|
|
|
# Modules {#modules}
|
2018-08-13 15:09:02 +00:00
|
|
|
|
|
2018-10-18 12:49:10 +00:00
|
|
|
|
- [EVMC](@ref EVMC)
|
2018-08-13 15:09:02 +00:00
|
|
|
|
– the main component that defines API for VMs and Clients (Hosts).
|
2019-04-24 16:00:13 +00:00
|
|
|
|
- [EVMC C++ API](@ref evmc)
|
|
|
|
|
– the wrappers and bindings for C++.
|
2018-08-13 15:09:02 +00:00
|
|
|
|
- [EVMC Loader](@ref loader)
|
2018-10-18 12:49:10 +00:00
|
|
|
|
– the library for loading VMs implemented as Dynamically Loaded Libraries (DLLs, shared objects).
|
2018-08-13 15:09:02 +00:00
|
|
|
|
- [EVMC Helpers](@ref helpers)
|
|
|
|
|
– a collection of utility functions for easier integration with EVMC.
|
2018-10-18 12:49:10 +00:00
|
|
|
|
- [EVM Instructions](@ref instructions)
|
2018-08-13 15:09:02 +00:00
|
|
|
|
– the library with collection of metrics for EVM1 instruction set.
|
2018-09-05 17:30:51 +00:00
|
|
|
|
- [EVMC VM Tester](@ref vmtester)
|
2018-08-28 20:06:52 +00:00
|
|
|
|
– the EVMC-compatibility testing tool for VM implementations.
|
2018-08-13 15:09:02 +00:00
|
|
|
|
|
|
|
|
|
|
2018-11-12 11:04:42 +00:00
|
|
|
|
# Language bindings {#bindings}
|
2018-11-12 10:59:51 +00:00
|
|
|
|
|
|
|
|
|
## Go
|
|
|
|
|
|
|
|
|
|
```go
|
|
|
|
|
import "github.com/ethereum/evmc/bindings/go/evmc"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2018-10-23 16:52:34 +00:00
|
|
|
|
[ewasm]: https://github.com/ewasm/design
|
2018-08-13 15:09:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@addtogroup EVMC
|
|
|
|
|
|
|
|
|
|
## Terms
|
|
|
|
|
|
|
|
|
|
1. **VM** – An Ethereum Virtual Machine instance/implementation.
|
2018-10-18 12:49:10 +00:00
|
|
|
|
2. **Host** – An entity controlling the VM.
|
|
|
|
|
The Host requests code execution and responses to VM queries by callback
|
2018-08-13 15:09:02 +00:00
|
|
|
|
functions. This usually represents an Ethereum Client.
|
2018-10-18 12:49:10 +00:00
|
|
|
|
|
2018-08-13 15:09:02 +00:00
|
|
|
|
|
|
|
|
|
## Responsibilities
|
|
|
|
|
|
|
|
|
|
### VM
|
|
|
|
|
|
|
|
|
|
- Executes the code (obviously).
|
|
|
|
|
- Calculates the running gas cost and manages the gas counter except the refund
|
|
|
|
|
counter.
|
|
|
|
|
- Controls the call depth, including the exceptional termination of execution
|
|
|
|
|
in case the maximum depth is reached.
|
2018-10-18 12:49:10 +00:00
|
|
|
|
|
|
|
|
|
|
2018-08-13 15:09:02 +00:00
|
|
|
|
### Host
|
|
|
|
|
|
|
|
|
|
- Provides access to State.
|
|
|
|
|
- Creates new accounts (with code being a result of VM execution).
|
|
|
|
|
- Handles refunds entirely.
|
|
|
|
|
- Manages the set of precompiled contracts and handles execution of messages
|
|
|
|
|
coming to them.
|