Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions docs/HowTo/Configure/Configure-Mining.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ The JSON-RPC API methods for mining are:
* [`miner_stop`](../../Reference/API-Methods.md#miner_stop) to stop mining.
* [`eth_mining`](../../Reference/API-Methods.md#eth_mining) to determine whether the client is
actively mining new blocks.
* [`eth_getMinerDataByBlockHash`](../../Reference/API-Methods.md#eth_getminerdatabyblockhash) and
[`eth_getMinerDataByBlockNumber`](../../Reference/API-Methods.md#eth_getminerdatabyblocknumber) to
get the miner data for a specified block.
* [`eth_hashrate`](../../Reference/API-Methods.md#eth_hashrate) to get the number of hashes per
second with which the node is mining. Not supported for GPU mining.
* [`eth_getWork`](../../Reference/API-Methods.md#eth_getwork) to get the hash of the current block,
Expand Down
110 changes: 107 additions & 3 deletions docs/Reference/API-Methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -524,10 +524,10 @@ None

!!! note

For almost all networks network ID and chain ID are the same.
For almost all networks network ID and chain ID are the same.

The only networks in the table above with different network and chain IDs are
Classic with a chain ID of `61` and Mordor with a chain ID of `63`.
Classic with a chain ID of `61` and Mordor with a chain ID of `63`.

!!! example

Expand Down Expand Up @@ -1280,6 +1280,110 @@ Returns the account balance of the specified address.
}
```

### eth_getMinerDataByBlockHash

Returns miner data for the specified block.

#### Parameters

`data` - 32 byte block hash.

#### Returns

`result`: `object` - [Miner data](API-Objects.md#miner-data-object).

!!! example

=== "curl HTTP"

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

=== "wscat WS"

```bash
{"jsonrpc":"2.0","method": "eth_getMinerDataByBlockHash","params": ["0xbf137c3a7a1ebdfac21252765e5d7f40d115c2757e4a4abee929be88c624fdb7"],"id": 1}
```

=== "JSON result"

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"netBlockReward": "0x47c6f3739f3da800",
"staticBlockReward": "0x4563918244f40000",
"transactionFee": "0x38456548220800",
"uncleInclusionReward": "0x22b1c8c1227a000",
"uncleRewards": [
{
"hash": "0x2422d43b4f72e19faf4368949a804494f67559405046b39c6d45b1bd53044974",
"coinbase": "0x0c062b329265c965deef1eede55183b3acb8f611"
}
],
"coinbase": "0xb42b6c4a95406c78ff892d270ad20b22642e102d",
"extraData": "0xd583010502846765746885676f312e37856c696e7578",
"difficulty": "0x7348c20",
"totalDifficulty": "0xa57bcfdd96"
}
}
```

### eth_getMinerDataByBlockNumber

Returns miner data for the specified block.

#### Parameters

`quantity|tag` - Integer representing a block number or one of the string tags `latest`,
`earliest`, or `pending`, as described in
[Block Parameter](../HowTo/Interact/APIs/Using-JSON-RPC-API.md#block-parameter).

#### Returns

`result`: `object` - [Miner data](API-Objects.md#miner-data-object).

!!! example

=== "curl HTTP"

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

=== "wscat WS"

```bash
{"jsonrpc":"2.0","method": "eth_getMinerDataByBlockNumber","params": ["0x7689D2"],"id": 1}
```

=== "JSON result"

```json
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"netBlockReward": "0x47c6f3739f3da800",
"staticBlockReward": "0x4563918244f40000",
"transactionFee": "0x38456548220800",
"uncleInclusionReward": "0x22b1c8c1227a000",
"uncleRewards": [
{
"hash": "0x2422d43b4f72e19faf4368949a804494f67559405046b39c6d45b1bd53044974",
"coinbase": "0x0c062b329265c965deef1eede55183b3acb8f611"
}
],
"coinbase": "0xb42b6c4a95406c78ff892d270ad20b22642e102d",
"extraData": "0xd583010502846765746885676f312e37856c696e7578",
"difficulty": "0x7348c20",
"totalDifficulty": "0xa57bcfdd96"
}
}
```

### eth_getProof

Returns the account and storage values of the specified account, including the merkle proof.
Expand Down
17 changes: 17 additions & 0 deletions docs/Reference/API-Objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,23 @@ Returned by [`eth_getFilterChanges`](API-Methods.md#eth_getfilterchanges) and [`
| **data** | Data | Non-indexed arguments of the log. |
| **topics** | Array of Data, 32 bytes each | [Event signature hash](../Concepts/Events-and-Logs.md#event-signature-hash) and 0 to 3 [indexed log arguments](../Concepts/Events-and-Logs.md#event-parameters). |

## Miner data object

Returned by [`eth_getMinerDataByBlockHash`](API-Methods.md#eth_getminerdatabyblockhash) and
[`eth_getMinerDataByBlockNumber`](API-Methods.md#eth_getminerdatabyblocknumber).

| Key | Type | Value |
|--------------------------|-:- :-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **netBlockReward** | Quantity, Integer | The net block reward, in Wei, is `staticBlockReward + transactionFee + uncleInclusionReward`. |
| **staticBlockReward** | Quantity, Integer | The static block reward, in Wei, is preset on a hard fork. |
| **transactionFee** | Quantity, Integer | The transaction fee, in Wei, is `sum of upfront cost - refund amount for all transactions`. |
| **uncleInclusionReward** | Quantity, Integer | The uncle inclusion reward, in Wei, is `static block reward * number of ommers/32`. |
| **uncleRewards** | Map | Map of uncle block hashes and uncle miner coinbase addresses. |
| **coinbase** | Data, 20 bytes | Coinbase address. |
| **extraData** | Data | Extra data field for this block. The first 32 bytes is vanity data you can set using the [`--miner-extra-data`](../Reference/CLI/CLI-Syntax.md#miner-extra-data) command line option. |
| **difficulty** | Quantity, Integer | Difficulty of this block. |
| **totalDifficulty** | Quantity, Integer | Total difficulty of the chain until this block. |

## Pending transaction object

Returned by [`txpool_besuPendingTransactions`](API-Methods.md#txpool_besupendingtransactions).
Expand Down