Skip to content

Miner

Entity Version
Source 1.12.14-unstable/generated-at:2023-09-04T08:02:34-06:00
OpenRPC 1.2.6

miner_setEtherbase

SetEtherbase sets the etherbase of the miner.

Params (1)

Parameters must be given by position.

1: etherbase common.Address

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a Keccak 256 hash POINTER`
- pattern: `^0x[a-fA-F\d]{64}$`
- title: `keccak`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a Keccak 256 hash POINTER",
    "pattern": "^0x[a-fA-F\\d]{64}$",
    "title": "keccak",
    "type": [
        "string"
    ]
}

Result

bool

  • Required: ✓ Yes

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "miner_setEtherbase", "params": [<etherbase>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "miner_setEtherbase", "params": [<etherbase>]}'
1
miner.setEtherbase(etherbase);
Source code

1
2
3
4
func (api *MinerAPI) SetEtherbase(etherbase common.Address) bool {
    api.e.SetEtherbase(etherbase)
    return true
}// SetEtherbase sets the etherbase of the miner.
View on GitHub →


miner_setExtra

SetExtra sets the extra data string that is included when this miner mines a block.

Params (1)

Parameters must be given by position.

1: extra string

  • Required: ✓ Yes

Result

bool

  • Required: ✓ Yes

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "miner_setExtra", "params": [<extra>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "miner_setExtra", "params": [<extra>]}'
1
miner.setExtra(extra);
Source code

1
2
3
4
5
6
7
func (api *MinerAPI) SetExtra(extra string) (bool, error) {
    if err := api.e.Miner().SetExtra([ // SetExtra sets the extra data string that is included when this miner mines a block.
    ]byte(extra)); err != nil {
        return false, err
    }
    return true, nil
}
View on GitHub →


miner_setGasLimit

SetGasLimit sets the gaslimit to target towards during mining.

Params (1)

Parameters must be given by position.

1: gasLimit hexutil.Uint64

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of a uint64`
- pattern: `^0x([a-fA-F\d])+$`
- title: `uint64`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of a uint64",
    "pattern": "^0x([a-fA-F\\d])+$",
    "title": "uint64",
    "type": [
        "string"
    ]
}

Result

bool

  • Required: ✓ Yes

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "miner_setGasLimit", "params": [<gasLimit>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "miner_setGasLimit", "params": [<gasLimit>]}'
1
miner.setGasLimit(gasLimit);
Source code

1
2
3
4
func (api *MinerAPI) SetGasLimit(gasLimit hexutil.Uint64) bool {
    api.e.Miner().SetGasCeil(uint64(gasLimit))
    return true
}// SetGasLimit sets the gaslimit to target towards during mining.
View on GitHub →


miner_setGasPrice

SetGasPrice sets the minimum accepted gas price for the miner.

Params (1)

Parameters must be given by position.

1: gasPrice hexutil.Big

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of the integer",
    "pattern": "^0x[a-fA-F0-9]+$",
    "title": "integer",
    "type": [
        "string"
    ]
}

Result

bool

  • Required: ✓ Yes

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "miner_setGasPrice", "params": [<gasPrice>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "miner_setGasPrice", "params": [<gasPrice>]}'
1
miner.setGasPrice(gasPrice);
Source code

1
2
3
4
5
6
7
func (api *MinerAPI) SetGasPrice(gasPrice hexutil.Big) bool {
    api.e.lock.Lock()
    api.e.gasPrice = (*big.Int)(&gasPrice)
    api.e.lock.Unlock()
    api.e.txPool.SetGasTip((*big.Int)(&gasPrice))
    return true
}// SetGasPrice sets the minimum accepted gas price for the miner.
View on GitHub →


miner_setRecommitInterval

SetRecommitInterval updates the interval for miner sealing work recommitting.

Params (1)

Parameters must be given by position.

1: interval int

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of the integer",
    "pattern": "^0x[a-fA-F0-9]+$",
    "title": "integer",
    "type": [
        "string"
    ]
}

Result

None

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "miner_setRecommitInterval", "params": [<interval>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "miner_setRecommitInterval", "params": [<interval>]}'
1
miner.setRecommitInterval(interval);
Source code

1
2
3
func (api *MinerAPI) SetRecommitInterval(interval int) {
    api.e.Miner().SetRecommitInterval(time.Duration(interval) * time.Millisecond)
}// SetRecommitInterval updates the interval for miner sealing work recommitting.
View on GitHub →


miner_start

Start starts the miner with the given number of threads. If threads is nil, the number of workers started is equal to the number of logical CPUs that are usable by this process. If mining is already running, this method adjust the number of threads allowed to use and updates the minimum price required by the transaction pool.

Params (1)

Parameters must be given by position.

1: threads *int

  • Required: ✓ Yes
1
2
3
4
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string
1
2
3
4
5
6
7
8
{
    "description": "Hex representation of the integer",
    "pattern": "^0x[a-fA-F0-9]+$",
    "title": "integer",
    "type": [
        "string"
    ]
}

Result

None

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "miner_start", "params": [<threads>]}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "miner_start", "params": [<threads>]}'
1
miner.start(threads);
Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
func (api *MinerAPI) Start(threads *int) error {
    if threads == nil {
        return api.e.StartMining(runtime.NumCPU())
    }
    return api.e.StartMining(*threads)
}// Start starts the miner with the given number of threads. If threads is nil,
// the number of workers started is equal to the number of logical CPUs that are
// usable by this process. If mining is already running, this method adjust the
// number of threads allowed to use and updates the minimum price required by the
// transaction pool.
View on GitHub →


miner_stop

Stop terminates the miner, both at the consensus engine level as well as at the block creation level.

Params (0)

None

Result

None

Client Method Invocation Examples

1
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "miner_stop", "params": []}'
1
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "miner_stop", "params": []}'
1
miner.stop();
Source code

1
2
3
4
func (api *MinerAPI) Stop() {
    api.e.StopMining()
}// Stop terminates the miner, both at the consensus engine level as well as at
// the block creation level.
View on GitHub →



Last update: 2024-06-10