Skip to content

Instantly share code, notes, and snippets.

@mcgingras
Last active March 27, 2018 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcgingras/aff2bc93547ae50d793fd291aef56447 to your computer and use it in GitHub Desktop.
Save mcgingras/aff2bc93547ae50d793fd291aef56447 to your computer and use it in GitHub Desktop.
LN error
'use strict';
const grpc = require('grpc');
const fs = require("fs");
// Lnd cert is at ~/.lnd/tls.cert on Linux and
// ~/Library/Application Support/Lnd/tls.cert on Mac
const lndCert = fs.readFileSync('/Users/mcgingras/Library/Application Support/LND/tls.cert');
const adminMacaroon = fs.readFileSync('/Users/mcgingras/Library/Application Support/LND/admin.macaroon');
const meta = new grpc.Metadata();
meta.add('macaroon', adminMacaroon.toString('hex'));
// We order the suites by priority, based on the recommendations provided by SSL Labs here:
// https://github.com/ssllabs/research/wiki/SSL-and-TLS-Deployment-Best-Practices#23-use-secure-cipher-suites
process.env.GRPC_SSL_CIPHER_SUITES = process.env.GRPC_SSL_CIPHER_SUITES || [
'ECDHE-ECDSA-AES128-GCM-SHA256',
'ECDHE-ECDSA-AES256-GCM-SHA384',
'ECDHE-ECDSA-AES128-CBC-SHA256',
'ECDHE-ECDSA-CHACHA20-POLY1305'
].join(':')
const credentials = grpc.credentials.createSsl(lndCert);
const rpc = grpc.load("./config/rpc.proto");
const lightning = new rpc.lnrpc.Lightning('localhost:10001', credentials);
const walletUnlocker = new rpc.lnrpc.WalletUnlocker('localhost:10001', credentials);
// this one works fine
var _call = lightning.walletBalance({}, meta, function(err, response) {
if (err) console.log(err);
if (response) console.log(response);
});
// this one returns an error
var _call = walletUnlocker.initWallet({}, meta, function(err, response) {
if (err) console.log(err);
if (response) console.log(response);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment