<p>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.</p>

<p>LND has a REST API which you can query with curl:
<a href="https://api.lightning.community/rest/index.html#lnd-rest-api-reference" rel="nofollow noreferrer">https://api.lightning.community/rest/index.html#lnd-rest-api-reference</a> </p>

<p>The REST interface listening port can be configured here:
<a href="https://github.com/lightningnetwork/lnd/blob/master/config.go" rel="nofollow noreferrer">https://github.com/lightningnetwork/lnd/blob/master/config.go</a> </p>

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

CC BY-SA 4.0
2019-02-03T19:23:35.970Z
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
CC BY-SA 4.0
2019-02-03T19:27:28.353Z
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.
CC BY-SA 4.0
2019-02-03T19:36:37.103Z
So.. it's not possible to do this with just one curl command? (as is the case with bitcoind)
Rog
CC BY-SA 4.0
2019-02-03T19:38:30.663Z
You can query rest api wth curl. There are curl examples in the rest api link above.
James C.
CC BY-SA 4.0
2019-02-03T19:40:55.523Z
Very much appreciate your comments btw, thanks a lot. I'm now looking through the [REST API documentation](https://api.lightning.community/rest/index.html?shell), 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
CC BY-SA 4.0
2019-02-03T19:42:54.263Z
Exactly, they need to be copied to the client. Check out the full LND getting started guide, it describes this in very well.
James C.
CC BY-SA 4.0
2019-02-03T20:49:08.260Z
Just making sure I'm not doing something wrong, I now got this working fine:
`curl -X GET --cacert $LND_DIR/tls.cert --header "$MACAROON_HEADER" https://localhost:8080/v1/genseed` However the response is `{"error":"wallet already exists","code":2}` rather than the seeds. So the connection and macaroon authentication is working fine. But *any* other command I try instead of `genseed`, such as `getinfo` or `peers` or `payments` (all as GET requests, no params) returns `Not Found` in all cases. Am I still missing something?
Rog
CC BY-SA 4.0
2020-04-13T06:40:19.677Z
@Rog I have the same problem, except I get `Not Found` for `genseed` as well. Were you able to find a solution?
Kartik Shah
CC BY-SA 4.0
2019-02-03T17:45:23.550Z
2019-02-03T18:30:08.983Z
2019-02-03T18:30:08.983Z
James C.
<p>LND has two API interfaces:</p>
<ol>
<li>On port 8080 is a REST RPC interface</li>
<li>On port 10009 is a GRPC interface.</li>
</ol>
<p>The REST interface on 8080 needs a macaroon file and an optional tls certificate.<br />
You can use CURL like this:</p>
<pre><code>MACAROON_HEADER=&quot;Grpc-Metadata-macaroon: $(xxd -ps -u -c 1000 ~/.lnd/admin.macaroon)&quot; 
curl -X GET --cacert ~/.lnd/tls.cert --header &quot;$MACAROON_HEADER&quot; https://192.168.0.7:8080/v1/getinfo
</code></pre>
<p>if you want to ignore tlc.cert add <code>-k</code> option to the curl call.</p>
<p>The parameters above are:</p>
<ol>
<li><code>~./lnd/admin.macaroon</code>: is the path to your nodes macaroon file (generated by your lnd node)</li>
<li><code>~/.lnd/tls.cert</code>: is the path to the tls cert file (generated by your lnd node)</li>
<li><code>192.168.0.7:8080</code> is the IP and port of the RPC of your LND node, if its on the same machine you can just use <code>localhost:8080</code></li>
</ol>
<p>You need the following settings in your lnd.conf:</p>
<ul>
<li><code>restlisten=0.0.0.0:8080</code> this tells LND to listen to RPC requests on port 8080</li>
<li><code>no-rest-tls=true</code> - this allows you to disable tls certificates</li>
</ul>

CC BY-SA 4.0
2022-01-04T17:41:12.850Z
Ensure you set `nolisten=0 norest=0`
frazras
CC BY-SA 4.0
2020-12-08T17:54:28.087Z
2020-12-08T17:54:28.087Z
Albert S
<p>I have a bitcoind and LND server running. I can make RPC calls to bitcoind using curl, like this:</p>

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

<p>However I can't find <strong>out how to make RPC calls to LND using curl.</strong></p>

<p>My lnd.conf contains a [Bitcoind] section like this:</p>

<pre><code>[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
</code></pre>

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

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

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

<p>(result is empty, no error, nothing)</p>

<p>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?</p>

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

<p>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)</p>

<bitcoind><json-rpc><lightning-network-daemon>
RPC calls to LND using curl?
Rog
# RPC calls to LND using curl?

(Asked by: username_0 on 2019-02-03)

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)

**Tags:** bitcoind, json-rpc, lightning-network-daemon


---

## 2 answers

### Answer by username_1 on 2019-02-03. Score: 0 | Accepted answer

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.

> **Comments:**
> **username_0**: 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?  
> **username_1**: 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.  
> **username_0**: So.. it's not possible to do this with just one curl command? (as is the case with bitcoind)  
> **username_1**: You can query rest api wth curl. There are curl examples in the rest api link above.  
> **username_0**: Very much appreciate your comments btw, thanks a lot. I'm now looking through the [REST API documentation](https://api.lightning.community/rest/index.html?shell), 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?  
> **username_1**: Exactly, they need to be copied to the client. Check out the full LND getting started guide, it describes this in very well.  
> **username_0**: Just making sure I'm not doing something wrong, I now got this working fine: `curl -X GET --cacert $LND_DIR/tls.cert --header "$MACAROON_HEADER" https://localhost:8080/v1/genseed` However the response is `{"error":"wallet already exists","code":2}` rather than the seeds. So the connection and macaroon authentication is working fine. But *any* other command I try instead of `genseed`, such as `getinfo` or `peers` or `payments` (all as GET requests, no params) returns `Not Found` in all cases. Am I still missing something?  
> **username_2**: @username_0 I have the same problem, except I get `Not Found` for `genseed` as well. Were you able to find a solution?  

---

### Answer by username_3 on 2020-12-08. Score: 2

LND has two API interfaces:

1. On port 8080 is a REST RPC interface
2. On port 10009 is a GRPC interface.

The REST interface on 8080 needs a macaroon file and an optional tls certificate.  
You can use CURL like this:

```
MACAROON_HEADER="Grpc-Metadata-macaroon: $(xxd -ps -u -c 1000 ~/.lnd/admin.macaroon)" 
curl -X GET --cacert ~/.lnd/tls.cert --header "$MACAROON_HEADER" https://192.168.0.7:8080/v1/getinfo

```

if you want to ignore tlc.cert add `-k` option to the curl call.

The parameters above are:

1. `~./lnd/admin.macaroon`: is the path to your nodes macaroon file (generated by your lnd node)
2. `~/.lnd/tls.cert`: is the path to the tls cert file (generated by your lnd node)
3. `192.168.0.7:8080` is the IP and port of the RPC of your LND node, if its on the same machine you can just use `localhost:8080`

You need the following settings in your lnd.conf:

* `restlisten=0.0.0.0:8080` this tells LND to listen to RPC requests on port 8080
* `no-rest-tls=true` - this allows you to disable tls certificates

> **Comments:**
> **username_4**: Ensure you set `nolisten=0 norest=0`  

---

