Skip to content

Commit

Permalink
Merge pull request #51 from eosnetworkfoundation/yarkin/version_1
Browse files Browse the repository at this point in the history
Update README and bump version
  • Loading branch information
yarkinwho authored May 14, 2024
2 parents c0dc910 + 0a112ca commit 59458bb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ PORT=50305
# MINER_FEE_MODE and MINER_FEE_PARAMETER will have no effect. Fees will be collected as before.
#
# EOS-EVM version: 1
# MINER_FEE_MODE: cpu|proportion|fixed. Priority fee will be default to 0 if unrecognized mode is set.
# MINER_FEE_MODE: cpu|fixed. Priority fee will be default to 0 if unrecognized mode is set.
MINER_FEE_MODE="cpu"

# MINER_FEE_MODE: cpu
# GAS_PER_CPU: Default: 74.
# GAS_PER_US: Default: 74.
# MINER_MARKUP_PERCENTAGE: Default 0.
# GAS_TOKEN_EXCHANGE_RATE: The rate for EOS-Gas Token, default 1.
# priority_fee = cpu_per_us / GAS_PER_CPU * (1 + MINER_MARKUP_PERCENTAGE/100) * GAS_TOKEN_EXCHANGE_RATE
# priority_fee = cpu_per_us / GAS_PER_US * (1 + MINER_MARKUP_PERCENTAGE/100) * GAS_TOKEN_EXCHANGE_RATE
# cpu_per_us will be estimated automatically.
GAS_PER_CPU=74
GAS_PER_US=74
MINER_MARKUP_PERCENTAGE=10
GAS_TOKEN_EXCHANGE_RATE=1

Expand Down
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@ For every transaction that you relay you will receive a reward in the form of EO

| 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` |
| `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. The list is a failover. list. | |
| `PORT` | The port to listen on for incoming Ethereum transactions. | `50305` |
| `EVM_ACCOUNT` | | `eosio.evm` |
| `EVM_SCOPE` | | |
| `MINER_FEE_MODE` | Set how the miner collect fees after EOS-EVM upgrading to version 1. Can be `CPU` or `FIXED`. | `FIXED` |
| `GAS_PER_CPU` | priority_fee = cpu_per_us / GAS_PER_CPU * (1 + MINER_MARKUP_PERCENTAGE/100) * GAS_TOKEN_EXCHANGE_RATE if MINER_FEE_MODE=`CPU` | 74 |
| `MINER_MARKUP_PERCENTAGE` | priority_fee = cpu_per_us / GAS_PER_CPU * (1 + MINER_MARKUP_PERCENTAGE/100) * GAS_TOKEN_EXCHANGE_RATE if MINER_FEE_MODE=`CPU` | 0 |
| `GAS_TOKEN_EXCHANGE_RATE` | priority_fee = cpu_per_us / GAS_PER_CPU * (1 + MINER_MARKUP_PERCENTAGE/100) * GAS_TOKEN_EXCHANGE_RATE if MINER_FEE_MODE=`CPU` | 1 |
| `FIXED_MINER_FEE` | Fixed priority_fee in wei if MINER_FEE_MODE=`FIXED`. | 0 |
| `EXPIRE_SEC` | Expiration time when broadcasting EOS transaction. | 60 |
| `RETRY_TX` | Whether local Leap node should retry when broadcasting failed. | true |

## Usage

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@enf/eos-evm-miner",
"version": "0.1.1",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const {
EVM_ACCOUNT = "eosio.evm",
EVM_SCOPE = "eosio.evm",
MINER_PERMISSION = "active",
GAS_PER_CPU = 74,
GAS_PER_US = 74,
EXPIRE_SEC = 60,
MINER_FEE_MODE = "fixed", // default to fixed 0 fee
FIXED_MINER_FEE = 0,
Expand Down Expand Up @@ -44,7 +44,7 @@ const eosEvmMiner = new EosEvmMiner({
expireSec: +EXPIRE_SEC,
minerFeeMode: MINER_FEE_MODE,
fixedMinerFee: +FIXED_MINER_FEE,
gasPerCpu: +GAS_PER_CPU,
gasPerUs: +GAS_PER_US,
minerMarkupPercentage: +MINER_MARKUP_PERCENTAGE,
gasTokenExchangeRate: +GAS_TOKEN_EXCHANGE_RATE,
evmAccount: EVM_ACCOUNT,
Expand Down
4 changes: 2 additions & 2 deletions src/miner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface MinerConfig {
expireSec: number;
minerFeeMode: string;
fixedMinerFee: number;
gasPerCpu: number;
gasPerUs: number;
minerMarkupPercentage: number;
gasTokenExchangeRate: number;
evmAccount: string;
Expand Down Expand Up @@ -79,7 +79,7 @@ export default class EosEvmMiner {
// Refresh cpu price first
await this.queryCpuPrice();
// Default to ~74.12 estimated from our benchmarks without OC
let gas_per_us = this.config.gasPerCpu;
let gas_per_us = this.config.gasPerUs;
if (gas_per_us == 0) {
gas_per_us = 1;
}
Expand Down

0 comments on commit 59458bb

Please sign in to comment.