Connecting to a lightning node remotely¶
- 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
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 | ; | https://rest_host:8080/ | ; | 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 | ; | server=https://charge_host:8080/ | ; | api-token=myapitoken... | ||
| C-lightning REST | rest_host | ? | hex_macaroon |
| Eclair | prefix | d | server | d | auth | d | tls |
|---|---|---|---|---|---|---|---|
| BTCPay | type=eclair | ; | server=https://eclair_host:8080/ | ; | 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
https://github.com/LN-Zap/lndconnect/blob/master/lnd_connect_uri.md
- 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¶
https://github.com/alexbosworth/balanceofsatoshis#saved-nodes
- stored in
- 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
- certthumbprint:
- optional:
C-lightning¶
Spark Wallet¶
https://github.com/shesek/spark-wallet
Sparko¶
https://github.com/fiatjaf/sparko
Currently only works with a CA signed certificate.
See: https://github.com/shesek/spark-wallet/blob/master/doc/tls.md#add-as-trusted-certificate-to-android
- Simply:
the accessKey has macaroon-like permissions
C-lightning REST (with Zeus)¶
https://github.com/Ride-The-Lightning/c-lightning-REST/
- No standard yet, but needs:
- generate the
hex_macaroon:
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:
Eclair¶
BTCPayServer¶
- Eclair via HTTPS:
Notes¶
- common dependencies
- generate a QRcode in the terminal
(pressCTRL+-to reduce the size)
- base64_macaroon
- hex_macaroon:
- base64_cert
- certthumbprint:
- inspect a
tls.cert
- display a Tor Hidden Service
more at: https://openoms.github.io/bitcoin-tutorials/tor_hidden_service_example.html