Skip to content

twshelton/lightning

 
 

Repository files navigation

Lightning

npm version

Methods for working with the Lightning Network

LND Authentication

To connect to an LND node, authentication details are required.

Export credentials via CLI: balanceofsatoshis: npm install -g balanceofsatoshis and export via bos credentials --cleartext

Or export them manually:

Run base64 on the tls.cert and admin.macaroon files to get the encoded authentication data to create the LND connection. You can find these files in the LND directory. (~/.lnd or ~/Library/Application Support/Lnd)

base64 ~/.lnd/tls.cert | tr -d '\n'
base64 ~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon | tr -d '\n'

You can then use these to interact with your LND node directly:

const {authenticatedLndGrpc} = require('lightning');

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

To access unauthenticated methods like the wallet unlocker, use unauthenticatedLndGrpc instead.

Methods

There are two libraries, ln-service and this library.

Methods exported by this library support typescript, but ln-service includes additional metthods.

About

Lightning client methods

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 92.5%
  • TypeScript 7.5%