Skip to content

Commit 08efd87

Browse files
Update block parameter to include blockHash (#1280)
* Update block parameter to include blockHash Signed-off-by: Alexandra Tran <alexandra.tran@consensys.net> * lowercase block parameter Signed-off-by: Alexandra Tran <alexandra.tran@consensys.net> --------- Signed-off-by: Alexandra Tran <alexandra.tran@consensys.net>
1 parent f698576 commit 08efd87

File tree

3 files changed

+59
-43
lines changed

3 files changed

+59
-43
lines changed

docs/public-networks/how-to/use-besu-api/json-rpc.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,31 @@ parameter specifies the block. Methods such as
263263
[`eth_getTransactionByBlockNumberAndIndex`](../../reference/api/index.md#eth_gettransactionbyblocknumberandindex)
264264
have a block parameter.
265265

266-
The block parameter can have the following values:
266+
The block parameter can have one of the following values:
267267

268-
* `blockNumber` : `quantity` - The block number, specified in hexadecimal or decimal. 0 represents
268+
* `blockNumber` : *quantity* - The block number, specified in hexadecimal or decimal. 0 represents
269269
the genesis block.
270-
* `earliest` : `tag` - The earliest (genesis) block.
271-
* `latest` : `tag` - The last block mined.
272-
* `pending` : `tag` - The last block mined plus pending transactions. Use only with
270+
* `blockHash` : *string* or *object* - 32-byte block hash or JSON object specifying the block hash.
271+
If using a JSON object, you can specify `requireCanonical` to indicate whether the block must be a
272+
canonical block.
273+
See [this example](https://github.com/hyperledger/besu/blob/a2dedb0b2c7980cdc35db8eb4c094f2eb0dc7deb/ethereum/api/src/test/resources/org/hyperledger/besu/ethereum/api/jsonrpc/eth/eth_getBalance_blockHashObjectCanonical.json).
274+
275+
!!! note
276+
277+
Only the following methods support the `blockHash` parameter:
278+
279+
* [`eth_call`](../../reference/api/index.md#eth_call)
280+
* [`eth_getBalance`](../../reference/api/index.md#eth_getbalance)
281+
* [`eth_getCode`](../../reference/api/index.md#eth_getcode)
282+
* [`eth_getProof`](../../reference/api/index.md#eth_getproof)
283+
* [`eth_getStorageAt`](../../reference/api/index.md#eth_getstorageat)
284+
* [`eth_getTransactionCount`](../../reference/api/index.md#eth_gettransactioncount)
285+
286+
* `earliest` : *tag* - The earliest (genesis) block.
287+
* `latest` : *tag* - The last block mined.
288+
* `pending` : *tag* - The last block mined plus pending transactions. Use only with
273289
[`eth_getTransactionCount`](../../reference/api/index.md#eth_gettransactioncount).
274-
* `finalized` : `tag` - The most recent crypto-economically secure block.
290+
* `finalized` : *tag* - The most recent crypto-economically secure block.
275291
It cannot be reorganized outside manual intervention driven by community coordination.
276-
* `safe` : `tag` - The most recent block that is safe from reorganization under
292+
* `safe` : *tag* - The most recent block that is safe from reorganization under
277293
honest majority and certain synchronicity assumptions.

docs/public-networks/reference/api/index.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,11 @@ Removes cache files for the specified range of blocks.
212212

213213
* `fromBlock`: *string* - integer representing a block number or one of the string tags `latest`,
214214
`earliest`, or `pending`, as described in
215-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
215+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
216216

217217
* `toBlock`: *string* - integer representing a block number or one of the string tags `latest`,
218218
`earliest`, or `pending`, as described in
219-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
219+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
220220

221221
You can skip a parameter by using an empty string, `""`.
222222
If you specify:
@@ -994,7 +994,7 @@ back to the block right before the specified block, then importing the specified
994994

995995
`blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
996996
`earliest`, or `pending`, as described in
997-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
997+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
998998

999999
#### Returns
10001000

@@ -1032,7 +1032,7 @@ Sets the current head of the local chain to the block matching the specified blo
10321032

10331033
`blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
10341034
`earliest`, or `pending`, as described in
1035-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
1035+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
10361036

10371037
#### Returns
10381038

@@ -1401,7 +1401,7 @@ Returns full trace of all invoked opcodes of all transactions included in the bl
14011401

14021402
* `blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
14031403
`earliest`, or `pending`, as described in
1404-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
1404+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
14051405

14061406
* `options`: *object* - request options object with the following fields (all optional and default to `false`):
14071407

@@ -1591,9 +1591,9 @@ the `eth_call` error response includes the [revert reason](../../../private-netw
15911591

15921592
`call`: *object* - [transaction call object](objects.md#transaction-call-object)
15931593

1594-
`blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
1595-
`earliest`, or `pending`, as described in
1596-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
1594+
`blockNumber` or `blockHash`: *string* - integer representing a block number, block hash, or one of
1595+
the string tags `latest`, `earliest`, or `pending`, as described in
1596+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
15971597

15981598
!!! note
15991599

@@ -1893,7 +1893,7 @@ If blocks in the specified block range are not available, then only the fee hist
18931893

18941894
* `newestBlock`: *string* - Integer representing the highest number block of the requested range or one of the string tags `latest`,
18951895
`earliest`, or `pending`, as described in
1896-
[Block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter).
1896+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter).
18971897

18981898
#### Returns
18991899

@@ -2006,9 +2006,9 @@ Returns the account balance of the specified address.
20062006

20072007
* `address`: *string* - 20-byte account address from which to retrieve the balance
20082008

2009-
* `blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
2010-
`earliest`, or `pending`, as described in
2011-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
2009+
* `blockNumber` or `blockHash`: *string* - integer representing a block number, block hash, or one
2010+
of the string tags `latest`, `earliest`, or `pending`, as described in
2011+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
20122012

20132013
#### Returns
20142014

@@ -2201,7 +2201,7 @@ Returns information about the block matching the specified block number.
22012201

22022202
* `blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
22032203
`earliest`, `pending`, `finalized`, or `safe` as described in
2204-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
2204+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
22052205

22062206
* `verbose`: *boolean* - if `true`, returns the full [transaction objects](objects.md#transaction-object);
22072207
if `false`, returns only the hashes of the transactions.
@@ -2419,7 +2419,7 @@ Returns the number of transactions in a block matching the specified block numbe
24192419

24202420
`blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
24212421
`earliest`, or `pending`, as described in
2422-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
2422+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
24232423

24242424
#### Returns
24252425

@@ -2487,9 +2487,9 @@ Besu stores compiled smart contract code as a hexadecimal value.
24872487

24882488
`address`: *string* - 20-byte contract address
24892489

2490-
`blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
2491-
`earliest`, or `pending`, as described in
2492-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
2490+
`blockNumber` or `blockHash`: *string* - integer representing a block number, block hash, or one of
2491+
the string tags `latest`, `earliest`, or `pending`, as described in
2492+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
24932493

24942494
#### Returns
24952495

@@ -2899,7 +2899,7 @@ Returns miner data for the specified block.
28992899

29002900
`blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
29012901
`earliest`, or `pending`, as described in
2902-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
2902+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
29032903

29042904
#### Returns
29052905

@@ -2957,9 +2957,9 @@ from untrusted sources, by using a trusted block hash.
29572957

29582958
`keys`: *array* of *strings* - list of 32-byte storage keys to generate proofs for
29592959

2960-
`blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
2961-
`earliest`, or `pending`, as described in
2962-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
2960+
`blockNumber` or `blockHash`: *string* - integer representing a block number, block hash, or one of
2961+
the string tags `latest`, `earliest`, or `pending`, as described in
2962+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
29632963

29642964
#### Returns
29652965

@@ -3042,9 +3042,9 @@ Returns the value of a storage position at a specified address.
30423042

30433043
`index`: *string* - integer index of the storage position
30443044

3045-
`blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
3046-
`earliest`, or `pending`, as described in
3047-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
3045+
`blockNumber` or `blockHash`: *string* - integer representing a block number, block hash, or one of
3046+
the string tags `latest`, `earliest`, or `pending`, as described in
3047+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
30483048

30493049
#### Returns
30503050

@@ -3205,7 +3205,7 @@ Returns transaction information for the specified block number and transaction i
32053205

32063206
`blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
32073207
`earliest`, or `pending`, as described in
3208-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
3208+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
32093209

32103210
`index`: *string* - transaction index position
32113211

@@ -3414,9 +3414,9 @@ next account nonce not used by any pending transactions.
34143414

34153415
`address`: *string* - 20-byte account address
34163416

3417-
`blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
3418-
`earliest`, or `pending`, as described in
3419-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
3417+
`blockNumber` or `blockHash`: *string* - integer representing a block number, block hash, or one of
3418+
the string tags `latest`, `earliest`, or `pending`, as described in
3419+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
34203420

34213421
#### Returns
34223422

@@ -3720,7 +3720,7 @@ Returns uncle specified by block number and index.
37203720

37213721
* `blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
37223722
`earliest`, or `pending`, as described in
3723-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
3723+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
37243724

37253725
* `uncleIndex`: *string* - index of the uncle
37263726

@@ -3891,7 +3891,7 @@ Returns the number of uncles in a block matching the specified block number.
38913891

38923892
`blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
38933893
`earliest`, or `pending`, as described in
3894-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
3894+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
38953895

38963896
#### Returns
38973897

@@ -5011,7 +5011,7 @@ Provides transaction processing of [type `trace`](../trace-types.md#trace) for t
50115011

50125012
`blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
50135013
`earliest`, or `pending`, as described in
5014-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
5014+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
50155015

50165016
#### Returns
50175017

@@ -5114,7 +5114,7 @@ Executes the given call and returns a number of possible traces for it.
51145114

51155115
* `blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
51165116
`earliest`, or `pending`, as described in
5117-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
5117+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
51185118

51195119
* `options`: *array* of *strings* - list of tracing options; tracing options are
51205120
[`trace`, `vmTrace`, and `stateDiff`](../trace-types.md). Specify any
@@ -5188,7 +5188,7 @@ Performs multiple call traces on top of the same block. You can trace dependent
51885188

51895189
* `blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
51905190
`earliest`, or `pending`, as described in
5191-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
5191+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
51925192

51935193
#### Returns
51945194

@@ -5493,7 +5493,7 @@ Provides transaction processing tracing per block.
54935493

54945494
* `blockNumber`: *string* - integer representing a block number or one of the string tags `latest`,
54955495
`earliest`, or `pending`, as described in
5496-
[Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
5496+
[block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter)
54975497

54985498
* `options`: *array* of *strings* - list of tracing options; tracing options are
54995499
[`trace`, `vmTrace`, and `stateDiff`](../trace-types.md). Specify any

docs/public-networks/reference/api/objects.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ Used to [`filter logs`](../../how-to/use-besu-api/access-logs.md).
6161

6262
| Key | Type | Required/Optional | Value |
6363
|-----|:----:|:-----------------:|-------|
64-
| `fromBlock` | Quantity &#124; Tag | Optional | Integer block number or `latest`, `pending`, `earliest`. See [Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter). Default is `latest`. |
65-
| `toBlock` | Quantity &#124; Tag | Optional | Integer block number or `latest`, `pending`, `earliest`. See [Block Parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter). Default is `latest`. |
64+
| `fromBlock` | Quantity &#124; Tag | Optional | Integer block number or `latest`, `pending`, `earliest`. See [block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter). Default is `latest`. |
65+
| `toBlock` | Quantity &#124; Tag | Optional | Integer block number or `latest`, `pending`, `earliest`. See [block parameter](../../how-to/use-besu-api/json-rpc.md#block-parameter). Default is `latest`. |
6666
| `address` | Data &#124; Array | Optional | Contract address or array of addresses from which [logs](../../concepts/events-and-logs.md) originate. |
6767
| `topics` | Array of Data, 32&nbsp;bytes each | Optional | Array of topics by which to [filter logs](../../concepts/events-and-logs.md#topic-filters). |
6868

0 commit comments

Comments
 (0)