liquidator

command module
v0.0.0-...-76ca6e9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 39 Imported by: 0

README

NodeGuard Liquidator

Go Report Card

Description

A CLI tool to monitor and automate the liquidity of your LND channels

Usage:
  liquidator [flags]

Flags:
      --backoffCoefficient float       Coefficient to apply to the backoff (default 0.95)
      --backoffLimit float             Limit coefficient of the backoff (default 0.1)
  -h, --help                           help for liquidator
      --limitFees float                Limit fees for swaps e.g. 0.01 = 1% (default 0.007)
      --lndconnecturis string          CSV of lndconnect strings to connect to lnd(s)
      --logFormat string               Log format from: {text, json} (default "text")
      --logLevel string                Log level from values: {trace, debug, info, warn, error, fatal, panic} (default "info")
      --loopdconnecturis string        CSV of loopdconnect strings to connect to loopd(s)
      --nodeguardHost string           Hostname:port to connect to nodeguard
      --pollingInterval string         Interval to poll data (default "15s")
      --retriesBeforeBackoff int       Number of retries before applying backoff to the swap (default 3)
      --swapPublicationOffset string   Swap publication deadline offset (Maximum time for the swap provider to publish the swap) (default "60m")
      --sweepConfTarget string         Target number of confirmations for swaps, this uses bitcoin core broken estimator, procced with caution (default "400")

Requirements

This project uses just with the following recipes

Available recipes:
    build
    build-loopserver arg=''
    compile-lnrpc-proto
    compile-loop-proto
    compile-nodeguard-proto
    compile-provider-mocks
    cover-test
    fmt
    init-submodules
    install-loopd-loop
    loop *args=''
    loopin sats='1000000'
    loopout chanid sats='500000'
    mine
    run *args=''
    start-all
    start-loopd-carol
    start-loopserver
    test
    unzip-loopd-datadir

Environment Variables / Flags

All the flags can be set as environment variables, with the following format, except stated, they are all mandatory:

  • LNDCONNECTURIS : CSV of lndconnect strings to connect to lnd(s)\
  • LIMITFEES (optional) : Limit to total Swap Fees (default 0.007 -> 0.7% Swap size)
  • LOOPDCONNECTURIS : CSV of loopdconnect strings to connect to loopd(s)
  • POLLINGINTERVAL (optional) : Interval to poll data(default 15s)
  • LOGLEVEL (optional) : Log level (default info) from: {trace, debug, info, warn, error, fatal, panic}
  • LOGFORMAT (optional) : Log format (default json) from: {json, text}
  • SWAPPUBLICATIONOFFSET (optional) : Swap publication deadline offset (Maximum time for the swap provider to publish the swap) (default 30m)
  • RETRIESBEFOREBACKOFF (optional) : Number of retries before applying backoff to the swap (default: 3)
  • BACKOFFCOEFFICIENT (optional) : Coefficient to apply to the backoff (default: 0.95)
  • BACKOFFLIMIT (optional) : Limit coefficient of the backoff (default: 0.1)

Build & test

Build

just build

Testing

just test

Dev environment

  1. Launch a local regtest with polar from regtest.polar.zip
  2. Lauch with VS Code pre-defined configuration

Setup loop/loopd/loopserver regtest environment

  1. Make sure your regtest.polar.zip network in polar is running
  2. Unzip loopd datadir
just unzip-loopd-datadir
  1. Get git submodules
just init-submodules
  1. Compile and install loopd/loop binaries (Make sure your golang install bin dir is reachable from your PATH)
just install-loopd-loop
  1. Using just, run the following command:
just start-all
  1. This comand should have build a loopserver docker image, and started a loopserver container along with loopd as a native binary.

Loop just recipes

There are a few recipes using just -l to interact with loopd for loop in, loop out and calling loop CLI with args (just loop <args>).

Metrics

The following metrics are exposed in the /metrics endpoint on port 9000 (e.g. localhost:9000/metrics)):

  • liquidator_channel_balance: Channel balance ratio in 0 to 1 range, 0 means all the balance is on the local side of the channel, 1 means all the balance is on the remote side of the channel

Example:

liquidator_channel_balance{active="false",chan_id="118747255865345",local_node_alias="alice",local_node_pubkey="03b48034270e522e4033afdbe43383d66d426638927b940d09a8a7a0de4d96e807",remote_node_alias="",remote_node_pubkey="02f97d034c6c8f5ad95b1fe6abfe68ab154e85b1f5bb909815baeb5c8a46cdf622",initiator="false"} 0.99

liquidator_channel_balance{active="false",chan_id="125344325632000",local_node_alias="alice",local_node_pubkey="03b48034270e522e4033afdbe43383d66d426638927b940d09a8a7a0de4d96e807",remote_node_alias="",remote_node_pubkey="02f97d034c6c8f5ad95b1fe6abfe68ab154e85b1f5bb909815baeb5c8a46cdf622",initiator="false"} 0

liquidator_channel_balance{active="false",chan_id="131941395398656",local_node_alias="carol",local_node_pubkey="03485d8dcdd149c87553eeb80586eb2bece874d412e9f117304446ce189955d375",remote_node_alias="",remote_node_pubkey="02f97d034c6c8f5ad95b1fe6abfe68ab154e85b1f5bb909815baeb5c8a46cdf622",initiator="false"} 0

Other go-based metrics of the application are exposed for performance monitoring.

Documentation

Overview

Copyright © 2023 Clovr Labs

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Package main is a generated GoMock package.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis
Package nodeguard is a generated GoMock package.
Package nodeguard is a generated GoMock package.
Package provider is a generated GoMock package.
Package provider is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL