Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EVM Miner Guides #110

Open
wants to merge 6 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions docs/50_eos-evm/25_miners-and-nodes/10_transaction-miner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
title: EOS EVM Transaction Miner
---

The EOS EVM transaction miner is a simple transaction relay that allows you to take Ethereum formatted transactions and
push them to the EOS EVM contract on an EOS Native node.


## Your miner account

You will need an EOS Network account which will serve as your **miner account**.

The EOS EVM Miner software takes the EVM transactions that it receives and converts them into EOS transactions which it then sends
to the `eosio.evm` contract on the native EOS Network.

As a relay of these transactions you have the opportunity to earn rewards for the service you provide.

### Miners and resources

As your miner account relays transactions it will slowly be depleting its CPU and NET resources. You will need to manage these
resources to ensure your miner can continue to operate.

Services like PowerUp should be automated to ensure that your miner account has enough resources to continue operating
without interruption.

> ❔ **RAM is not required**:
>
> Your miner account does not deplete RAM resources as it relays transactions. It only consumes CPU and NET resources.
> The `eosio.evm` contract pays for the RAM that the EOS EVM uses through the fees it collects from the EVM transactions.

### Registering your miner

Once you have your miner account, you will need to register it with the `eosio.evm` contract.

```bash
cleos -u https://eos.greymass.com/ push action eosio.evm open '["<your-miner-account>"]' -p <your-miner-account>
```

If you'd like to register using a web interface you can visit [bloks.io](https://bloks.io/account/eosio.evm?loadContract=true&tab=Actions&account=eosio.evm&scope=eosio.evm&limit=100&action=open)
and sign the transaction using a wallet like [Anchor](https://www.greymass.com/anchor).

### Viewing your mining rewards

The `eosio.evm` contract will store the rewards you earn from mining in a table. You can view these rewards at any time by
getting the table rows from the contract's `balances` table with the upper and lower bound set to your miner account:

```bash
cleos -u https://eos.greymass.com/ get table eosio.evm eosio.evm balances -U <your-miner-account> -L <your-miner-account>
```


### Withdrawing your mining rewards

The `eosio.evm` contract will store the rewards you earn from mining in a table. You can withdraw these rewards at any
time by sending a transaction to the `eosio.evm` contract with the following action:

```bash
cleos -u https://eos.greymass.com/ push action eosio.evm withdraw '["<your-miner-account>", "1.0000 EOS"]' -p <your-miner-account>
```


## Setting up the miner



### Installation

Make sure you have `node` installed on your machine.

The recommended version is [`18.16.0`](https://nodejs.org/en/download), and the minimum version is `16.16.0`.

#### Get the miner from GitHub and inst all dependencies

```bash
git clone https://github.com/eosnetworkfoundation/eos-evm-miner.git
cd eos-evm-miner
yarn
```

#### You also need to set up you Environment Variables
Copy the `.env.example` file to `.env` and fill in the environment variables.

| Name | Description | Default |
| --- |-------------------------------------------------------------------------------------------------------------------|---------|
| `PRIVATE_KEY` | The private key of the miner account | |
| `MINER_ACCOUNT` | The name of the miner account on the EOS Network | |
| `RPC_ENDPOINTS` | A list of EOS RPC endpoints to connect to, comma-delimited | |
| `PORT` | The port to listen on for incoming Ethereum transactions | `50305` |
| `LOCK_GAS_PRICE` | If set to `true`, one a gas price is set, this miner will not hit the EOS API node again to fetch a new gas price | `true` |




### Start mining

```bash
yarn mine
```

> ❕ **Logs**:
>
> A `logs` directory is created in the project root with two log files:
> - **error.log**: Only error logs
> - **combined.log**: Everything else





108 changes: 108 additions & 0 deletions docs/50_eos-evm/25_miners-and-nodes/20_rpc-nodes/10_basic-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
title: Basic Setup
---

<head>
<title>EOS EVM - Basic Setup</title>
</head>

Before we can configure and run your EOS EVM node, we need to make sure your system meets the requirements, and has the
proper software installed.

## Requirements

| Hardware | Minimum | Recommended | Impact |
| --- | --- | --- |----------------------------------|
| CPU | 4 cores | 8 cores | Tx throughput |
| RAM | 16 GB | 32 GB | Compilation and processing speed |
| SSD | 100 GB | 1 TB | History storage |
| Network | 100 Mbps | 1 Gbps | Latency |


### Supported Operating Systems

- [Ubuntu 20.04 (Focal Fossa)](https://releases.ubuntu.com/20.04/)
- [Ubuntu 22.04 (Jammy Jellyfish)](https://releases.ubuntu.com/22.04/)

### Required Software

<details>
<summary>gcc 10+</summary>

```bash
gcc --version

# If gcc is not installed or your gcc is not version 10+:

sudo apt update -y
sudo apt upgrade -y
sudo apt install -y build-essential
sudo apt install -y gcc-10 g++-10 cpp-10
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10

# Make sure your version is now 10+:
gcc --version
```
</details>

<details>
<summary>cmake & makeinfo</summary>

```bash
cmake --version

# If cmake is not installed or your cmake is not version 3.16+:
sudo apt install -y cmake

# You also need makeinfo
sudo apt-get install -y texinfo

```
</details>


## Install the EOS EVM Node

### Grab the code
```bash
git clone https://github.com/eosnetworkfoundation/eos-evm.git
cd eos-evm
git submodule update --init --recursive
```

### Build the code
```bash
mkdir build
cd build
cmake .. # this will take around 40 minutes
make -j8 # this wil take around 20 minutes
```


<details>
<summary>If you'd like to build with another compiler:</summary>

```
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ..
make -j8
```
</details>

Once done, let's add the binaries to your path.
```bash
cd cmd
# this will add the binaries to your path, and persist after reboot
echo 'export PATH=$PATH:$(pwd)' >> ~/.bashrc
source ~/.bashrc
```

You can make sure you have the binaries in your path by running:
```bash
eos-evm-node --version
```

If that command returns a version, you're ready to move on.


Loading