ethereum / portal-network-specs

Official repository for specifications for the Portal Network
301 stars 81 forks source link

Beacon Light Client Network RPC endpoints #241

Open acolytec3 opened 10 months ago

acolytec3 commented 10 months ago

Based on some questions I received on Discord around how to use the various networks that Ultralight supports (and specifically what we could do with the beacon network), I started thinking about what might be some useful data to expose from the RPC as it related to the Beacon network.

Ultralight currently exposes the following endpoints that are related to the beacon network.

Under a new Beacon namespace (I imagine it to correspond to the eth namespace except it supplies the beacon data that Portal Network can serve in a relatively user friendly way as opposed to requiring the RPC consumer to construct content keys and use the lower level beacon_sendFindContent

Non-standard utility endpoint exposed for convenience

This is just thoughts at this point as Ultralight needed some way to make this data available but something like above feels like a good starting point for making this data available (since it's not readily available through existing high level endpoints in the JSON-RPC) spec

acolytec3 commented 10 months ago

cc @ogenev @kdeme for your thoughts here

ogenev commented 10 months ago

I'm not sure if we need a beacon_ namespace, because we already have this concept of portal namespace + network name (aka portalbeacon...). I think the idea of a `portalnamespace is to distinguish explicitly by other endpoints from the Ethereum ecosystem likeeth_` for example.

acolytec3 commented 10 months ago

I don't disagree. The only reason I thought of having a separate beacon namespace is that our portal_ namespace feels very dedicated to the fine grained endpoints that drive the Portal Network client as opposed to the sort of endpoints I'm proposing above which are more "userland" level, not requiring specific knowledge of Portal Network content keys and the like. Either way, happy to make whatever changes the group finds consensus on.

kdeme commented 10 months ago

So I was planning here to provided on one end, just the regular portal_beaconABCD type of calls, like we do for the other networks, and on the other end provide a partial implementation of the consensus layer REST API: calls such as /eth/v1/beacon/headers/{block_id}, /eth/v1/beacon/states/{state_id}/root and the ones for the light client objects such as /eth/v1/beacon/light_client/optimistic_update, etc.

But I haven't actually done this yet, so I'm not sure if there would be something missing that we cannot do with either of these.

acolytec3 commented 10 months ago

Interesting. Hadn't thought of the idea of using the beacon API routes. I kind of like that idea, especially since we're going to be exposing the historical roots object at some point

acolytec3 commented 9 months ago

@g11tech, do you have any thoughts here about beacon REST API endpoints that should be exposed by the portal network RPC? Note, we only have light client data structures within Portal Network so LightClientUpdate, OptimisticUpdate, FinalityUpdate, and LightClientBootstrap

acolytec3 commented 1 month ago

Now we have #331 as an idea to add a portal_finalizedStateRoot endpoint for the RPC so would be curious if there has been any further thoughts here. I'm good with not having a specialized beacon_... namespace so curious if people would rather go the route of using the beacon spec endpoint route for serving our beacon network content like @kdeme suggested here or how we should proceed? I don't have strong opinions beyond thinking we should agree upon endpoints that allow a consuming app to retrieve the data structures directly (so either use the existing beacon API routes or else some portal_* type endpoints.