LNLink Setup

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

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 "$@" | 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