diff --git a/docs/HowTo/Configure/Configure-Mining.md b/docs/HowTo/Configure/Configure-Mining.md index 8cc66dc21d8..3800887271f 100644 --- a/docs/HowTo/Configure/Configure-Mining.md +++ b/docs/HowTo/Configure/Configure-Mining.md @@ -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, diff --git a/docs/Reference/API-Methods.md b/docs/Reference/API-Methods.md index 15091d3096a..0d26b45af9b 100644 --- a/docs/Reference/API-Methods.md +++ b/docs/Reference/API-Methods.md @@ -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 @@ -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. diff --git a/docs/Reference/API-Objects.md b/docs/Reference/API-Objects.md index 987db8a09b5..51a28c84b67 100644 --- a/docs/Reference/API-Objects.md +++ b/docs/Reference/API-Objects.md @@ -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).