Lnd: Using api with gRPC failed

Created on 16 Mar 2018  路  7Comments  路  Source: lightningnetwork/lnd

Trying to use api same as code here http://api.lightning.community/#getinfo
Calling methods give me error: "Connect Failed"
My lnd.conf is:

[Application Options]
debuglevel=trace
debughtlc=true
maxpendingchannels=10
noencryptwallet=1
externalip=myip
alias=lnd.fun
rpclisten=localhost:10009

[Bitcoin]
bitcoin.active=1
bitcoin.testnet=1
bitcoin.node=bitcoind

[Bitcoind]
bitcoind.rpchost=localhost
bitcoind.rpcuser=myuser
bitcoind.rpcpass=mypass
bitcoind.zmqpath=tcp://127.0.0.1:29000

gRPC

Most helpful comment

This sounds like the issue I had and a number of other people due to the updated cipher suite in this change https://github.com/lightningnetwork/lnd/pull/776. If you are using the javascript or python grpc client library you need to update the GRPC_SSL_CIPHER_SUITES environment variable to be:

'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384'

In javascript

// top of file
process.env.GRPC_SSL_CIPHER_SUITES = 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384'

// do awesome grpc stuff with lnd

In python

import os
os.environ["GRPC_SSL_CIPHER_SUITES"] = 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384'

# do awesome grpc stuff with lnd

I hope this fixes your issue. I will try make a PR to update the docs around this since it took me a while to figure this out.

All 7 comments

Where are you accessing GRPC from? localhost? outside the lnd node?

If the latter you need to make sure that the tls key and cert used by lnd contains the domain you're using.

@dabura667 , i using gRPC from localhost. lnd , bitcoind and application that using gRPC , are in same server.

Are you using javascript? Did you add the macaroon to the meta object?

This sounds like the issue I had and a number of other people due to the updated cipher suite in this change https://github.com/lightningnetwork/lnd/pull/776. If you are using the javascript or python grpc client library you need to update the GRPC_SSL_CIPHER_SUITES environment variable to be:

'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384'

In javascript

// top of file
process.env.GRPC_SSL_CIPHER_SUITES = 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384'

// do awesome grpc stuff with lnd

In python

import os
os.environ["GRPC_SSL_CIPHER_SUITES"] = 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384'

# do awesome grpc stuff with lnd

I hope this fixes your issue. I will try make a PR to update the docs around this since it took me a while to figure this out.

@dabura667 , I using nodejs , also i added macaroon.
@adrienemery , I updated process.env.GRPC_SSL_CIPHER_SUITES but problem not fixed

The answer may be in GRPC_SSL_CIPHER_SUITES. If you're using an old version of Python or something like that, then the default set of cipher suites may not intersect with what we offer.

Check that your lnd node is actually running, as nothing significant has changed w.r.t the RPC interface.

@adrienemery , thank you. your solution worked for me.
Also , 'HIGH+ECDSA' is valid for it.
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA';

Was this page helpful?
0 / 5 - 0 ratings

Related issues

whizz picture whizz  路  3Comments

alec-djinn picture alec-djinn  路  3Comments

pm47 picture pm47  路  3Comments

hxsquid picture hxsquid  路  3Comments

anaoum picture anaoum  路  4Comments