package
0.14.0
Repository: https://github.com/ava-labs/coreth.git
Documentation: pkg.go.dev

# README

EVM Package

The EVM package implements the AvalancheGo VM interface.

VM

The VM creates the Ethereum backend and provides basic block building, parsing, and retrieval logic to the consensus engine.

APIs

The VM creates APIs for the node through the function CreateHandlers(). CreateHandlers returns the Service struct to serve Coreth specific APIs. Additionally, the Ethereum backend APIs are also returned at the /rpc extension.

Block Handling

The VM implements buildBlock, parseBlock, and getBlock and uses the chain package from AvalancheGo to construct a metered state, which uses these functions to implement an efficient caching layer and maintain the required invariants for blocks that get returned to the consensus engine.

To do this, the VM uses a modified version of the Ethereum RLP block type here and uses the core package's BlockChain type here to handle the insertion and storage of blocks into the chain.

Block

The Block type implements the AvalancheGo ChainVM Block interface. The key functions for this interface are Verify(), Accept(), Reject(), and Status().

The Block type wraps the stateless block type here and implements these functions to allow the consensus engine to verify blocks as valid, perform consensus, and mark them as accepted or rejected. See the documentation in AvalancheGo for the more detailed VM invariants that are maintained here.

Atomic Transactions

Atomic transactions utilize Shared Memory (documented here) to send assets to the P-Chain and X-Chain.

Operations on shared memory cannot be reverted, so atomic transactions must separate their verification and processing into two stages: verifying the transaction as valid to be performed within its block and actually performing the operation. For example, once an export transaction is accepted, there is no way for the C-Chain to take that asset back and it can be imported immediately by the recipient chain.

The C-Chain uses the account model for its own state, but atomic transactions must be compatible with the P-Chain and X-Chain, such that C-Chain atomic transactions must transform between the account model and the UTXO model.

# Packages

No description provided by the author

# Functions

calculates the amount of AVAX that must be burned by an atomic transaction that consumes [cost] at [baseFee].
[ExtractAtomicTx] extracts a singular atomic transaction from [atomicTxBytes] and returns a slice of atomic transactions for compatibility with the type returned post ApricotPhase5.
extractAtomicTxs returns the atomic transactions in [atomicTxBytes] if they exist.
[ExtractAtomicTxsBatch] extracts a slice of atomic transactions from [atomicTxBytes].
GetEthAddress returns the ethereum address derived from [privKey].
InitLogger initializes logger with alias and sets the log level and format with the original [os.StdErr] interface along with the context logger.
No description provided by the author
NewAtomicBackend creates an AtomicBackend from the specified dependencies.
No description provided by the author
No description provided by the author
No description provided by the author
NewCChainClient returns a Client for interacting with the C Chain.
NewClient returns a Client for interacting with EVM [chain].
No description provided by the author
No description provided by the author
No description provided by the author
NewMempool returns a Mempool with [maxSize].
No description provided by the author
No description provided by the author
ParseEthAddress parses [addrStr] and returns an Ethereum address.
PublicKeyToEthAddress returns the ethereum address derived from [pubKey].
SortEVMInputsAndSigners sorts the list of EVMInputs based on the addresses and assetIDs.

# Constants

List of possible status values [Unknown] Zero value, means the status is not known [Dropped] means the transaction was in the mempool, but was dropped because it failed verification [Processing] means the transaction is in the mempool [Accepted] means the transaction was accepted.
List of possible status values [Unknown] Zero value, means the status is not known [Dropped] means the transaction was in the mempool, but was dropped because it failed verification [Processing] means the transaction is in the mempool [Accepted] means the transaction was accepted.
test constants.
test constants.
List of possible status values [Unknown] Zero value, means the status is not known [Dropped] means the transaction was in the mempool, but was dropped because it failed verification [Processing] means the transaction is in the mempool [Accepted] means the transaction was accepted.
List of possible status values [Unknown] Zero value, means the status is not known [Dropped] means the transaction was in the mempool, but was dropped because it failed verification [Processing] means the transaction is in the mempool [Accepted] means the transaction was accepted.

# Variables

Codec does serialization and deserialization.
No description provided by the author
Constants for calculating the gas consumed by atomic transactions.
Constants for calculating the gas consumed by atomic transactions.
GitCommit is set by the build script.
ID this VM should be referenced by.
Constants for calculating the gas consumed by atomic transactions.
Version is the version of Coreth.

# Structs

Admin is the API service for admin API calls.
AvaxAPI offers Avalanche network related API methods.
Batch implements ethdb.Batch.
Block implements the snowman.Block interface.
BuildGenesisReply is the reply from BuildGenesis.
Config ...
No description provided by the author
No description provided by the author
Database implements ethdb.Database.
No description provided by the author
EthPushGossiper is used by the ETH backend to push transactions issued over the RPC and added to the mempool to peers.
EVMInput defines an input created from the EVM state to fund export transactions.
EVMOutput defines an output that is added to the EVM state created by import transactions.
ExportArgs are the arguments to Export.
ExportAVAXArgs are the arguments to ExportAVAX.
ExportKeyArgs are arguments for ExportKey.
ExportKeyReply is the response for ExportKey.
No description provided by the author
No description provided by the author
GetAcceptedFrontReply defines the reply that will be sent from the GetAcceptedFront API call.
GetAtomicTxStatusReply defines the GetAtomicTxStatus replies returned from the API.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GossipHandler handles incoming gossip messages.
ImportArgs are arguments for passing into Import requests.
ImportKeyArgs are arguments for ImportKey.
Mempool is a simple mempool for atomic transactions.
No description provided by the author
No description provided by the author
SnowmanAPI introduces snowman specific functionality to the evm.
StaticService defines the static API services exposed by the evm.
No description provided by the author
Tx is a signed transaction.
UnsignedExportTx is an unsigned ExportTx.
UnsignedImportTx is an unsigned ImportTx.
No description provided by the author
VM implements the snowman.ChainVM interface.

# Interfaces

AtomicBackend abstracts the verification and processing of atomic transactions.
AtomicState is an abstraction created through AtomicBackend and can be used to apply the VM's state change for atomic txs or reject them to free memory.
AtomicTrie maintains an index of atomic operations by blockchainIDs for every block height containing atomic transactions.
AtomicTrieIterator is a stateful iterator that iterates the leafs of an AtomicTrie.
AtomicTxRepository defines an entity that manages storage and indexing of atomic transactions.
No description provided by the author
Client interface for interacting with EVM [chain].
GossipStats contains methods for updating incoming and outgoing gossip stats.
No description provided by the author
No description provided by the author
Syncer represents a step in state sync, along with Start/Done methods to control and monitor progress.
UnsignedAtomicTx is an unsigned operation that can be atomically accepted.
UnsignedTx is an unsigned transaction.

# Type aliases

Status ...