• Stars
    star
    239
  • Rank 168,763 (Top 4 %)
  • Language
    Go
  • License
    GNU Lesser Genera...
  • Created almost 3 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Launch your own EVM as an Avalanche Subnet

Subnet EVM

Build + Test + Release CodeQL

Avalanche is a network composed of multiple blockchains. Each blockchain is an instance of a Virtual Machine (VM), much like an object in an object-oriented language is an instance of a class. That is, the VM defines the behavior of the blockchain.

Subnet EVM is the Virtual Machine (VM) that defines the Subnet Contract Chains. Subnet EVM is a simplified version of Coreth VM (C-Chain).

This chain implements the Ethereum Virtual Machine and supports Solidity smart contracts as well as most other Ethereum client functionality.

Building

The Subnet EVM runs in a separate process from the main AvalancheGo process and communicates with it over a local gRPC connection.

AvalancheGo Compatibility

[v0.1.0] [email protected] (Protocol Version: 9)
[v0.1.1-v0.1.2] [email protected] (Protocol Version: 10)
[v0.2.0] [email protected] (Protocol Version: 11)
[v0.2.1] [email protected] (Protocol Version: 12)
[v0.2.2] [email protected] (Protocol Version: 14)
[v0.2.3] [email protected] (Protocol Version: 15)
[v0.2.4] [email protected] (Protocol Version: 15)
[v0.2.5] [email protected] (Protocol Version: 15)
[v0.2.6] [email protected] (Protocol Version: 15)
[v0.2.7] [email protected] (Protocol Version: 15)
[v0.2.8] [email protected] (Protocol Version: 15)
[v0.2.9] [email protected] (Protocol Version: 15)
[v0.3.0] [email protected] (Protocol Version: 16)
[v0.4.0] [email protected] (Protocol Version: 17)
[v0.4.1] [email protected] (Protocol Version: 18)
[v0.4.2] [email protected] (Protocol Version: 18)
[v0.4.3] [email protected] (Protocol Version: 19)
[v0.4.4] [email protected] (Protocol Version: 19)
[v0.4.5] [email protected] (Protocol Version: 20)
[v0.4.6] [email protected] (Protocol Version: 20)
[v0.4.7] [email protected] (Protocol Version: 21)
[v0.4.8] [email protected] (Protocol Version: 22)
[v0.4.9] [email protected] (Protocol Version: 23)
[v0.4.10] [email protected] (Protocol Version: 23)
[v0.4.11] [email protected] (Protocol Version: 24)
[v0.4.12] [email protected] (Protocol Version: 24)
[v0.5.0] [email protected] (Protocol Version: 25)
[v0.5.1] [email protected] (Protocol Version: 26)
[v0.5.2] [email protected] (Protocol Version: 26)
[v0.5.3] [email protected] (Protocol Version: 27)
[v0.5.4] [email protected] (Protocol Version: 27)

API

The Subnet EVM supports the following API namespaces:

  • eth
  • personal
  • txpool
  • debug

Only the eth namespace is enabled by default. Full documentation for the C-Chain's API can be found here.

Compatibility

The Subnet EVM is compatible with almost all Ethereum tooling, including Remix, Metamask and Truffle.

Differences Between Subnet EVM and Coreth

  • Added configurable fees and gas limits in genesis
  • Merged Avalanche hardforks into the single "Subnet EVM" hardfork
  • Removed Atomic Txs and Shared Memory
  • Removed Multicoin Contract and State

Block Format

To support these changes, there have been a number of changes to the SubnetEVM block format compared to what exists on the C-Chain and Ethereum. Here we list the changes to the block format as compared to Ethereum.

Block Header

  • BaseFee: Added by EIP-1559 to represent the base fee of the block (present in Ethereum as of EIP-1559)
  • BlockGasCost: surcharge for producing a block faster than the target rate

Create an EVM Subnet on a Local Network

Clone Subnet-evm

First install Go 1.19.12 or later. Follow the instructions here. You can verify by running go version.

Set $GOPATH environment variable properly for Go to look for Go Workspaces. Please read this for details. You can verify by running echo $GOPATH.

As a few software will be installed into $GOPATH/bin, please make sure that $GOPATH/bin is in your $PATH, otherwise, you may get error running the commands below.

Download the subnet-evm repository into your $GOPATH:

cd $GOPATH
mkdir -p src/github.com/ava-labs
cd src/github.com/ava-labs
git clone [email protected]:ava-labs/subnet-evm.git
cd subnet-evm

This will clone and checkout to master branch.

Run Local Network

To run a local network, it is recommended to use the avalanche-cli to set up an instance of Subnet-EVM on an local Avalanche Network.

There are two options when using the Avalanche-CLI:

  1. Use an official Subnet-EVM release: https://docs.avax.network/subnets/build-first-subnet
  2. Build and deploy a locally built (and optionally modified) version of Subnet-EVM: https://docs.avax.network/subnets/create-custom-subnet

More Repositories

1

avalanchego

Go implementation of an Avalanche node.
Go
2,109
star
2

avalanche-faucet

Avalanche Faucet for Fuji Network and Subnets.
TypeScript
467
star
3

avalanchejs

The Avalanche Platform JavaScript Library
TypeScript
319
star
4

avalanche-smart-contract-quickstart

The easiest way to build smart contracts on Avalanche.
Solidity
250
star
5

avalanche-wallet

The Avalanche web wallet
Vue
229
star
6

hypersdk

Opinionated Framework for Building Hyper-Scalable Blockchains on Avalanche
Go
193
star
7

coreth

Code and wrapper to extract Ethereum blockchain functionalities without network/consensus, for building custom blockchain services.
Go
180
star
8

mastering-avalanche

Mastering Avalanche 1st Edition - The Internet of Finance
176
star
9

avalanche-docs

Protocol documentation for the Avalanche network.
MDX
161
star
10

firewood

Compaction-Less Database Optimized for Efficiently Storing Recent Merkleized Blockchain State
Rust
109
star
11

avalanche-cli

Go
100
star
12

spacesvm

Go
85
star
13

avalanche-explorer

The Vue frontend for the Avalanche blockchain.
Vue
82
star
14

avalanche-network-runner

Tool to run and interact with an Avalanche network locally
Go
81
star
15

avash

Avash - The Avalanche Shell Client
Go
72
star
16

ortelius

State archival and indexer for the Avalanche network. Used in the Avalanche Explorer.
Go
59
star
17

subnet-cli

Go
58
star
18

avalanche-rs

Avalanche APIs/VM SDK in Rust
Rust
45
star
19

avalanche-wallet-sdk

A Typescript library to create and manage wallets on the Avalanche network.
TypeScript
39
star
20

avalanche-ops

operation toolkit for Avalanche nodes
Rust
38
star
21

wrapped-assets

Smart Contract for Wrapped AVAX
Solidity
38
star
22

ecosystem-projects

JavaScript
33
star
23

avalanche-types-rs

Avalanche primitive types in Rust (experimental)
Rust
32
star
24

avalanche-faucet-legacy

A frontend Vue application for the Avalanche Faucet
TypeScript
30
star
25

avalanche-rosetta

Rosetta server for Avalanche (C-Chain and P-Chain)
Go
30
star
26

xsvm

Example Virtual Machine supporting Subnet Messaging on the Avalanche Network
Go
29
star
27

ava-sim

Go
28
star
28

avalanche-bridge-resources

Token List for the Avalanche Bridge
Solidity
26
star
29

teleporter

EVM cross-chain messaging protocol built on top of Avalanche Warp Messaging
Solidity
23
star
30

timestampvm

timestampvm implementation as rpc-plugin
Go
23
star
31

bridge-tokens

Python
23
star
32

precompile-evm

A new repository for Subnet-EVM Stateful Precompiles
Shell
20
star
33

blobvm

Go
19
star
34

timestampvm-rs

Timestamp VM in Rust
Rust
18
star
35

avax-js-cli-tools

A collection of helpful scripts for the Avalanche network.
JavaScript
17
star
36

spacesvm-js

TypeScript
17
star
37

avalanche-interchain-token-transfer

Cross-chain token transfer built on top of Teleporter
Solidity
13
star
38

indexvm

The Context Layer of the Decentralized Web
Go
11
star
39

avalanche-monitoring

Monitoring tooling for Avalanche nodes
Shell
10
star
40

avalanche-quicksign

A very simple webpage that signs a string with a private key and prompts the user to email it. Used to verify users on the test net.
Vue
10
star
41

mnemonic-shamir-secret-sharing-cli

C++
10
star
42

ledger-avalanche

Rust
9
star
43

audits

Security audits for the Avalanche platform
9
star
44

awm-relayer

Service for relaying Avalanche Warp Messages between Subnets
Go
9
star
45

apm

Plugin manager for Avalanche
Go
8
star
46

avalanche-dapp-sdks

Working example of a dapp working with core extension
TypeScript
8
star
47

avalanche-network-runner-sdk-rs

avalanche-network-runner-sdk-rs
Rust
8
star
48

avalanchetipbot

Avalanche Tip Bot for telegram, twitter and discord.
JavaScript
7
star
49

core-mobile

TypeScript
7
star
50

chainsafe-scripts

Scripts for chainsafe analysis
Python
6
star
51

avalanche-evm-gasless-transaction

Rust
6
star
52

public-facing-docs

Repo of public docs
6
star
53

spacesvm-rs

Spaces VM in Rust
Rust
6
star
54

avalanche-network-runner-sdk

Go
5
star
55

avalanche-network-runner-postman-collection

A postman colllection to interact with the Avalanche Network Runner
4
star
56

avalanche-plugins-core

Core plugins for Avalanche
4
star
57

vue-components

A collection of Vue based components used across our application frontends.
Vue
4
star
58

firewood-mit

Rust
4
star
59

avalanche-ledger-go

Shell
3
star
60

avalanchego-kurtosis

Run AvalancheGo tests in the Kurtosis framework
Go
3
star
61

open-defi-hackathon

3
star
62

gnosis-subnet

Helper repo for deploying gnosis safe contracts on Avalanche subnets
Shell
3
star
63

cargo-workspace-version

Cargo plugin to check and/or update all local package versions in a workspace
Rust
3
star
64

spacesvm-postman-collection

Postman collection for the SpacesVM
2
star
65

avalanchejs-docs

Documentation for AvalancheJS
2
star
66

subnet-assets

JavaScript
2
star
67

ip-manager

IP manager
Rust
2
star
68

avalanche-telemetry

Avalanche node telemetry agent (supports CloudWatch, DataDog)
Rust
2
star
69

qevm

Rust
2
star
70

public-avalanche-sdks

Public SDKs for interfacing with Avalanche
TypeScript
2
star
71

avalanche-tooling-sdk-go

Go
2
star
72

avalanche-installer

Avalanche installer
Rust
1
star
73

btcb-por-workshop

Demo contracts for interacting with the BTC.b Proof-of-Reserves on Fuji Testnet
Shell
1
star
74

avalanchego-operator

Go
1
star
75

avalanche-hackathon

Solidity
1
star
76

homebrew-avalanchego

Homebrew formula for distribution of public avalanche binaries to MacOS
Ruby
1
star