Categorygithub.com/aftermath2/acceptlnd
repositorypackage
2.0.0+incompatible
Repository: https://github.com/aftermath2/acceptlnd.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# README

AcceptLND

AcceptLND is a channel requests management tool based on policies for LND.

Usage

acceptlnd [-config CONFIG] [-debug] [-version]

Parameters:
  -config          Path to the configuration file (default: "acceptlnd.yml")
  -debug           Enable debug level logging
  -version         Print the current version

Installation

Download the binary from the Releases page, use docker or compile it yourself.

Docker
docker build -t acceptlnd .
# The configuration, certificate and macaroon must be mounted into the container.
# The paths specified in the configuration file can be absolute or relative to the mount path.
docker run --network=host -v <config_files_mount> acceptlnd <flags>
Build from source

Requires Go 1.18+ installed

git clone https://github.com/aftermath2/acceptlnd
cd acceptlnd
go build -o acceptlnd -ldflags="-s -w" .

Configuration

The configuration file can be passed as a flag (-config="<path>") when executing the binary, the default value is acceptlnd.yml.

Configuration schema:

KeyTypeRequiredDescription
rpc_addressstring🗸LND GRPC address (host:port)
certificate_pathstring🗸Path to LND's TLS certificate
macaroon_pathstring🗸Path to the macaroon file. See macaroon
policies[]PolicyXSet of policies to enforce

Macaroon

AcceptLND needs a macaroon to communicate with the LND instance to manage channel requests.

Although admin.macaroon can be used, it is recommended baking a fine-grained macaroon that gives AcceptLND access just to the RPC methods it uses. To bake it, execute:

lncli bakemacaroon uri:/lnrpc.Lightning/ChannelAcceptor uri:/lnrpc.Lightning/GetInfo uri:/lnrpc.Lightning/GetNodeInfo --save_to acceptlnd.macaroon

Once created, specify its path in the macaroon_path field of the configuration file, it can be relative or absolute.

Policy

Policies define a set of requirements that must be met for a request to be accepted. A configuration may have an unlimited number of policies, they are evaluated from top to bottom.

A policy would only be enforced if its conditions are satisfied, or if it has no conditions.

KeyTypeDescription
conditionsConditionsSet of conditions that must be met to enforce the policies
reject_allbooleanReject all channel requests
allow_list[]stringList of nodes public keys whose requests will be accepted
block_list[]stringList of nodes public keys whose requests will be rejected
accept_zero_conf_channelsbooleanWhether to accept zero confirmation channels
zero_conf_list[]stringList of nodes public keys whose zero conf requests will be accepted. Requires accept_zero_conf_channels to be true
reject_private_channelsbooleanWhether private channels should be rejected
max_channelsintMaximum number of channels. Compared against the sum of the node's active, pending and inactive channels
min_accept_depthintNumber of confirmations required before considering the channel open
requestRequestParameters related to the channel opening request
nodeNodeParameters related to the channel initiator

Here's a simple example:

policies:
  -
    conditions:
      is_private: true
    request:
      channel_capacity:
        min: 2_000_000

This policy only applies to private channels and will reject requests with a capacity lower than 2 million sats.

[!Note] The denomination used in all the numbers is satoshis.

More examples can be found at /examples.

Conditions

Conditions are used to evaluate policies conditionally. If they are specified, all of them must resolve to true or the policy is skipped.

They are defined in the configuration exactly the same way policies are, only a few fields change.

KeyTypeDescription
is[]stringList of nodes public keys to which policies should be applied
is_not[]stringList of nodes public keys to which policies should not be applied
is_privatebooleanMatch private channels
wants_zero_confbooleanMatch zero confirmation channels
requestRequestParameters related to the channel opening request
nodeNodeParameters related to the initiator node

Request

Parameters related to the channel opening request.

KeyTypeDescription
channel_capacityrangeRequested channel size
channel_reserverangeRequested channel reserve
push_amountrangePushed amount of sats
csv_delayrangeRequested CSV delay
max_accepted_htlcsrangeThe total number of incoming HTLC's that the initiator will accept
min_htlcrangeThe smallest HTLC in millisatoshis that the initiator will accept
max_value_in_flightrangeThe maximum amount of coins in millisatoshis that can be pending in the channel
dust_limitrangeThe dust limit of the initiator's commitment transaction
commitment_types[]intAccepted channel commitment types. See lnrpc.CommitmentTypes

Node

Parameters related to the node that is initiating the channel.

KeyTypeDescription
agerangePeer node age in blocks, based on the oldest announced channel
capacityrangePeer node capacity
hybridbooleanWhether the peer will be required to be hybrid
feature_flags[]intFeature flags the peer node must know. Check out lnrpc.FeatureBit
ChannelsChannelsInitiator node channels

Channels

Parameters related to the initiator node's channels.

KeyTypeDescription
numberrangePeer's number of channels
capacitystat_rangeChannels size
zero_base_feesbooleanWhether the peer's channels must all have zero base fees
block_heightstat_rangeChannels block height
time_lock_deltastat_rangeChannels time lock delta
min_htlcstat_rangeChannels minimum HTLC
max_htlcstat_rangeChannels maximum HTLC
last_update_diffstat_rangeChannels last update difference to the time of the request (seconds)
togetherrangeNumber of channels that the host node and initiator node have together
fee_ratesstat_rangeChannels fee rates
base_feesstat_rangeChannels base fees
disabledstat_rangeNumber of disabled channels. The value type is float and should be between 0 and 1
inbound_fee_ratesstat_rangeChannels inbound fee rates
inbound_base_feesstat_rangeChannels inbound base fees
peersPeersInitiator node channels parameters on the peers' side

[!Note] Inbound fees were added in LND v0.18.0-beta and they represent fees for the movement of incoming funds. A positive value would discourage peers from routing to the channel and a negative value would incentivize them.

Peers

Initiator node channels parameters on the peers' side.

KeyTypeDescription
fee_ratesstat_rangeChannels fee rates
base_feesstat_rangeChannels base fees
disabledstat_rangeNumber of disabled channels. The value type is float and should be between 0 and 1
inbound_fee_ratesstat_rangeChannels inbound fee rates
inbound_base_feesstat_rangeChannels inbound base fees

Range

A range may have a minimum value, a maximum value or both defined. All values are in satoshis.

Min and Max are inclusive, they include the value assigned: [Min, Max].

Example
request:
  channel_capacity:
    min: 2_000_000
    max: 50_000_000

Statistic range (stat_range)

Statistic ranges work just like ranges but they compare values against the node's data set after being aggregated using an operation.

Example
node:
  channels:
    outgoing_fee_rates:
      operation: median
      min: 0
      max: 100

Operations

  • mean (default): average of a list of numbers.
  • median: middle value in a list ordered from smallest to largest.
  • mode: most frequently occurring value on a list.
  • range: difference between the biggest and the smallest number.