Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional miner methods #1604

Merged
merged 7 commits into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 104 additions & 3 deletions docs/public-networks/reference/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6238,7 +6238,7 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_uninstallFilter","params":["
## `MINER` methods

The `MINER` API methods allow you to control the node's mining operation, or settings related to
block creation in general.
block creation in general.

:::note

Expand Down Expand Up @@ -6295,6 +6295,55 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"miner_changeTargetGasLimit","par

</Tabs>

### `miner_getExtraData`

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

#### Parameters

None

#### Returns

`result`: _string_ - Hexadecimal string representation of the extra data bytes.

<Tabs>

<TabItem value="curl HTTP request" label="curl HTTP request" default>

```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"miner_getExtraData","params":[], "id":1}' http://127.0.0.1:8545
```

</TabItem>

<TabItem value="wscat WS request" label="wscat WS request">

```json
{
"jsonrpc": "2.0",
"method": "miner_getExtraData",
"params": [],
"id": 1
}
```

</TabItem>

<TabItem value="JSON result" label="JSON result">

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x68656c6c6f20776f726c64"
}
```

</TabItem>

</Tabs>

### `miner_getMinGasPrice`

Gets the minimum gas price (in wei) offered by a transaction to be included in a block.
Expand Down Expand Up @@ -6450,6 +6499,56 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"miner_setCoinbase","params":["0x

</Tabs>

### `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

`result`: _string_ - `true` or `false`

<Tabs>

<TabItem value="curl HTTP request" label="curl HTTP request" default>

```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"miner_setExtraData","params":["0x0010203"], "id":1}' http://127.0.0.1:8545
```

</TabItem>

<TabItem value="wscat WS request" label="wscat WS request">

```json
{
"jsonrpc": "2.0",
"method": "miner_setExtraData",
"params": ["0x0010203"],
"id": 1
}
```

</TabItem>

<TabItem value="JSON result" label="JSON result">

```json
{
"jsonrpc": "2.0",
"params": ["0x0010203"],
"id": 1,
"result": "true"
}
```

</TabItem>

</Tabs>

### `miner_setMinGasPrice`

Sets the minimum gas price (in wei) offered by a transaction to be included in a block.
Expand Down Expand Up @@ -6504,7 +6603,8 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"miner_setMinGasPrice","params":[

### `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`](../cli/options.md#min-priority-fee) command line option, or is set to `0` if the command line option is not specified.
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`](../cli/options.md#min-priority-fee) command line option, or is set to `0` if the command line option is not specified.
Use [`miner_getMinPriorityFee`](#miner_getminpriorityfee) to get the current value of the fee.

#### Parameters
Expand Down Expand Up @@ -6554,7 +6654,8 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"miner_setMinPriorityFee","params

### `miner_start`

Starts the mining process. To start mining, you must first specify a miner coinbase using the [`--miner-coinbase`](../cli/options.md#miner-coinbase) command line option or using [`miner_setCoinbase`](#miner_setcoinbase).
Starts the mining process.
To start mining, you must first specify a miner coinbase using the [`--miner-coinbase`](../cli/options.md#miner-coinbase) command line option or using [`miner_setCoinbase`](#miner_setcoinbase).

#### Parameters

Expand Down
Loading