For AI agents: a documentation index is available at /llms.txt. Markdown versions of pages are available by appending .md to any documentation URL.
Skip to main content

MINER methods

The MINER API methods allow you to control settings related to block creation.

note

The MINER API is not enabled by default for JSON-RPC. Enable it using the --rpc-http-api or --rpc-ws-api option.

miner_changeTargetGasLimit

Updates the target gas limit set using the --target-gas-limit command line option.

Parameters

  • gasPrice: number - Target gas price in wei.

Returns

  • Success or error.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "miner_changeTargetGasLimit",
"params": [
800000
],
"id": 1
}'

miner_getExtraData

Retrieves the current extra data field that is used when producing blocks.

Parameters

  • None

Returns

  • Hexadecimal string representation of the extra data bytes.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "miner_getExtraData",
"params": [],
"id": 1
}'

miner_getMinGasPrice

Gets the minimum gas price (in wei) offered by a transaction to be included in a block. The initial value is set using the --min-gas-price command line option, or is set to 1000 if the command line option is not specified. Use miner_setMinGasPrice to change the current value of the gas price.

Parameters

  • None

Returns

  • Minimum gas price (in wei) as a hexadecimal string.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "miner_getMinGasPrice",
"params": [],
"id": 1
}'

miner_getMinPriorityFee

Gets the minimum priority fee per gas (in wei) offered by a transaction to be included in a block. The initial value is set using the --min-priority-fee command line option, or is set to 0 if the command line option is not specified. Use miner_setMinPriorityFee to change the current value of the fee.

Parameters

  • None

Returns

  • Minimum priority fee per gas (in wei) as a hexadecimal string.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "miner_getMinPriorityFee",
"params": [],
"id": 1
}'

miner_setExtraData

Sets a new value for the extra data field that is used when producing blocks.

Parameters

  • extraData: string - Hexadecimal representation of the extra data field, with a maximum of 32 bytes.

Returns

  • true or false.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "miner_setExtraData",
"params": [
"0x0010203"
],
"id": 1
}'

miner_setMinGasPrice

Sets the minimum gas price (in wei) offered by a transaction to be included in a block. The initial value is set using the --min-gas-price command line option, or is set to 1000 if the command line option is not specified. Use miner_getMinGasPrice to get the current value of the gas price.

Parameters

  • minGasPrice: string - Minimum gas price in hexadecimal.

Returns

  • true when the gas price is set.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "miner_setMinGasPrice",
"params": [
"0x5dc"
],
"id": 1
}'

miner_setMinPriorityFee

Sets the minimum priority fee per gas (in wei) offered by a transaction to be included in a block. The initial value is set using the --min-priority-fee command line option, or is set to 0 if the command line option is not specified. Use miner_getMinPriorityFee to get the current value of the fee.

Parameters

  • minPriorityFeePerGas: string - Minimum priority fee per gas in hexadecimal.

Returns

  • true when the fee is set.

Example

curl -X POST http://127.0.0.1:8545/ \
-H "Content-Type: application/json" \
--data '{
"jsonrpc": "2.0",
"method": "miner_setMinPriorityFee",
"params": [
"0x0a"
],
"id": 1
}'