Please see the linked PR
Keeping the original post below :
Context
Not every node supports all JSON-RPC methods and there is currently no way to get a list of methods supported by a specific node (or provider/endpoint). Also, querying the node is the only way to find out if a specific method is supported.
This leads to a few issues :
- It can take a while to find a node supporting a specific method, as trial-and-error is needed. I had to query 8 providers before finding one which supported the new
eth_blobBaseFee
. - RPC providers may have to add the supported methods in their docs, which not all do and is redundant.
- Trial-and-error does not scale well for more than one method. If the user wants to find a provider supporting
n
methods, theyâll have to query each providern
times.
Proposal
I suggest adding a eth_checkMethodSupport
method, which takes a list of method strings (or signatures) as a parameter and outputs a list of booleans, corresponding to whether the provider implements it. A special case is reserved if the list is empty, and the provider would return the list of all supported methods.
This is similar to the supportsInterface(bytes4)(bool)
interface in EIP-165.
The result can be a list without loss of information and with no ambiguity but we could decide on giving a JSON as result, as this would make the returned type consistent whether we query for all methods or for specific ones. Open for discussion.
There is a special case for the eth_checkMethodSupport
itself, for completenessâ sake Iâd suggest including it but on the other hand, itâs not really needed. I believe this would be the only ârequiredâ method, but Iâm not sure that the protocol can enforced. Thatâs also open for discussion.
New use cases arising
- Implementing this would make the creation of tools like provider dashboards possible (one can filter by methods needed).
- It would also pave the way to a more general standard for modular method support (I donât know if itâs currently easy to do from a nodesâ perspective, Iâll spin up some and try on the clients.). Nodes could become hyperspecific (supporting a handful of methods), or more complete, as well as making it easy to change privileges (e.g. for paying users vs free tiers).
- Dynamic node querying would become easier. Now the balance can be queried on node A and the base fee on node B, without trying on one then the other.
Closing word
I hope you get the idea, Iâm not sure if this has been discussed before, and I genuinely think it could be a useful addition.
Examples
Suppose a node only supports eth_blockNumber
and eth_blobBaseFee
. Querying it would give :
Example 1
Query
{
"jsonrpc":"2.0",
"id":1,
"method":"eth_checkMethodSupport",
"params":["eth_blockNumber", "eth_send", "eth_blobBaseFee"]
}
Response
{
"jsonrpc":"2.0",
"id":1,
"result":[true,false,true],
}
Example 2
Query
{
"jsonrpc":"2.0",
"id":1,
"method":"eth_checkMethodSupport",
"params":[]
}
could return
Response
{
"jsonrpc":"2.0",
"id":1,
"method":"eth_checkMethodSupport",
"result":["eth_blockNumber", "eth_blobBaseFee", "eth_checkMethodSupport"]
}