0

I have a bitcoind and LND server running. I can make RPC calls to bitcoind using curl, like this:

curl http://XXX:YYY@localhost:8332 -H 'content-type:text/plain;' --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getblockchaininfo","params":[]}'

However I can't find out how to make RPC calls to LND using curl.

My lnd.conf contains a [Bitcoind] section like this:

[Bitcoind]
bitcoind.rpchost=127.0.0.1:8332
bitcoind.rpcuser=XXX
bitcoind.rpcpass=YYY
bitcoind.zmqpubrawblock=127.0.0.1:28332
bitcoind.zmqpubrawtx=127.0.0.1:28333

However, what I'm struggling with is finding out or configuring how to actually connect to LND itself with RPC.

Can't find clear documentation about this. I figured out that apparently I need to use port 10009, but this doesn't work:

curl http://XXX:YYY@localhost:10009 -H 'content-type:text/plain;' --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getinfo","params":[]}'

(result is empty, no error, nothing)

I guessed perhaps I need to set a separate RPC username and password for LND, but I can't find out how or where, i.e. what the settings are in lnd.conf?

Also, do I have to add a config line to make sure the LND daemon is listening to RPC calls?

Also, do I have to add a config line to make sure the LND daemon is accepting RPC calls from specific IPs? (localhost in this case, or adding external IPs later)

0

The lnd.conf information you shared above is required for the LND instance to query your local bitcoind node (to detect or follow on-chain/mempool events), and does not represent the LND user interface.

LND has a REST API which you can query with curl: https://api.lightning.community/rest/index.html#lnd-rest-api-reference

The REST interface listening port can be configured here: https://github.com/lightningnetwork/lnd/blob/master/config.go

The LND documentation describes it in more detail, but you will need to generate valid macaroons for LND https calls.

  • Thanks, but is there no RPC API in LND? Maybe I made some wrong assumptions about how this works. What is LND's port 10009 supposed to do? I though that was for RPC calls, or does that serve another purpose? – Rog Feb 3 at 19:23
  • That is not jsonrpc but grpc. If you want to use that you have to compile the interface proto file to the language of your choice and include the interface stub in your client code. – James C. Feb 3 at 19:27
  • So.. it's not possible to do this with just one curl command? (as is the case with bitcoind) – Rog Feb 3 at 19:36
  • You can query rest api wth curl. There are curl examples in the rest api link above. – James C. Feb 3 at 19:38
  • Very much appreciate your comments btw, thanks a lot. I'm now looking through the REST API documentation, however the first example shows the creation of the macaroon header, and a curl command line which uses the tls.cert file in the LND directory. But isn't this supposed to work from somewhere remote, i.e. without having access to local files on the server (i.e. the tls.cert and the .macaroon file)? Or are they supposed to be copied to a remote client location from where you want to call the LND server's REST API? – Rog Feb 3 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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