Skip to content
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

Custom RPCs for Off-chain Data #44

Open
wilwade opened this issue Jun 6, 2023 · 0 comments
Open

Custom RPCs for Off-chain Data #44

wilwade opened this issue Jun 6, 2023 · 0 comments

Comments

@wilwade
Copy link

wilwade commented Jun 6, 2023

Context: https://forum.polkadot.network/t/new-json-rpc-api-mega-q-a/3048#the-new-json-rpc-api-is-very-strict-can-i-no-longer-add-custom-json-rpc-functions-to-my-node-10

[Custom RPCs are in] one of two categories:

  • Functions that are custom to the logic of the runtime
  • Functions that are used internally for debugging

I want to suggest another category that we have looked closely at: Node Data Retrieval

Example Use Case (That we have investigated, but not made yet):
We have storage data that is indexed such that A -> B. Aka, if you have A you can find B, but if you have B you cannot find A without an O(n) search. The only need in the runtime is for A to find B, however "all" clients accessing the node wish to be able to discover B given A. (B->A) We could build custom logic that a node stored the reverse index (B->A) and maintained it such that then a Custom RPC could be provided that would easily be able to offer B->A lookup.

This is a "fat" node that would require local storage. It is close to off-chain indexing or off-chain workers, although it would likely not be a push, but a pull (https://docs.substrate.io/reference/how-to-guides/offchain-workers/)

The primary difference between this and the runtime situation, is that this isn't runtime logic. It would not be callable via chainHead_unstable_call.

I realize this isn't something we even use yet and nor does anything restrict adding RPCs, but I thought I would bring it as an additional category in case it was helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant