alexbosworth / ln-service

Node.js interface to LND
MIT License
319 stars 60 forks source link

Using lnService with Voltage nodes #166

Open colinmessitt opened 2 years ago

colinmessitt commented 2 years ago

Has anyone succeeded in connecting a node.js app to a Voltage node? I can successfully connect to one of my own docker nodes, but the exact same code (with BASE64 encoded versions of the TLS and admin macaroon as supplied by the Voltage node) won't connect to the Voltage node.

const { lnd } = lnService.authenticatedLndGrpc({ cert: ' base64 cert', macaroon: 'base64 admin macaroon', socket: 'lottery-node1.m.voltageapp.io:10009', });

comes back with lnd just a load of zeros and I can't figure out why. I can successfully telnet to port 10009 on the socket so it seems to be running. Any suggestions on how to debug it?

Colin

alexbosworth commented 2 years ago

You could ask them

colinmessitt commented 2 years ago

Thanks for responding so quick.

I did ask and they suggested that I didn't need to use the TLS which kind of surprised me, I tried it but no different. I then put their supplied TLS through a certificate decoder and it showed as expired on 6th September which I guess would cause the failure so I've gone back to them querying that.

alexbosworth commented 2 years ago

Is there a specific error when you try to use that LND object?

dannydeezy commented 2 years ago

@colinmessitt i had the same issue. when I just left the cert out it worked:

const { lnd } = authenticatedLndGrpc({
    macaroon,
    socket,
});
colinmessitt commented 2 years ago

I've now tried it leaving out the cert, and with a Base64 encoded version of the cert that they have recreated and is not now expired. Neither work, and if I try to use the LND object it comes back with a 503 with error text "ERROR: 14 UNAVAILABLE: No Connection Established" which suggests to me the LND Object is invalid.

The LND variable shows in the IDE at that point as...

image

I'm at a bit of a loss how to figure this out. If it should work without the cert then I guess that just leaves the macaroon as being wrong somehow. I've created the macaroon string by feeding the admin.macaroon file from Voltage through base64 with the -w0 parameter so maybe I've done that wrong somehow, or the macaroon I have downloaded from Voltage is bad.

colinmessitt commented 2 years ago

Aha, I've got it working. I couldn't leave the cert out completely, but I could pass an empty string and that seems to fix it. Like so...

const { lnd } = lnService.authenticatedLndGrpc({ cert: '',
macaroon: 'base64 encoded admin macaroon', socket: 'socket...:10009', });

I tried that before but I just realised I tried when they had an expired cert and at that time it failed. Now their cert is valid it seems to work.

Many thanks for your help!