You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add ETH API information to V2 API documentation (#13068)
* docs: v2 api docs updated to cover ETH group
1. Added status update about ETH APIs in v2
2. Made clear that Eth APIs have updated (F3 aware) `safe` and `finalized` semantics.
3. Added a couple of examples.
4. Removed some cruft/unnecessary sections at the top of the document
I started with Claude for this change but felt it was too wordy. I want this addition to be short and sweet and reference other parts of the doc rather than duplicate about safe and finalized.
* Updated status to be clear about what PR certain additions were made in.
* Incorporating PR feedback about safe differences with v2 and ETH to Eth.
The ETH V2 APIs implementation in PR #13026 introduces important changes to how block specifiers like "safe" and "finalized" work:
31
+
32
+
1.**TipSet Resolution**: The file `node/impl/eth/tipsetresolver.go` contains the key logic for converting Ethereum block specifiers to Filecoin tipsets. The V2 implementation:
33
+
- Connects directly to the F3 subsystem for finality information
34
+
- Implements a more responsive definition of "safe" and "finalized" blocks
35
+
- Falls back gracefully to EC finality when F3 is not available
36
+
37
+
2.**Block Handling**: In V2 ETH APIs, there's no longer a `-1` offset that was present in V1. This means:
38
+
- "latest" truly refers to the latest tipset (head)
39
+
- "safe" refers to either F3 finalized or head-200, whichever is more recent
40
+
- "finalized" directly maps to F3 finality when available
41
+
42
+
3.**Request Path**: Requests to `/v2` ETH endpoints are processed through dedicated handlers that use the F3-aware tipset resolution logic, offering faster confirmation times.
Copy file name to clipboardExpand all lines: documentation/en/api-experimental-user-facing-v2-docs/api-v2-experimental.md
+40-16Lines changed: 40 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,8 @@
8
8
# Meta
9
9
## Status
10
10
11
-
- 2025-04-23: This document has been updated to account for the minimum initial set of non-ETH /v2 API groups as specified in [issue #12991](https://github.com/filecoin-project/lotus/issues/12991).
11
+
- 2025-04-24: This document has been updated to include information about Eth APIs in `/v2`. This was reviewed in [PR #13068](https://github.com/filecoin-project/lotus/pull/13068).
12
+
- 2025-04-23: This document has been updated to account for the minimum initial set of non-Eth /v2 API groups as specified in [issue #12991](https://github.com/filecoin-project/lotus/issues/12991). This was reviewed in [PR #13051](https://github.com/filecoin-project/lotus/pull/13051)
12
13
- 2025-04-09: This document is still actively a Work In Progress. It has a draft discussing `ChainGetTipSet`. Additional APIs and API Groups will be added as part of working on [issue #12987](https://github.com/filecoin-project/lotus/issues/12987).
13
14
14
15
## Table of Contents
@@ -24,8 +25,6 @@ This ToC was generated using [Markdown All in One](https://marketplace.visualstu
24
25
-[Table of Contents](#table-of-contents)
25
26
-[Introduction](#introduction)
26
27
-[The Selector Pattern](#the-selector-pattern)
27
-
-[Overview](#overview)
28
-
-[Groups](#groups)
29
28
-[Chain](#chain)
30
29
-[ChainGetTipSet](#chaingettipset)
31
30
-[Selector Types](#selector-types)
@@ -43,6 +42,8 @@ This ToC was generated using [Markdown All in One](https://marketplace.visualstu
@@ -118,19 +119,7 @@ This documentation focuses on the `TipSetSelector` as implemented in the `ChainG
118
119
119
120
Each API group follows the same design principles of extensibility, expressiveness, and F3 awareness while minimising the API surface area.
120
121
121
-
The remainder of this documentation explores the `TipSetSelector` in detail, showing how to use it with the `ChainGetTipSet` method through various examples and use cases.
122
122
123
-
# Overview
124
-
125
-
This documentation covers the TipSet selection mechanisms in the Filecoin V2 APIs, focusing on the flexible selection patterns introduced for retrieving tipsets from the Filecoin blockchain.
126
-
127
-
## Groups
128
-
129
-
- Chain
130
-
-`ChainGetTipSet`
131
-
- State
132
-
-`StateGetActor`
133
-
-`StateGetID`
134
123
135
124
# Chain
136
125
@@ -441,6 +430,41 @@ The method returns the ID address (string) corresponding to the input address at
441
430
442
431
If the address cannot be resolved to an ID address at the specified tipset state (e.g., it never existed or was created after that tipset), an error is returned.
443
432
433
+
## Ethereum (Eth)
434
+
435
+
The V2 API namespace includes all the Ethereum (Eth) APIs that `/v1` supports, but the `finalized` and `safe` tags have been updated to consult the F3 subsystem (if enabled) for finality information. `finalized` and `safe` for the "Eth" APIs has the same meaning and fallback outlined in [Consensus Protocol Notes](#consensus-protocol-notes). In addition, in V2, `safe` will look back a maximum 30 epochs, whereas V1 looks back 30.
436
+
437
+
For a complete list of available Eth methods in V2, refer to the [V2 autogenerated documentation](https://github.com/filecoin-project/lotus/blob/master/documentation/en/api-v2-unstable-methods.md#eth).
438
+
439
+
### Examples
440
+
**Example: getting an Eth block by number using the `finalized` tag:**
441
+
442
+
```json
443
+
{
444
+
"jsonrpc": "2.0",
445
+
"method": "Eth.GetBlockByNumber",
446
+
"params": [
447
+
"finalized",
448
+
true
449
+
],
450
+
"id": 1
451
+
}
452
+
```
453
+
454
+
**Example: retrieving account balance at a `safe` block:**
455
+
456
+
```json
457
+
{
458
+
"jsonrpc": "2.0",
459
+
"method": "Eth.GetBalance",
460
+
"params": [
461
+
"0x5cbeecf99d3fdb3f25e309cc264f240bb0664031",
462
+
"safe"
463
+
],
464
+
"id": 1
465
+
}
466
+
```
467
+
444
468
# Consensus Protocol Notes
445
469
446
470
The Filecoin network is currently in the process of testing and activating Filecoin Fast Finality (F3), a new consensus mechanism that provides faster finality guarantees. During this transition period, the network will contain a mix of nodes - some with F3 enabled and others still using only the traditional Expected Consensus (EC) finality mechanism.
@@ -1107,7 +1131,7 @@ JSON-RPC allows named parameters (using a JSON object instead of an array for `p
1107
1131
1108
1132
## Future API Groups
1109
1133
1110
-
The Filecoin V2 APIs initiative will expand beyond the Chainand State API groups demonstrated in this document. Each API group will follow the same principles of using selectors for expressive queries while maintaining a minimal API surface.
1134
+
The Filecoin V2 APIs initiative will expand beyond the Chain, State, and Eth API groups demonstrated in this document. Each API group will follow the same principles of using selectors for expressive queries while maintaining a minimal API surface.
0 commit comments