Skip to content

Miner Module

The miner module provides methods to control mining operations, customize mining reward recipient address (etherbase), and manage targeted block gas limits.


miner_start

Starts the CPU/GPU mining threads on the node.

Parameters

  1. Number - (optional) Integer indicating the number of mining threads to spawn. If not supplied, defaults to CPU core count or system settings.

Returns

Boolean - true if mining started successfully, otherwise false.

Example

js
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"miner_start","params":[4],"id":1}'
// Result
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": true
}

miner_stop

Stops the active mining operations on the node.

Parameters

None

Returns

Boolean - true if mining stopped successfully, otherwise false.

Example

js
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"miner_stop","params":[],"id":1}'
// Result
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": true
}

miner_setEtherbase

Sets the address to receive coinbase rewards generated by mining new blocks.

Parameters

  1. DATA, 20 Bytes - The recipient address for mining rewards.

Returns

Boolean - true if the coinbase address was updated, otherwise false.

Example

js
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"miner_setEtherbase","params":["0xeb85a5557e5bdc18ee1934a89d8bb402398ee26a"],"id":1}'
// Result
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": true
}

miner_setGasLimit

Sets the block gas limit target that the miner will vote/aim for when mining new blocks.

Parameters

  1. QUANTITY - Target block gas limit.

Returns

Boolean - true if the gas limit target was updated, otherwise false.

Example

js
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"miner_setGasLimit","params":["0x1c9c380"],"id":1}' // 30,000,000 gas limit target
// Result
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": true
}