-
Notifications
You must be signed in to change notification settings - Fork 472
eth_blockNumber #27
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
Closed
Closed
eth_blockNumber #27
Changes from 11 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3a1dca7
add implementations from each client
alita-moore ad5693c
implementations
alita-moore b5d46bb
copy paste
alita-moore 19bfdb9
update and types
alita-moore 2e7398f
rename and types
alita-moore fbd9293
Update eth_blockNumber.md
alita-moore c674144
Update eth_blockNumber.md
alita-moore a891490
Update eth_blockNumber.md
alita-moore 4b7d9c5
update formatting
alita-moore 12ae371
Merge branch 'getBlockNumber' of https://github.com/alita-moore/eth1.…
alita-moore f5cda74
more formatting
alita-moore f68dc53
address comments
alita-moore 8b6cb12
address comments
alita-moore 94e77fa
reformat
alita-moore 00cba36
remove simple summary
alita-moore ccf2c32
reformat
alita-moore 8527ef0
reformat
alita-moore ceb4623
write out full words
alita-moore File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| --- | ||
| title: JSPON RPC eth_blockNumber Spec | ||
| author: Tomasz K. Stanczak (@tkstanczak) | ||
| discussions-to: https://github.com/ethereum-oasis/eth1.x-JSON-RPC-API-standard | ||
| created: 2021-04-13 | ||
| --- | ||
|
|
||
| ## Simple Summary | ||
| This document strictly specifies the expected behaviour of the `eth_blockNumber` Eth 1.x JSON RPC endpoint. | ||
|
|
||
| The definition of being able to serve the full state has been introduced to clarify the behaviour in the midst of fast sync and similar. | ||
|
|
||
| ## Motivation | ||
| `eth_blockNumber` is the most commonly called JSON RPC endpoint, yet it has some undefined edge cases. The goal is to assert its behavior for all current and future Ethereum 1.x client implementations. | ||
|
|
||
| ## Specification | ||
|
|
||
| | Spec | Description | | ||
| | ----------- | --------------------------------------------------- | | ||
| | **δ1** | Returns the number of the block that is the current chain head (the latest best processed and verified block on the chain) | | ||
| | **δ2** | The number of the chain head is returned if the node has ability of serving the header, body, and the full state starting from the state root of the block having the number in a finite time | | ||
| | **δ3** | The node may know a higher block number but still return a lower one if the lower number block has higher total difficulty or if the higher number block has not been fully processed yet | | ||
| | **δ4** | Provides no promise on for how long the node will keep the block details so if you request the block data for the given block number any time after receiving the block number itself, you may get a null response | | ||
| | **δ5** | Returns an error if the node has not yet processed or failed to process the genesis block. Some nodes MAY decide not to enable JSON RPC if the genesis block calculation has not been done yet | | ||
|
|
||
| ##### Parameters | ||
|
|
||
| _(none)_ | ||
|
|
||
| ##### Returns | ||
|
|
||
| {[`Quantity`](./types/Quantity.md)} - number of the latest block | ||
|
|
||
| ##### Example | ||
|
|
||
| ```sh | ||
| # Request | ||
| curl -X POST --data '{ | ||
| "id": 1337, | ||
| "jsonrpc": "2.0", | ||
| "method": "eth_blockNumber", | ||
| "params": [] | ||
| }' <url> | ||
|
|
||
| # Response | ||
| { | ||
| "id": 1337, | ||
| "jsonrpc": "2.0", | ||
| "result": "0xc94" | ||
| } | ||
| ``` | ||
| ## Security Considerations | ||
| `eth_blockNumber` is considered safe | ||
|
|
||
| ## Copyright | ||
| Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| --- | ||
| title: JSPON RPC Quantity Type Spec | ||
| author: Alita Moore (@alita-moore) | ||
| discussions-to: https://github.com/ethereum-oasis/eth1.x-JSON-RPC-API-standard | ||
| created: 2021-04-13 | ||
| --- | ||
|
|
||
| # `Quantity` | ||
|
|
||
| ##### Description | ||
|
alita-moore marked this conversation as resolved.
Outdated
|
||
|
|
||
| `Quantity` represents the | ||
|
alita-moore marked this conversation as resolved.
Outdated
|
||
|
|
||
| ##### Requirements | ||
|
|
||
| | Req. | Description | | ||
| | ----------- | ------------ | | ||
| | **Γ1** | A `Quantity` value **MUST** be hex-encoded | | ||
| | **Γ2** | A `Quantity` value **MUST** be "0x"-prefixed | | ||
| | **Γ3** | A `Quantity` value **MUST** be expressed using the fewest possible hex digits per byte | | ||
| | **Γ4** | A `Quantity` value **MUST** express zero as "0x0" | | ||
|
alita-moore marked this conversation as resolved.
Outdated
|
||
|
|
||
| ##### Examples | ||
|
|
||
| |Value|Valid|Reason| | ||
| |-|-|-| | ||
| |0x|`invalid`|empty not a valid quantity| | ||
| |0x0|`valid`|interpreted as a quantity of zero| | ||
| |0x00|`invalid`|leading zeroes not allowed| | ||
| |0x41|`valid`|interpreted as a quantity of 65| | ||
| |0x400|`valid`|interpreted as a quantity of 1024| | ||
| |0x0400|`invalid`|leading zeroes not allowed| | ||
| |ff|`invalid`|values must be prefixed| | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.