-
Notifications
You must be signed in to change notification settings - Fork 790
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
Support external RPC servers via IPC #1434
Support external RPC servers via IPC #1434
Conversation
93e5ca9
to
b7c4cca
Compare
e894a49
to
d697d70
Compare
@meltingice is working on an IPC lib and gRPC interface based on this PR https://github.com/meltingice/nano-ipc-js |
d697d70
to
151f565
Compare
FYI if anyone else runs into this issue... after updating to the latest commit on this PR, the node could no longer deserialize the config. It was missing the |
Yeah, the timing upgrade was recently added to master |
I am getting an exception that's crashing the node when attempting to call The call I'm making is:
And the crash message is:
I'm running this node on macOS 10.14.2. |
@meltingice thanks for the report. This seems to be related to action handlers with asynchronous responses (wallet->change_async in this case). I'll look into it. |
Just tested and appears to be fixed now. Thanks @cryptocode! |
e225eac
to
65d55a3
Compare
5ea4099
to
7bd3404
Compare
7bd3404
to
bf83204
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
9b68c4d
to
13659df
Compare
The JS client library has been updated to match the preamble changes. https://www.npmjs.com/package/nano-ipc |
Remaining
(merge Error type and config handling #1416 first)After reviewing/testing, will also add this:
This adds support for external RPC servers that communicate with the node via IPC (currently domain sockets and tcp).
Using external web servers can benefit service scalability and security. IPC connections are persistent, which should reduce time_wait (file descriptor exhaustion) issues on busy servers.
The internal RPC server can thus be disabled in the config, yet have the functionality exposed via IPC. The JSON format is exactly the same as the internal server - clients only need to change URL.
A proof-of-concept REST server in Go is available at https://github.com/nanocurrency/rpc-go.
The IPC gateway allows for other message payloads like protobuf (there's a PR for protobuf which would need some work to work with this PR)
Technically, the IPC gateway defines a simple framing format with an encoding flag. In this case, the encoding is 1 (json rpc) which expects a payload of 32-bit big-endian size + json, which is also the case for the response. The json payload is forwarded to the node's existing RPC action handler. More info will be added to the wiki.
Configuration
To test the rpc-go server, enable either tcp or local ipc in the node config. Do the corresponding change in rpc-go's config.json (which uses domain sockets by default)
The rpc_enable flag can still be active, to access the current RPC server.