-
Notifications
You must be signed in to change notification settings - Fork 415
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 all 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,51 @@ | ||
| # `eth_blockNumber` | ||
| The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [RFC-2119](https://www.ietf.org/rfc/rfc2119.txt). | ||
| Specification | 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 | | ||
|
|
||
| # Tests | ||
|
|
||
| [...] | ||
|
|
||
| # Security Considerations | ||
| `eth_blockNumber` is considered safe | ||
|
|
||
| # Notes About Usage | ||
|
|
||
| ### Description | ||
| `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. | ||
|
|
||
| ### 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" | ||
| } | ||
| ``` | ||
|
|
||
| # 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,27 @@ | ||
|
|
||
| # `Quantity` | ||
| The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [RFC-2119](https://www.ietf.org/rfc/rfc2119.txt). | ||
| | Requirement | 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" | | ||
| | 5 | A `Quantity` value **MUST** represent an unsigned integer value | | ||
| | 6 | A `Quantity` value **MUST** represent a 32 byte hex encoded decimal with the leading `0`s stripped | | ||
|
|
||
| # Notes About Usage | ||
| ### Description | ||
| `Quantity` is the 32 byte hex-encoded representation of a decimal value | ||
|
|
||
| ### 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this contradictory with 5? I guess the idea behind this is to specify that an implementer should be able to accept 256-bit (32bytes) unsigned ints, isn't it?