⚡
Lightning Node Management
🇺🇸 English
🇺🇸 English
  • Contents
  • Lightning basics
  • Create inbound liquidity
  • Create outbound liquidity
  • Comparison table of software implementations
  • Comparison table of lightning channel markets
  • Node Types
    • Merchant
    • Spending
    • Routing
  • Advanced Tools
    • lnd.conf example
    • Advanced and automated fee settings
    • Set up an LND watchtower and connect a client
    • Methods to create a balanced channel with a trusted peer
    • Pool usage notes
    • Bos Score
  • Technicals
    • Connecting to a lightning node remotely
    • High onchain fee environment
    • Compact the LND database (channel.db)
    • Manage the LND onchain funds in Electrum Wallet
  • Recovery
    • Resources for LND
    • Resources for Core Lightning
  • Privacy
    • Resources on Lightning privacy
    • VPN tunnels
  • Hardware deployment
    • Hardware recommendations
    • RaspiBolt
    • RaspiBlitz
      • charge-lnd
      • Balance of Satoshis Telegram Bot
      • LND updates
      • Bitcoin Core updates
      • VPN and firewall setup
    • TrueNAS (FreeBSD) node
      • aliases
      • Balance of Satoshis
      • Lightning Terminal
      • Circuitbreaker
      • LNtop
      • LND notes
      • stream-lnd-htlcs
      • Suez
      • Tailscale
      • Connect Zeus
  • Donate
    • Donations
Powered by GitBook
On this page
  • Remote connection formats summary table
  • LND
  • RPC
  • LNDconnect
  • Balance of Satoshis
  • BTCPayserver
  • C-lightning
  • Spark Wallet
  • Sparko
  • C-lightning REST (with Zeus)
  • BTCPayserver
  • Eclair
  • BTCPayServer
  • Notes

Was this helpful?

Edit on GitHub
  1. Technicals

Connecting to a lightning node remotely

PreviousBos ScoreNextHigh onchain fee environment

Last updated 1 year ago

Was this helpful?

Remote connection formats summary table

LND
prefix
d
server
d
auth
d
tls
d

lndconnect

lndconnect://

grpc_host:10009

?

macaroon=base64_macaroon

&

cert=base64_cert

BoS

{

"socket": "grpc_host:10009"

,

"macaroon": "base64_macaroon"

,

"cert": "base64_cert"

}

BTCPay

type=lnd-rest

;

;

macaroon=hex_macaroon

;

certthumbprint=hex_cert

C-lightning
prefix
d
server
d
auth
d
tls

Spark Wallet / Sparko

spark_rpc_host

?

access-key=accessKey

BTCPay unix socket

type=clightning

;

server=unix://home/user/.lightning/lightning-rpc

BTCPay TCP

type=clightning

;

server=tcp://tcp_host:27743/

BTCPay Charge

type=clightning

;

;

api-token=myapitoken...

C-lightning REST

rest_host

?

hex_macaroon

Eclair
prefix
d
server
d
auth
d
tls

BTCPay

type=eclair

;

;

password=eclairpassword...

LND

RPC

  • lncli

    lncli --rpcserver=IP_ADDRESS:GRPC_PORT --tlscertpath=./../tls.cert --macaroonpath=./../admin.macaroon
poetry run ./suez --client-args=--rpcserver=IP_ADDRESS:GRPC_PORT --client-args=--tlscertpath=./../tls.cert --client-args=--macaroonpath=./../admin.macaroon

LNDconnect

  • Specification

lndconnect://<host>:<port>?[cert=<base64url_DER_certificate>&]macaroon=<base64url_macaroon>
  • implementation

# generate data parts
macaroon=$(sudo base64 /mnt/hdd/app-data/lnd/data/chain/${network}/${chain}net/admin.macaroon | tr -d '=' | tr '/+' '_-' | tr -d '\n')
cert=$(sudo grep -v 'CERTIFICATE' /mnt/hdd/lnd/tls.cert | tr -d '=' | tr '/+' '_-' | tr -d '\n')

# generate URI parameters
macaroonParameter="?macaroon=${macaroon}"
certParameter="&cert=${cert}"

lndconnect="lndconnect://${host}:${port}${macaroonParameter}${certParameter}"

Balance of Satoshis

  • stored in

    ~/.bos/YOUR_NODE_NAME/credentials.json
  • with base64 values

{
"cert": "base64 tls.cert value",
"macaroon": "base64 .macaroon value",
"socket": "host:port"
}

# For `cert` 
base64 ~/.lnd/tls.cert | tr -d '\n'
# For `macaroon`
base64 ~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon | tr -d '\n'
  • with path

    {
    "cert_path": "/path/lnd/tls.cert",
    "macaroon_path": "/path/lnd/data/chain/bitcoin/mainnet/admin.macaroon",
    "socket": "LND_IP:10009"
    }

BTCPayserver

  • LND via the REST proxy:

    type=lnd-rest;server=https://mylnd:8080/;macaroon=abef263adfe...
    type=lnd-rest;server=https://mylnd:8080/;macaroon=abef263adfe...;certthumbprint=abef263adfe...
  • macaroon

    xxd -plain /root/.lnd/data/chain/bitcoin/mainnet/admin.macaroon | tr -d '\n'
  • certthumbprint:

    openssl x509 -noout -fingerprint -sha256 -in /root/.lnd/tls.cert | sed -e 's/.*=//;s/://g'
  • optional:

    allowinsecure=true

C-lightning

Spark Wallet

Sparko

  • Simply:

    URL?access-key=accessKey

    the accessKey has macaroon-like permissions

C-lightning REST (with Zeus)

  • No standard yet, but needs:

    URL?hex_macaroon
  • generate the hex_macaroon:

    xxd -plain /home/bitcoin/c-lightning-REST/certs/access.macaroon | tr -d '\n'

BTCPayserver

  • c-lightning via TCP or unix domain socket connection:

    type=clightning;server=unix://root/.lightning/lightning-rpc
    type=clightning;server=tcp://1.1.1.1:27743/
  • Lightning Charge via HTTPS:

    type=charge;server=https://charge:8080/;api-token=myapitoken...

Eclair

BTCPayServer

  • Eclair via HTTPS:

    type=eclair;server=https://eclair:8080/;password=eclairpassword...

Notes

  • common dependencies

    sudo apt install qrencode base64 xxd
  • generate a QRcode in the terminal (press CTRL + - to reduce the size)

    string="desired content or $(command output)"
    qrencode -t ANSIUTF8 "$string"
  • base64_macaroon

    base64 ~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon | tr -d '\n'
  • hex_macaroon:

    xxd -plain /home/bitcoin/c-lightning-REST/certs/access.macaroon | tr -d '\n'
  • base64_cert

    base64 ~/.lnd/tls.cert | tr -d '\n'
  • certthumbprint:

    openssl x509 -noout -fingerprint -sha256 -in /root/.lnd/tls.cert | sed -e 's/.*=//;s/://g'
  • inspect a tls.cert

    openssl x509 -in /mnt/hdd/lnd/tls.cert -noout -text
  • sudo cat /var/lib/tor/SERVICE_NAME/hostname
    # or on a RaspiBlitz
    sudo cat /mnt/hdd/tor/SERVICE_NAME/hostname

server=

server=

Suez

Currently only works with a CA signed certificate. See:

display a Tor Hidden Service more at:

Remote connection formats summary table
LND
RPC
LNDconnect
Balance of Satoshis
BTCPayserver
C-lightning
Spark Wallet
Sparko
C-lightning REST (with Zeus)
BTCPayserver
Eclair
BTCPayServer
Notes
https://github.com/prusnak/suez
https://github.com/LN-Zap/lndconnect/blob/master/lnd_connect_uri.md
https://github.com/raspiblitz/raspiblitz/blob/a22589c86109d56ecc1e1aca7abb214c7e9189c7/home.admin/config.scripts/bonus.lndconnect.sh#L194
https://github.com/alexbosworth/balanceofsatoshis#saved-nodes
https://github.com/shesek/spark-wallet
https://github.com/fiatjaf/sparko
https://github.com/shesek/spark-wallet/blob/master/doc/tls.md#add-as-trusted-certificate-to-android
https://github.com/Ride-The-Lightning/c-lightning-REST/
https://openoms.github.io/bitcoin-tutorials/tor_hidden_service_example.html
https://rest_host:8080/
https://charge_host:8080/
https://eclair_host:8080/