go-ethereum/docs/interacting-with-geth/rpc/ns-miner.md

85 lines
3.7 KiB
Markdown
Raw Permalink Normal View History

2022-09-09 09:28:25 -03:00
---
title: miner Namespace
description: Documentation for the JSON-RPC API "miner" namespace
---
The `miner` API is **now deprecated** because mining was switched off at the transition to proof-of-stake. It existed to provide remote control the node's mining operation and set various mining specific settings. It is provided here for historical interest!
2022-11-25 17:34:46 +00:00
## miner_getHashrate {#miner-hashrate}
2022-09-09 09:28:25 -03:00
Get hashrate in H/s (Hash operations per second).
| Client | Method invocation |
| :------ | ----------------------------------------------- |
| Console | `miner.getHashrate()` |
| RPC | `{"method": "miner_getHashrate", "params": []}` |
2022-11-25 17:34:46 +00:00
## miner_setExtra {#miner-setextra}
2022-09-09 09:28:25 -03:00
Sets the extra data a miner can include when miner blocks. This is capped at 32 bytes.
| Client | Method invocation |
| :------ | -------------------------------------------------- |
| Go | `miner.setExtra(extra string) (bool, error)` |
| Console | `miner.setExtra(string)` |
| RPC | `{"method": "miner_setExtra", "params": [string]}` |
2022-11-25 17:34:46 +00:00
## miner_setGasPrice {#miner-setgasprice}
2022-09-09 09:28:25 -03:00
Sets the minimal accepted gas price when mining transactions. Any transactions that are below this limit are excluded from the mining process.
| Client | Method invocation |
| :------ | ----------------------------------------------------- |
| Go | `miner.setGasPrice(number *rpc.HexNumber) bool` |
| Console | `miner.setGasPrice(number)` |
| RPC | `{"method": "miner_setGasPrice", "params": [number]}` |
2022-11-25 17:34:46 +00:00
## miner_setRecommitInterval {#miner-setrecommitinterval}
2022-09-09 09:28:25 -03:00
Updates the interval for recomitting the miner sealing work.
| Client | Method invocation |
| :------ | ------------------------------------------------------------- |
| Console | `miner.setRecommitInterval(interval int)` |
| RPC | `{"method": "miner_setRecommitInterval", "params": [number]}` |
2022-11-25 17:34:46 +00:00
## miner_start {#miner-start}
2022-09-09 09:28:25 -03:00
Start the CPU mining process.
2022-09-09 09:28:25 -03:00
2023-06-26 14:16:31 +01:00
| Client | Method invocation |
| :------ | ----------------------------------------- |
| Go | `miner.Start() error` |
2023-06-26 14:16:31 +01:00
| Console | `miner.start()` |
| RPC | `{"method": "miner_start", "params": []}` |
2022-09-09 09:28:25 -03:00
2022-11-25 17:34:46 +00:00
## miner_stop {#miner-stop}
2022-09-09 09:28:25 -03:00
Stop the CPU mining operation.
| Client | Method invocation |
| :------ | ---------------------------------------- |
| Go | `miner.Stop() bool` |
| Console | `miner.stop()` |
| RPC | `{"method": "miner_stop", "params": []}` |
2022-11-25 17:34:46 +00:00
## miner_setEtherbase {#miner-setetherbase}
2022-09-09 09:28:25 -03:00
Sets the etherbase, where mining rewards will go.
| Client | Method invocation |
| :------ | ------------------------------------------------------- |
| Go | `miner.SetEtherbase(common.Address) bool` |
| Console | `miner.setEtherbase(address)` |
| RPC | `{"method": "miner_setEtherbase", "params": [address]}` |
2022-11-25 17:34:46 +00:00
## miner_setGasLimit {#miner-setgaslimit}
2022-09-09 09:28:25 -03:00
Sets the gas limit the miner will target when mining. Note: on networks where EIP-1559 is activated, this should be set to twice the gas target (i.e. the effective gas used on average per block) to be.
| Client | Method invocation |
| :------ | ----------------------------------------------------- |
| Go | `miner.SetGasLimit(number *rpc.HexNumber) bool` |
| Console | `miner.SetGasLimit(number)` |
| RPC | `{"method": "miner_setGasLimit", "params": [number]}` |