LNLink Setup

Follow this guide to get LNLink working with your node in no time!

Configuring your c-lightning node

You'll need to install the commando plugin on your c-lightning node for LNLink to work. Please see the installation instructions over there to get started.

Installing commando with nix

commando is packaged in nix-bitcoin. Follow these steps to build:

  1. Install nix if you don't have it
  2. git clone https://github.com/fort-nix/nix-bitcoin
  3. cd nix-bitcoin
  4. nix-build -A clightning-plugins.commando
  5. readlink ./result

readlink should spit out the directory where commando.py is located. Pass this as an argument to --plugin on c-lightning startup to enable the commando plugin. eg:

./lightningd/lightningd --plugin=/nix/store/aghfgkk...-clightning-plugin-commando-b88c927/commando.py

Generating an LNLink QR Code

lnlink is a QR code format that enables direct connection and authentication to your lightning node over the lightning network.

THIS QRCODE CONTAINS SENSITIVE INFORMATION THAT GIVES ANYONE ACCESS TO YOUR LIGHTNING NODE. DO NOT SHOW IT TO ANYONE.

You can generate an LNLink from your commando-enabled c-lightning node with this script (call it lnlink, chmod +x lnlink). requires jq:

	#!/usr/bin/env bash
	nodehost=$(lightning-cli getinfo | jq -r '. as $r | .address[0] | "\($r.id)@\(.address):\(.port)"')
	token=$(lightning-cli commando-rune "[email protected]" | jq -r '.rune | @uri')
	echo "lnlink:$nodehost?token=$token"
	

You can create a QR code from this LNLink in your terminal with qrcode-terminal

	$ npm -g install qrcode-terminal
	$ qrcode-terminal $(./lnlink)

	Create an lnlink that expires in a month (see token restrictions)

	$ qrcode-terminal $(./lnlink "restrictions=time<$(date +%s -d 'now + 1 month')")
	

LNLink QR Format

An lnlink looks like this:

An lnlink is a URI with the following elements

This is enough information to connect directly to a lightning node running a commando-compatible custom message handler