-
Notifications
You must be signed in to change notification settings - Fork 19.6k
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
Read-Only Geth #24445
Read-Only Geth #24445
Conversation
Hi, I have checked this out a bit, and there are many open questions. First of all, I think this is a good direction to explore. Running 'follower nodes' on a database maintained by one 'leader' geth instance is great. But the implementation details matter a lot. This PR is actually two very different changes in one: The C LibraryHere you are adding a shared library build artifact, which provides a single method to run JSON-RPC requests. I think the addition of this library is not related to primary goal of this PR, and we should discuss and implement the C library build in a separate PR. I'm definitely in favor of adding something like that. Regarding implementation details, I think the RPC integration can be done in a better way. You had to export deep internals of package rpc here because you picked the wrong interface. Read-Only ModeThis area has many open questions still. In particular, you should know that maintaining an up-to-date follower database will require more changes than just making one node read-only. One big question is, how will the follower geth learn about updates? There have been multiple attempts to figure out this feature in the past:
So overall, I would be more in favor of work on solution (2). What's necessary for that is:
If you are interested in working on this some more, we are happy to talk about it in a call. |
Hi, We are also happy to schedule a call to talk about this more. Should I reach out to you on something like discord or telegram? Thank you! |
This PR and the discussion about it seems to now be stale. I"m closing this, feel free to reopen if you want to pursue this track. |
Read-Only Geth
In this PR, I want to provide an option for using geth as a shared library to provide an abstraction to access the data without spawning a backend or rpc.
Motivation
This is useful for scaling reading from the ethereum historical data.
Currently, if a user wants to read data from the Ethereum blockchain, he has to connect to the rpc endpoint (provided by alchemy, infura, or self-hosted nodes) and make a request.
This does not scale well because of the bottleneck of the server end, because the server needs to handle all kinds of requests from clients. To support the increasing volume of reading, we need to have more geth nodes.
However, if we could create a read-only abstraction that could access the level db (on some file systems even remote) storing the blockchain data directly, then the client would not need to interact with the server to read data.
If we want to increase the reading speed, we could intuitively add more clients.
Providing the read-only geth as an option makes the scaling of reading from Ethereum more intuitive and easier.
Updates
readOnly
andLocalLib
options in thebackend.go
andnode.go
to shutdown disk writings and external network settings.rpc
package, because we might want to use them outside of therpc
package.cmd/read-only-lib
, which can be compiled as a shared library.Example
This is a brief example of how to use it as a python wrapper.
Acknowledgement
This PR is completed during my internship at Hudson River Trading. Thank the sponsorship and help from Hudson River Trading and my mentor Daniel Maclennan.