Ride-The-Lightning / c-lightning-REST

REST APIs for Core Lightning written with node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Empty reply from server"

AngeloMetal opened this issue · comments

Hello, I ran curl -X GET "http://localhost:3001/v1/getBalance" -H "accept: application/json" to try out C-Lightning-REST, but I get:
curl: (52) Empty reply from server

Node js version: v14.16.1
I'm running a Lightning node normally by the way.

1: Please ensure that the url is correct? This request should get the authentication error in response.
2: This API expects base64 macaroon value in header.
3: Are you getting any response from ‘getInfo’ API?

1: Please ensure that the url is correct? This request should get the authentication error in response.

I visit http://192.168.2.5:3001/v1/getBalance (which is the local IP address) from another computer and get this:

The connection was reset

The connection to the server was reset while the page was loading.

    The site could be temporarily unavailable or too busy. Try again in a few moments.
    If you are unable to load any pages, check your computer’s network connection.
    If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.

2: This API expects base64 macaroon value in header.

The API from where? http://192.168.2.5:4001/api-docs/? That "Authorize" button?

3: Are you getting any response from ‘getInfo’ API?

/getinfo? No.

1: Please try getinfo api first with GET endpoint at https://192.168.2.5:3001/v1/getInfo.
2: You also need to send macaroon header in Base64. Default location for the access.macaroon' is in c-lightning-REST/certs. You can get Base64 access.macaroon value with base64 c-lightning-REST/certs/access.macaroon` command.

So your final curl query should be similar to:
curl -X 'GET' 'https://192.168.2.5:3001/v1/getinfo' -H 'accept: application/json' -H 'macaroon: Ag***DQ=

1: Please try getinfo api first with GET endpoint at https://192.168.2.5:3001/v1/getInfo.

I get: {"message":"Authentication Failed!","error":"Bad Macaroon!"}, which is what I should get.

So your final curl query should be similar to

I enter curl -X 'GET' 'https://localhost:3001/v1/getinfo' -H 'accept: application/json' -H 'macaroon: Ag[...]l4='

And get:

curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

Thanks, it now works.

However, I don't think this satisfies my occasion. I want to get invoice from other peoples' nodes and deliver it to my web page. For example, client connects to my server, my server queries your invoice from your server, I get the invoice, I give your invoice to my client. I'm afraid this isn't possible, because I need other people's access.macaroon file which is meant to be private.

But, it just doesn't make sense. Why would I want such private file for letting me have your invoice?

This question is more relevant for Core Lightning telegram channel. You should learn more about offers (bolt12 invoices).

closing the issue now. Thanks.