lnd: authentication handshake failed: x509: cannot validate certificate for 127.0.0.1 because it doesn\'t contain any IP SANs"
I just learned about lightning network.
i start by this cmd
lnd --rpclisten=localhost:10001 --listen=localhost:10011 --restlisten=localhost:8001 --datadir=data --logdir=log --debuglevel=info --bitcoin.simnet --bitcoin.active --bitcoin.node=btcd --btcd.rpcuser=kek --btcd.rpcpass=kek
then
lncli --rpcserver=localhost:10001 --macaroonpath=data/chain/bitcoin/simnet/admin.macaroon create
then
lncli --rpcserver=localhost:10001 --macaroonpath=data/chain/bitcoin/simnet/admin.macaroon getinfo
It works very well with gRPC
But when i try to connect using REST and node it doesn’t work
var fs = require('fs');
var request = require('request');
var macaroon = fs.readFileSync('./data/chain/bitcoin/simnet/admin.macaroon').toString('hex');
var options = {
url: 'https://localhost:8001/v1/getinfo',
// Work-around for self-signed certificates.
rejectUnauthorized: false,
json: true,
headers: {
'Grpc-Metadata-macaroon': macaroon
}
};
request.get(options, function(error, response, body) {
console.log(body);
});
it return
{ error:
'all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: authentication handshake failed: x509: cannot validate certificate for 127.0.0.1 because it doesn\'t contain any IP SANs"',
code: 14,
message:
'all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: authentication handshake failed: x509: cannot validate certificate for 127.0.0.1 because it doesn\'t contain any IP SANs"' }
what should i do to connect using REST API . Thanks !!!
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (1 by maintainers)
We use a package called
grpc-gateway
that translates REST calls into gRPC calls. That’s why it saysgRPC proxy started
instead ofREST server listening
. It should work that way.What version of lnd are you using?
Can you please try the following:
tls.key
andtls.cert
file in your lnd data directory (most likely~/.lnd/
)--tlsextraip 127.0.0.1
as soon as i can Thank you again for everything you’ve done
You’re welcome!
Well, talking from experience, optimizing the code of a tutorial before you get it fully working is usually a bad idea. And now you know why we didn’t use the
proto-loader
before. If you want to update the docs/tutorial, PRs are welcome!Ok, I figured it out. The problem is the
@grpc/proto-loader
. It changes the field names fromsnake_case
tocamelCase
. So you either change all fields to camel case or tell it to not change the case:I would be interested to know if the above steps would help. So if you ever find time to try, I’d appreciate it.
You don’t need to provide all parameters, some are optional. The
node_pubkey
only needs to be provided in one format, either as byte array or hex encoded. Yes, it is theidentity_pubkey
of the other node.I think something like this should work for you (untested):