5

I'm looking for a way to do python graph analytics on a local machine that can call a remote lightningd to get up to date nodes and edge data from the lightning node server. How do I need to configure the node and setup lightningrpc from pyln-client to make this happen?

Thanks in advance

1

1 Answer 1

5

c-lightning by itself does not expose it's RPC over the network. This is to avoid having to dictate what kind of authorization and authentication to use in order to provide access control.

There are however a couple of options that are easy to implement and will do what you want:

  • Implement a small proxy plugin that'll export the information you need over HTTP and then just retrieve that info from your analysis machine. It'd just take a couple of lines with pyln and flask for example and since there is not write access you're good to go.
  • Use socat to expose the RPC Unix socket over TCP and then use any JSON-RPC library you'd like. Simple, but may require a.bit of care since now your exposing read write access on an unauthenticated and unencrypted network connection.
  • Use an existing rpc proxy such as sparko to expose the RPC over whatever your favorite rpc protocol is.

In your case I'd go for the first option, since you're likely just using read only access and you can do some filtering and processing on the node reducing the amount of data that needs to be transferred.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.