Node Management

From lightningwiki.net
Jump to navigation Jump to search

Generic information

Actions

Opening channels (outgoing)

See Opening channels

Getting incoming liquidity

See Incoming liquidity

Balancing channels

There is a nice script to rebalance a lnd node, see rebalance-lnd

Changing fees

Change fees

Checking routing

Check routing on LND

Backups

Keys and backups

Commands

lnd

Debugging

Debugging LND

Aliases

alias lchannelcaps='lncli describegraph | jq '\''.nodes[].total_channel_capacities=0 | foreach .nodes[] as  ( . ; foreach .edges[] as  ( . ; if .node1_pub==.pub_key then (|.total_channel_capacities=.total_channel_capacity+(.capacity|tonumber)) else empty end ; .)  ; . )'\'''                                                                                                                                               
alias lnactive='lncli listchannels | jq '\''[ .channels | .[] | select(.active==true) ] | length'\'''
alias lnchaninfo='lncli listchannels | jq '\''[ .channels | .[] | { "remote_pubkey": .remote_pubkey, "capacity": .capacity|tonumber, "local_balance": .local_balance|tonumber, "remote_balance": .remote_balance|
tonumber, "distribution_pct": ( ( .local_balance|tonumber ) / ( (.remote_balance|tonumber ) + ( .local_balance|tonumber ) ) ), "total_satoshis_sent": .total_satoshis_sent|tonumber, "total_satoshis_received": .total_satoshis_received|tonumber } ]'\'''                                                                                                                                                                        
alias lndist='lncli listchannels | jq '\''[ .channels | .[] |  { "remote_pubkey": .remote_pubkey, "capacity": .capacity, "distribution_pct": ( ( .local_balance|tonumber ) / ( (.remote_balance|tonumber ) + ( .local_balance|tonumber ) ) ) } ]'\'''                                                                                                                                                                             
alias lnforcegraph='lncli describegraph | jq -c '\''{ "nodes": .nodes | map({ "id": .pub_key, "alias": .alias|match("[^\u0000]+")| .string, "group": 1, "color": .color, "addresses": .addresses }), "links": .edges | map({"source": .node1_pub, "target": .node2_pub, "capacity": .capacity|tonumber }) }'\'''                                                                                                                  
alias lninactive='lncli listchannels | jq '\''[ .channels | .[] | select(.active==false) ] | length'\'''
alias lnlimbo='lncli pendingchannels | jq '\''.total_limbo_balance|tonumber'\'''
alias lnnodeinfo='lncli listchannels | jq -r .channels[].remote_pubkey | while read p; do lncli getnodeinfo "$p"; done'
alias lnoffchain='lncli listchannels | jq '\''[ .channels | .[] | select(.num_updates|tonumber>0) ]'\'''
alias lnoffchainupdates='lncli listchannels | jq '\''.channels | map(.num_updates|tonumber) | add'\'''
alias lnpendingc='lncli pendingchannels | jq '\''.pending_close_channels|length'\'''
alias lnpendingf='lncli pendingchannels | jq '\''.pending_force_closing_channels|length'\'''
alias lnpendingo='lncli pendingchannels | jq '\''.pending_open_channels|length'\'''
alias lnreceivedbal='lncli listchannels | jq '\''.channels | map(.total_satoshis_received|tonumber) | add'\'''
alias lnrecv='lncli listchannels | jq '\''[ .channels | .[] | select(.total_satoshis_received|tonumber>0) ]'\'''
alias lnremotebal='lncli listchannels | jq '\''.channels | map(.remote_balance|tonumber) | add'\'''
alias lnsentbal='lncli listchannels | jq '\''.channels | map(.total_satoshis_sent|tonumber) | add'\'''
alias lntopchannels='lncli describegraph | jq '\''[ .edges | sort_by(.capacity|tonumber) | reverse | .[] | { "node1_pub": .node1_pub, "node2_pub": .node2_pub, "Capacity": .capacity|tonumber,  } ]'\'''
alias lntotalcap='lncli listchannels | jq '\''.channels | map(.capacity|tonumber) | add'\'''
alias lnunsettled='lncli listchannels | jq '\''[ .channels | .[] | select(.unsettled_balance|tonumber>0) ]'\'''
alias lnunsettledbal='lncli listchannels | jq '\''.channels | map(.unsettled_balance|tonumber) | add'\'''
alias lnunusedchannels='lncli listchannels | jq '\''[ .channels[] | select(.total_satoshis_sent=="0" and .total_satoshis_received=="0") ]| {"unused channels": map({"channel_point": .channel_point, "local_balance": .local_balance|tonumber, "num_updates": .num_updates|tonumber, "active": .active, "private": .private}) | sort_by(.local_balance) | reverse }'\'''                                                          
alias lrecv='lncli listchannels | jq '\''[ .channels | .[] | select(.total_satoshis_received|tonumber>0) ]'\'''

(by vegard)

Frontends

Web frontends