Skip to content

Miner

Entity Version
Source 1.11.23-unstable/generated-at:2021-04-30T19:24:24+03:00
OpenRPC 1.2.6

miner_getHashrate

GetHashrate returns the current hashrate of the miner.

Params (0)

None

Result

uint64

  • 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"
    ]
}

Client Method Invocation Examples

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

1
2
3
func (api *PrivateMinerAPI) GetHashrate() uint64 {
    return api.e.miner.HashRate()
}// GetHashrate returns the current hashrate of the miner.
View on GitHub →


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 *PrivateMinerAPI) 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 *PrivateMinerAPI) 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_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 *PrivateMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool {
    api.e.lock.Lock()
    api.e.gasPrice = (*big.Int)(&gasPrice)
    api.e.lock.Unlock()
    api.e.txPool.SetGasPrice((*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 *PrivateMinerAPI) 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 *PrivateMinerAPI) 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 *PrivateMinerAPI) 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: 2022-06-28