Open shanejonas opened 4 years ago
here is just a concrete example of 1 method: getblockhash
:
{
"openrpc": "1.0.0",
"info": {
"version": "0.0.1",
"title": "RPC API",
"description": "This API lets you interact with the blockchain via JSON-RPC"
},
"methods": [
{
"name": "getblockhash",
"summary": "Returns hash of block in best-block-chain at <index>",
"description": "Returns hash of block in best-block-chain at <index>; index 0 is the genesis block.",
"params": [
{
"name": "index",
"description": "index of best-block-chain.index 0 is the genesis block",
"required": true,
"schema": {
"type": "integer”
}
}
],
"result": {
"name": "blockhash",
"description": "The block hash is the hash of the parent block in the blockchain.",
"schema": {
"type": "string",
"pattern": "[a-fA-F\\d]+$"
}
},
"examples": [
{
"name": "getGenesisBlockHash",
"description": "an example of requesting a block hash for genesis block 0",
"params": [
{
"name": "genesisBlockIndex",
"description": "index 0 is the genesis block",
"value": 0
}
],
"result": {
"name": "genesisBlockHash",
"summary": "The hash of the genesis block",
"description": "The hash of the genesis block has two more leading hex zeroes than were required for an early block.",
"value": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
}
}
]
}
]
}
and an example of auto completion in the inspector:
Details
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/?url=https://services.jade.builders/core-geth/mainnet/1.11.2
and just the bare inspector: https://inspector.open-rpc.org/?url=https://services.jade.builders/core-geth/mainnet/1.11.2
Let me know how I can help.