coinbase / mesh-specifications

Specification files for the Rosetta Blockchain Standard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenRPC Support

shanejonas opened this issue · comments

commented

I think this project could benefit from integration with OpenRPC which provides a base foundation for service discovery and tooling such as documentation/client generation/mock server for JSON-RPC akin to OpenAPI/Swagger.

Here is an example of an ethereum node with the OpenRPC playground, it gets the OpenRPC Document via calling the rpc.discover method:

https://playground.open-rpc.org/?schemaUrl=https://services.jade.builders/core-geth/mainnet/1.11.2

and an example of the raw document: https://github.com/etclabscore/ethereum-json-rpc-specification/blob/master/openrpc.json

Let me know how I can help.

From what I can tell, everything we are doing with the current specification (in OpenAPI/Swagger format) could be done using the OpenRPC format instead (and potentially even better as JSON-RPC 2.0 supports batching).

However, the official OpenRPC generator only seems to support code generation in 2 languages (TypeScript and Rust) as opposed to the 30+ languages supported by OpenAPI/Swagger. Many blockchain teams and integrators rely on a collection of other coding languages that aren't yet supported for code generation.

On another note, maintaining 2 forms of an API standard (and requiring all implementers + integrators to support both formats) sounds like a nightmare, so we would need to convert the specification and all implementations to the OpenRPC format. With the limited language support mentioned above, this isn't possible. If this changes in the future, we can revisit this topic.

For context, we also considered using gRPC but killed this idea because we didn't feel it was well supported in enough languages and didn't work as well in the browser as JSON although it is much more performant in many cases.