Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Miner docs #481

Merged
merged 4 commits into from
Aug 23, 2021
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Bug Fixes

* (encoding) [tharsis#478](https://github.com/tharsis/ethermint/pull/478) Register `Evidence` to amino codec.
* (rpc) [tharsis#478](https://github.com/tharsis/ethermint/pull/481) Getting the node configuration when calling the `miner` rpc methods.

## [v0.5.0] - 2021-08-20

Expand Down
40 changes: 40 additions & 0 deletions docs/api/json-rpc/endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -977,3 +977,43 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"personal_ecRecover","params":["0
// Result
{"jsonrpc":"2.0","id":1,"result":"0x3b7252d007059ffc82d16d022da3cbf9992d2f70"}
```

## Miner Methods

### `miner_setGasPrice`

Sets the minimal gas price used to accept transactions. Any transaction below this limit is excluded from the validator block proposal process.

This method requires a `node` restart after being called because it changes the configuration file.

Make sure your `ethermintd start` call is not using the flag `minimum-gas-prices` because this value will be used instead of the one set on the configuration file.

#### Parameters

- Hex Gas Price


```json
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"miner_setGasPrice","params":["0x0"],"id":1}' -H "Content-Type: application/json" http://localhost:8545

// Result
{"jsonrpc":"2.0","id":1,"result":true}
```

### `miner_setEtherbase`

Sets the etherbase. It changes the wallet where the validator rewards will be deposited.

#### Parameters

- Account Address


```json
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"miner_setEtherbase","params":["0x3b7252d007059ffc82d16d022da3cbf9992d2f70"],"id":1}' -H "Content-Type: application/json" http://localhost:8545

// Result
{"jsonrpc":"2.0","id":1,"result":true}
```
2 changes: 1 addition & 1 deletion docs/api/json-rpc/namespaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Check the JSON-RPC namespaces supported on Ethermint. {synopsis}
| `clique` | The `clique` API provides access to the state of the clique consensus engine. You can use this API to manage signer votes and to check the health of a private network. | ❌ | |
| `debug` | The `debug` API gives you access to several non-standard RPC methods, which will allow you to inspect, debug and set certain debugging flags during runtime. | ✔ | |
| `les` | The `les` API allows you to manage LES server settings, including client parameters and payment settings for prioritized clients. It also provides functions to query checkpoint information in both server and client mode. | ❌ | |
| `miner` | The `miner` API allows you to remote control the node’s mining operation and set various mining specific settings. | ✔ | ❌ |
| [`miner`](./endpoints#miner-methods) | The `miner` API allows you to remote control the node’s mining operation and set various mining specific settings. | ✔ | ❌ |
| [`txpool`](./endpoints#txpool-methods) | The `txpool` API gives you access to several non-standard RPC methods to inspect the contents of the transaction pool containing all the currently pending transactions as well as the ones queued for future processing. | ✔ | ❌ |
| `admin` | The `admin` API gives you access to several non-standard RPC methods, which will allow you to have a fine grained control over your nodeinstance, including but not limited to network peer and RPC endpoint management. | ❌ | |
| [`personal`](./endpoints#personal-methods) | The `personal` API manages private keys in the key store. | ✔ | ❌ |
13 changes: 3 additions & 10 deletions ethereum/rpc/namespaces/miner/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,7 @@ func (api *API) SetEtherbase(etherbase common.Address) bool {
}

// Fetch minimun gas price to calculate fees using the configuration.
appConf, err := config.ParseConfig(api.ctx.Viper)
if err != nil {
api.logger.Error("failed to parse file.", "file", api.ctx.Viper.ConfigFileUsed(), "error:", err.Error())
return false
}
appConf := config.GetConfig(api.ctx.Viper)

minGasPrices := appConf.GetMinGasPrices()
if len(minGasPrices) == 0 || minGasPrices.Empty() {
Expand Down Expand Up @@ -164,17 +160,14 @@ func (api *API) SetEtherbase(etherbase common.Address) bool {
// to use float values, the gas prices must be configured using the configuration file
func (api *API) SetGasPrice(gasPrice hexutil.Big) bool {
api.logger.Info(api.ctx.Viper.ConfigFileUsed())
appConf, err := config.ParseConfig(api.ctx.Viper)
if err != nil {
api.logger.Debug("failed to parse config file", "file", api.ctx.Viper.ConfigFileUsed(), "error", err.Error())
return false
}
appConf := config.GetConfig(api.ctx.Viper)

var unit string
minGasPrices := appConf.GetMinGasPrices()

// fetch the base denom from the sdk Config in case it's not currently defined on the node config
if len(minGasPrices) == 0 || minGasPrices.Empty() {
var err error
unit, err = sdk.GetBaseDenom()
if err != nil {
api.logger.Debug("could not get the denom of smallest unit registered", "error", err.Error())
Expand Down