Skip to content

FRC-0104: Common Node API #1158

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

AlexeyKrasnoperov
Copy link

As discussed during FDS-6 in Toronto, I'm opening this PR as a replacement for the previously closed #1027.

The OpenRPC spec is added to the resources directory.

FRCs/frc-0104.md Outdated
<!--The technical specification should describe the syntax and semantics of any new feature. The specification should be detailed enough to allow competing, interoperable implementations for any of the current Filecoin implementations. -->

Using the [OpenRPC document](https://spec.open-rpc.org/#openrpc-document) format we define several groups of methods.
This specification can be found here: https://github.com/ChainSafe/filecoin-openrpc-spec. A list of the methods is included below for posterity.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repository is archived. The only up-to-date specification should be the one you added.

FRCs/frc-0104.md Outdated
Comment on lines 52 to 55
> Note: Lotus hosts two different API's at HTTP paths [`/rpc/v0`](https://github.com/filecoin-project/lotus/blob/v1.
> 28.0-rc5/documentation/en/api-v0-methods.md) and [`/rpc/v1`](https://github.com/filecoin-project/lotus/blob/v1.28.0-rc5/documentation/en/api-v1-unstable-methods.md),
with the latter being marked as _unstable_.
This document aims to specify the `v1` API.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It now hosts /v2 as well.

@BigLep BigLep mentioned this pull request May 27, 2025
@BigLep BigLep added this to FilOz Jun 3, 2025
@github-project-automation github-project-automation bot moved this to 📌 Triage in FilOz Jun 3, 2025
@BigLep BigLep moved this from 📌 Triage to 🐱 Todo in FilOz Jun 3, 2025
@BigLep BigLep moved this from 🐱 Todo to 🔎 Awaiting Review in FilOz Jun 3, 2025
@BigLep BigLep requested a review from masih June 3, 2025 04:36

## Methods

> Working document: https://docs.google.com/spreadsheets/d/1fFkQuEjvFAd2s1dGX5zGmhxsEMLMUZ4uQFnIXgSZA5w/edit?usp=drivesdk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The table below does not render correctly Can I ask you to adjust the blockquote spacing to fix this please?

<!--The technical specification should describe the syntax and semantics of any new feature. The specification should be detailed enough to allow competing, interoperable implementations for any of the current Filecoin implementations. -->

Using the [OpenRPC document](https://spec.open-rpc.org/#openrpc-document) format we define several groups of methods.
This specification can be found in `/resources/frc-0104` directory. A list of the methods is included below for posterity.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link it? You can use relative path in Markdown to link to the JSON API spec.

## Test Cases
<!--Test cases for an implementation are mandatory for FIPs that are affecting consensus changes. Other FIPs can choose to include links to test cases if applicable.-->

[TODO]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any existing GitHub issues to link here?

## Security Considerations
<!--All FIPs must contain a section that discusses the security implications/considerations relevant to the proposed change. Include information that might be important for security discussions, surfaces risks and can be used throughout the life cycle of the proposal. E.g., include security-relevant design decisions, concerns, important discussions, implementation-specific guidance and pitfalls, an outline of threats and risks and how they are being addressed. FIP submissions missing the "Security Considerations" section will be rejected. A FIP cannot proceed to status "Final" without a Security Considerations discussion deemed sufficient by the reviewers.-->

Node implementers must consider the security implications of all methods and ensure sufficient access controls are implemented. This is beyond the scope of this FIP.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hint at existing read vs. write vs. admin permissions as defined in Lotus as a guideline?

| ChainReadObj | State query | Reads IPLD nodes referenced by the specified CID from the chain blockstore and returns raw bytes. |
| ChainTipSetWeight | State query | Returns the weight of the specified tipset. |
| GasEstimateFeeCap | Transactions | Returns the estimated fee cap for the given parameters. |
| GasEstimateGasLimit | Transactions | Returns the estimated gas limit for the given parameters. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

common-node-api.json is missing GasEstimateGasLimit and GasEstimateGasPremium methods.

# FRC-0104: Common Node API

## Simple Summary
Establish an basic specification for the common JSON-RPC API provided by Filecoin node implementations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Establish an basic specification for the common JSON-RPC API provided by Filecoin node implementations.
Establish a basic specification for the common JSON-RPC API provided by Filecoin node implementations.

<!--The motivation is critical for FIPs that want to change the Filecoin protocol. It should clearly explain why the existing protocol specification is inadequate to address the problem that the FIP solves. FIP submissions without sufficient motivation may be rejected outright.-->


The JSON-RPC interface provided by Filecoin node implementations is the primary interaction point for many systems, however a standard interface has yet to be established definitively. Lacking such standards, builders are forced to invest additional time and resources in reverse engineering implementations. Node interoperability is hindered as there are no gurantees about what APIs will be encountered in the wild. A proper specification will enable the development of applications that are implementation-agnostic.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The JSON-RPC interface provided by Filecoin node implementations is the primary interaction point for many systems, however a standard interface has yet to be established definitively. Lacking such standards, builders are forced to invest additional time and resources in reverse engineering implementations. Node interoperability is hindered as there are no gurantees about what APIs will be encountered in the wild. A proper specification will enable the development of applications that are implementation-agnostic.
The JSON-RPC interface provided by Filecoin node implementations is the primary interaction point for many systems, however a standard interface has yet to be established definitively. Lacking such standards, builders are forced to invest additional time and resources in reverse engineering implementations. Node interoperability is hindered as there are no guarantees about what APIs will be encountered in the wild. A proper specification will enable the development of applications that are implementation-agnostic.

Node implementations must include all specified methods in their API without any modifications.

Conformance to the specification requires the following conditions to be met:
- For each method, the `name`, `paramStructure` and `deprecated` fields must match the specification. Additionally, the number and order of parameters much also match the specification.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- For each method, the `name`, `paramStructure` and `deprecated` fields must match the specification. Additionally, the number and order of parameters much also match the specification.
- For each method, the `name`, `paramStructure` and `deprecated` fields must match the specification. Additionally, the number and order of parameters must also match the specification.

| StateGetRandomnessDigestFromBeacon | State query | Samples the beacon for randomness. |
| StateGetRandomnessDigestFromTickets | State query | Samples the chain for randomness. |
| StateGetRandomnessFromBeacon | State query | Returns the beacon entry for the specified Filecoin epoch. If unavailable, the call blocks until it becomes available. |
| StateGetRandomnessFromTickets | State query | |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing description

@github-project-automation github-project-automation bot moved this from 🔎 Awaiting Review to ⌨️ In Progress in FilOz Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ⌨️ In Progress
Development

Successfully merging this pull request may close these issues.

4 participants