Giter Site home page Giter Site logo

alexbosworth / balanceofsatoshis Goto Github PK

View Code? Open in Web Editor NEW
553.0 21.0 78.0 7.78 MB

Tool for working with the balance of your satoshis on LND

License: MIT License

JavaScript 99.97% Dockerfile 0.03%
lnd lightning-network rebalance routing routing-node inbound-liquidity

balanceofsatoshis's Introduction

Balance of Satoshis

Commands for working with LND balances.

npm version docker pulls

Supported LND versions:

  • v0.18.0-beta to v0.18.2-beta
  • v0.17.0-beta to v0.17.5-beta
  • v0.16.0-beta to v0.16.4-beta
  • v0.15.2-beta to v0.15.5-beta

Install

npm install -g balanceofsatoshis

Or use a platform-specific guide:

If you want to try out any command without npm install, you can also do npx balanceofsatoshis to run a command directly.

Get the version to verify that it's installed:

bos --version
# current installed version

Re-install if you want to update to a new version.

Usage

To see a list of available options and flags run:

bos help

# Or get individual help with a command
bos help commandName

If you want autocomplete on commands and options you can do:

bos install-completion

Or to remove autocomplete

bos uninstall-completion

Community

Use bos trade-secret and buy the secret 626f73ff0001010425002302210288be11d147e1525f7f234f304b094d6627d2c70f3313d7ba3696887b261c4447 to gain access to the private Telegram group.

Or if you can't use bos yet you can ask about it on the public group

Example Commands

# See an accounting formatted list of various types of transactions
bos accounting "category"

# See total balance, including pending funds, excluding future commit fees
bos balance

# Get the number of days the node cert remains valid
bos cert-validity-days

# Receive on-chain funds via a regular address
bos chain-deposit

# See the current fee estimates confirmation targets
bos chainfees

# Show chain fees paid
bos chart-chain-fees

# Show routing fees earned
bos chart-fees-earned

# Show routing fees paid
bos chart-fees-paid

# Show a chart of payments received
bos chart-payments-received

# Remove old failed payment data for probes and other failed payments
bos clean-failed-payments

# See details on how closed channels resolved on-chain
bos closed

# Export credentials
bos credentials

# View outbound fee rates and update outbound fee rates to peers
bos fees

# Query the node to find something like a payment, channel or node
bos find "query"

# Output a summarized version of peers forwarded towards
bos forwards

# Create a signed raw transaction for an on-chain transfer
bos fund "address" "amount"

# See help about a command
bos help "command"

# Run gateway service for https://ln-operator.github.io/ UI
bos gateway

# Look up the channels and fee rates of a node by its public key
bos graph "pubkey"

# Output the sum total of remote channel liquidity
bos inbound-liquidity

# Enforce rules on inbound channels
bos inbound-channel-rules

# Increase inbound liquidity to the node
bos increase-inbound-liquidity

# Increase the outbound liquidity of the node
bos increase-outbound-liquidity

# View and adjust list of saved nodes
bos nodes

# Open channels to public keys in a batch transaction
bos open "public_keys..."

# Open a balanced channel with a peer
bos open-balanced-channel

# Outputs the sum total of local channel liquidity
bos outbound-liquidity

# Pay a payment request (invoice), probing first
bos pay "payment_request"

# Show channel-connected peers
bos peers

# Output the price of BTC
bos price

# Test if funds can be sent to a destination
bos probe "payment_request/public_key"

# Rebalance funds between peers
bos rebalance

# Remove all channels with a peer
bos remove-peer

# Get a general report of the node activity
bos report

# Send funds using keysend and an optional message to a node
bos send

# Connect up to a Telegram bot
bos telegram

# Unlock the wallet if it is locked
bos unlock "path_to_password_file"

# Show unspent coin outputs
bos utxos

Community HowTos:

Want to stack some sats? Write your own LN paywalled guide!

Nodes

By default bos expects tls.cert in the root of the default lnd directory and admin.macaroon in <default_lnd_dir>/data/chain/bitcoin/<network>.

Default LND directories:

  • macOS: ~/Library/Application Support/Lnd/
  • Linux: ~/.lnd/

It will check first for a mainnet macaroon, then a testnet macaroon.

The LND directory can be overriden with an environment variable:

BOS_DEFAULT_LND_PATH=/path/to/lnd/data/dir

Saved Nodes

If you have another node and it is already using balanceofsatoshis, you can add it as a "saved node" using bos nodes --add.

Otherwise you can copy the credentials into a saved nodes directory:

To use bos with arbitrary external nodes (or nodes with custom configuration), two things need to be done:

  1. Create directory ~/.bos/, and add node credentials in a format of:

    ~/.bos/YOUR_NODE_NAME/credentials.json

Use any shorthand you'd like when choosing this profile node name

  1. Each file should have the following format:
{
  "cert": "base64 tls.cert value",
  "macaroon": "base64 .macaroon value",
  "socket": "host:port"
}

Note: cert and (admin) macaroon should have base64-encoded, and newline-stripped content of the files. To get the strings in appropriate format you can run, ex:

# For `cert`
base64 -w0 ~/.lnd/tls.cert

# For `macaroon`
base64 -w0 ~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon

Note_2: socket should contain host:port pointing to lnd's gRPC interface, localhost:10009 by convention.

You can also set cert_path and macaroon_path to the path of the relevant files instead.

The BOS directory path can be overriden with an environment variable:

BOS_DATA_PATH=/path/to/bos/data/dir

Umbrel Saved Node

Note: Umbrel is not FOSS software, use at your own risk.

If you are using Umbrel and you have already installed but you get an error like Name resolution failed for target dns:umbrel.local:10009 then try adding umbrel.local to your /etc/hosts file, like sudo nano /etc/hosts and add a line 127.0.0.1 umbrel.local

  1. Identify your Umbrel home dir, like /home/umbrel/umbrel
  2. Look in the .env file in that dir for the LND_IP to use as the socket to connect to

You can also use umbrel.local if that is in your Umbrel TLS cert but you will have to make sure the hostname is known to the client.

{
  "cert_path": "/home/umbrel/umbrel/app-data/lightning/data/lnd/tls.cert",
  "macaroon_path": "/home/umbrel/umbrel/app-data/lightning/data/lnd/data/chain/bitcoin/mainnet/admin.macaroon",
  "socket": "LND_IP:10009"
}
  1. Now when you do a command, specify --node umbrel or whatever your dir is: bos --node umbrel balance

Using Saved Nodes

To run commands on nodes specified this way, you need to suffix commands with their name, ex:

bos balance --node=SAVED_NODE_NAME
bos forwards --node=SAVED_NODE_NAME

If a saved node is actually your default node, you can set an environment variable to avoid adding the --node prefix

export BOS_DEFAULT_SAVED_NODE=nodename

If that is set, it will use that node if no node is specified.

You can also add a JSON file to your .bos directory: config.json, add {"default_saved_node": "nodename"} to set the default via a file instead

Linux Fu

Some commands are designed to return outputs that can be piped or used in other CLI programs.

Open many channels

Make a textfile in the terminal with newline separated pubkeys and the capacity of the channels.

cat bos_channels.txt

       │ File: bos_channels.txt
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ 0337...1986 --amount=3000000
   2   │ 02a4...20de --amount=3000000
   3   │ 023c...0dec --amount=1000000
bos open $(cat bos_channels.txt)

Summarize Numbers

expr $(bos balance --node=savedNode1) + $(bos balance --node=savedNode2)
# outputs the combined balance of both nodes

Auto Adjust Fees

# Cron every 5 minutes adjust fees
*/5 * * * * /bin/timeout -s 2 30 /home/ubuntu/update-fees.sh

update-fees.sh:

#!/bin/bash
# Raise the outbound fees to a public key when inbound increases
/home/ubuntu/.npm-global/bin/bos fees --to PUBLIC_KEY --set-fee-rate="IF(INBOUND>10000000,1000,500)"

Auto Balance Liquidity Between Two Nodes

Keep a channel balanced between two of your own nodes

# Cron: every 30 minutes send funds to reach 50:50
*/30 * * * * /home/ubuntu/.npm-global/bin/bos send PUBKEY --max-fee 0 --message="rebalance" --amount="IF(OUTBOUND+1*m>(LIQUIDITY/2), OUTBOUND-(LIQUIDITY/2), 0)"

If you want to 50:50 rebalance with a peer node, you can use --out-target-inbound=capacity/2 with bos rebalance

Alerts and Reports with sendnotification

Some commands are made with the idea that they can trigger an alert or regular report by piping the output of a command into some reporting script like sendnotification which works with AWS SNS service to deliver notifications

Examples of shell scripts that could be executed by crontab:

Cert Expiration Alert

# cert-expiration-alert.sh

#!/bin/bash
/path/to/bos cert-validity-days --below 30 | \
/path/to/sendnotification SNS "sns-topic-id" "Warning: %s days left on TLS cert" \
--nonzero --subject="Cert expiration warning"

# sends email when the certification has less than 30 days left until invalid

Daily Node Report

# daily-report.sh

#!/bin/bash
/path/to/bos report --styled 2>&1 | \
/path/to/sendnotification SNS "sns-topic-id" "%s" --subject="Daily node update"

# sends email about what has happened on the node in the past day

Low Channel Balance Alert

# low-offchain-outbound-liquidity alert

#!/bin/bash
/path/to/bos balance --offchain --below 4000000 | \
/path/to/sendnotification SNS "sns-topic-id" "off-chain balance deficit: %s sats" \
--nonzero --subject="Low balance warning"

# sends email if the channel balance goes below a threshold

Low Inbound Liquidity Alert

# low-inbound-liquidity.sh

#!/bin/bash
/path/to/bos inbound-liquidity --below=1000000 2>&1 | \
/path/to/sendnotification SNS "sns-topic-id" \
"WARNING inbound-liquidity deficit: %s sats" --nonzero \
--subject="Low inbound liquidity warning: node1"

# sends email if the inbound liquidity drops below a 1,000,000 sats

Persist Long-Running Commands

If you are running a long-running command and want it to persist, you will need something like Docker or nohup or tmux to assist you in that and then kill the process and restart it when updating.

Nohup example:

nohup /home/bos/.npm-global/bin/bos telegram --connect CONNECT_CODE > /dev/null &

Docker example:

docker run -d --restart always -v $HOME/.bos:/home/node/.bos alexbosworth/balanceofsatoshis telegram --connect CONNECT_CODE

You can also create a shell-script.sh to run a command repeatedly, with a delay

while true;
do bos rebalance;
sleep 2000;
done

Docker

This presumes you have Docker installed.

Install the Docker image:

docker pull alexbosworth/balanceofsatoshis

Docker Load

You can also build the image yourself: npm run build-docker, this will make balanceofsatoshis.tar.gz that you can rsync or scp somewhere else and then do docker load < balanceofsatoshis.tar.gz.

Once the image is installed, you can "docker run" commands for all the commands:

# Make sure you have a home directory created to give Docker access to
mkdir $HOME/.bos

docker run -it --rm -v $HOME/.bos:/home/node/.bos alexbosworth/balanceofsatoshis --version
# Should output the version

This maps your home directory to the docker home directory to enable persistence of credentials.

If you want it to automatically detect your local node, also pass the LND home dir as an additional -v argument to docker run:

If you are on MacOS:

--network="host" -v $HOME/Library/Application\ Support/Lnd/:/home/node/.lnd:ro

Or on Linux:

--network="host" -v $HOME/.lnd:/home/node/.lnd:ro

On BTCPayServer:

Create the credential.json file as explained in the saved nodes section, and for socket put: "socket": "lnd_bitcoin:10009"

For Docker network use the Docker bridged network:

docker run -it --rm --network="generated_default" -v $HOME/.bos:/home/node/.bos alexbosworth/balanceofsatoshis balance --node SAVEDNODENAME

On Umbrel this would be:

# add Umbrel specific details:
## --network="host"
## --add-host=umbrel.local:192.168.1.23
## -v $HOME/umbrel/app-data/lightning/data/lnd:/home/node/.lnd:ro
docker run -it --rm --network=umbrel_main_network --add-host=localhost:10.21.21.9 -v $HOME/.bos:/home/node/.bos -v $HOME/umbrel/app-data/lightning/data/lnd:/home/node/.lnd:ro alexbosworth/balanceofsatoshis report

Note: For umbrel-os users, when running the above docker run command, ensure the "192.168.1.23" portion of the command is updated to reflect the IP of the lnd container. You can find the IP by looking for the LND_IP value inside the $HOME/umbrel/.env file.

Otherwise you can just pass the local node credentials as shown above using the saved nodes.

If you are running a long-running command like telegram, use -d --restart always instead of -it --rm to run in daemon mode and auto-restart.

Note: if you are used to using ctrl+c to terminate the process, that doesn't work on Docker. Instead, you can use ctrl+p and then ctrl+q to background the interactive mode, then do docker ps and docker rm to kill the instance.

Build Your Own

If you don't want to use the Dockerfile, you can build a docker file for yourself

FROM node:latest
RUN npm install balanceofsatoshis
ENTRYPOINT [ "/node_modules/balanceofsatoshis/bos" ]

Run Shell Script

If you don't want to type out "docker run", and don't have an alias for it, you can create a simple shell script to fill that part in:

#! /usr/bin/env bash
docker run -it --rm -v=$HOME/.bos:/root/.bos bos:latest ${@:1}

You can also define an alias for placing in ~/.profile or ~/.bash_profile:

alias bos="docker run -it --rm -v $HOME/.bos:/home/node/.bos alexbosworth/balanceofsatoshis"

Adjust this alias to however you run the full Docker command. Remember to execute the ~/.profile to install the alias into your current session: . ~/.profile

You can also create an alias to run a command in the background

alias bosd="docker run -d --rm -v $HOME/.bos:/home/node/.bos alexbosworth/balanceofsatoshis"

Formulas

Some commands take formula arguments. Formulas are expressions that allow you to perform functions and reference variables.

There is a dynamic playground here where you can play with expressions: https://formulajs.info/functions/

--avoid

In --avoid flag commands like rebalance, a formula can be applied directionally:

--avoid "fee_rate < 100/<PUBKEY>" to avoid channels forwarding to the public key that charge a fee rate under 100 PPM.

Available variables:

  • age: Age of the channel vs the current height
  • base_fee: Base fee to be charged to route
  • capacity: Capacity of the channel
  • fee_rate: PPM fee to be charged to route
  • height: Absolute height of the channel
  • opposite_fee_rate: PPM fee that is charged in the non-routing direction

amount

Formula amounts are supported in the following commands:

  • fund
  • inbound-channel-rules
  • open
  • probe
  • rebalance
  • send

When passing an amount you can pass a formula expression, and the following variables are defined:

  • k: 1,000
  • m: 1,000,000

Examples:

bos fund <address> "7*m"
// Fund address with value 7,000,000

bos probe <key> "100*k"
// Probe to key amount 100,000

bos send <key> "m/2"
// Push 500,000 to key

rebalance

Rebalance defines additional variables for --amount:

  • capacity: The total of inbound and outbound

And for --in-filter and --out-filter:

  • capacity: The total capacity with the peer
  • heights: The set of heights of the channels with the peer
  • inbound_fee_rate: The fee rate the peer is charging
  • inbound_liquidity: The inbound liquidity with the peer
  • outbound_liquidity: The outbound liquidity with the peer
  • pending_payments: The number of pending payments

Example:

// Rebalance with a target of 1,000,000
bos rebalance --amount "1*m"

send

Send defines additional variables:

  • eur: The value of 1 Euro as defined by rate provider
  • inbound: The inbound liquidity with the destination
  • liquidity: The total capacity with the destination
  • outbound: The inbound liquidity with the destination
  • usd: The value of 1 US Dollar as defined by rate provider

Example:

// Send node $1
bos send <key> --amount "1*usd"

transfer

Transfer variables:

  • out_inbound: The outbound liquidity with the outbound peer
  • out_liquidity: The total inbound+outbound with the outbound peer
  • out_outbound: The total outbound liquidity with the outbound peer

Example:

// Equalize inbound with a mutual peer
bos transfer node "in_inbound - (in_inbound + out_inbound)/2" --through peer

fees

Variables can be referenced for --set-fee-rate

  • fee_rate_of_<pubkey>: Reference other node's fee rate
  • inbound: Remote balance with peer
  • inbound_fee_rate: Incoming fee rate
  • outbound: Local balance with peer

You can also use functions:

  • bips(n): Set fee as parts per thousand
  • percent(0.00): Set fee as fractional percentage

Example:

// Set the fee rate to a tag to 1% of the value forwarded
bos fees --to tag --set-fee-rate "percent(1)"

inbound-channel-rules

Pass formulas for rules with --rule.

Formula variables:

  • capacities: sizes of the peer's public channels
  • capacity: size of the inbound channel
  • channel_ages: block ages of the peer's public channels
  • fee_rates: outbound fee rates for the peer
  • local_balance: gifted amount on the incoming channel
  • private: request is to open an unannounced channel
  • public_key: key of the incoming peer

Example:

// Reject channels that are smaller than 2,000,000 capacity
bos inbound-channel-rules --rule "capacity < 2*m"

// Set separate capacity limits depending on private status
bos inbound-channel rules --rule "if(private,capacity >= 9*m,capacity >= 5*m)"

balanceofsatoshis's People

Contributors

abellykens avatar alexbosworth avatar aphex3k avatar apotdevin avatar arshbot avatar ben-in-chicago avatar bota87 avatar dplusplus1024 avatar ghtsto avatar gordianln avatar impa10r avatar jorijn avatar jtymoszczuk avatar kaloudis avatar keblek avatar kroese avatar meedamian avatar miketwenty1 avatar morrisonbrett avatar niteshbalusu11 avatar nolith avatar pierrerochard avatar smartm0use avatar vajraofindra avatar wbobeirne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

balanceofsatoshis's Issues

[Feature Idea] Blacklist nodes from all routes

Some nodes may present persistent problems when routing or there may be some other reason to want to prevent routing through a specific node

There should be a global blacklist of nodes to avoid, potentially with timers attached relating to how long to avoid these nodes

Error running `bos accounting payments`

I am receiving the following error when attempting to run bos accounting payments against my node:

/home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/ln-accounting/node_modules/ln-service/bolt11/parse_payment_request.js:80
    throw new Error('ExpectedLnPrefix');
    ^

Error: ExpectedLnPrefix
    at module.exports (/home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/ln-accounting/node_modules/ln-service/bolt11/parse_payment_request.js:80:11)
    at /home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/ln-accounting/harmony/payments_as_records.js:40:38
    at Array.map (<anonymous>)
    at module.exports (/home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/ln-accounting/harmony/payments_as_records.js:37:31)
    at asyncAuto.payments (/home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/ln-accounting/report/get_accounting_report.js:238:26)
    at runTask (/home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:227:13)
    at /home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:167:31
    at processQueue (/home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:177:13)
    at taskComplete (/home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:193:9)
    at /home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:220:17
    at /home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/async/internal/onlyOnce.js:12:16
    at /home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/asyncjs-util/return_result.js:26:50
    at wrapper (/home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/async/internal/once.js:12:16)
    at processQueue (/home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:173:20)
    at taskComplete (/home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:193:9)
    at /home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:220:17

[Feature Idea] Cache data locally to avoid lookups latency

Instead of always going to the backing LND to find out information about fee rates, liquidity, etc, make a local copy of the node data that can be used as a first access cache

What are we able to copy?

  • On-chain transactions
  • Connected peers
  • Invoices
  • Forwards and HTLCs
  • Graph channels and nodes
  • Local channels
  • Block height
  • UTXOs
  • Watchtowers
  • Sweeps
  • Local public key and alias
  • Pending channels
  • Chain fee rates
  • Backups

With all of this data on the local side, queries could be a lot faster

[Feature Idea] Add the ability to target a ratio with a channel

Even though I generally don't believe in ratio-based rebalancing, situationally it is appropriate. For example if a peer wants you to maintain a ratio, you may have to do that.

In the rebalance command, instead of an amount to target, a ratio could be targeted which would essentially just calculate the amount for you

[Feature Idea] mark up chain transactions with related metadata

When making on-chain transactions via increase-inbound-liquidity or swap-in, etc, these transactions could be automatically updated with labels to capture information about what these transactions are related to

Other potential chain transactions could be updated like swap-in, open, increase-outbound-liquidity, remove-peer

`bos increase-inbound-liquidity --address <address>` error

$ bos --version
5.41.3

$ lnd --version
lnd version 0.10.99-beta commit=clock/v1.0.0-229-ge64e71d86dc1ac716c30a80f85a22e8fb544697f

/usr/lib/node_modules/balanceofsatoshis/node_modules/probing/graph/max_htlc_across_route.js:29
      return BigInt(policy.max_htlc_mtokens);
             ^
TypeError: Cannot convert undefined to a BigInt
    at BigInt (<anonymous>)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/probing/graph/max_htlc_across_route.js:29:14
    at Array.map (<anonymous>)
    at module.exports (/usr/lib/node_modules/balanceofsatoshis/node_modules/probing/graph/max_htlc_across_route.js:26:6)
    at asyncAuto.findMax (/usr/lib/node_modules/balanceofsatoshis/node_modules/probing/routing/find_max_payable.js:123:26)
    at runTask (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:227:13)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:167:31
    at processQueue (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:177:13)
    at taskComplete (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:193:9)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:220:17
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/internal/onlyOnce.js:12:16
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/asyncjs-util/return_result.js:26:50
    at wrapper (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/internal/once.js:12:16)
    at processQueue (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:173:20)
    at taskComplete (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:193:9)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:220:17

Will attempt --max-paths 1 workaround.

[Feature Idea] Forwarding monitoring

It would be nice to know if there are forwards happening that are being rejected, and why they are being rejected

This was already added as a feature previously but removed due to low signal and the removal of the database

Requires

  • Database
  • Design

[Feature Idea] Web GUI

It would be nice to have a browser tab dedicated to a node or nodes that would allow for doing simple node maintenance jobs

The gateway command was designed to facilitate this usage, but has yet to be utilized

A great focus for this would be a system that would allow for keeping tabs on channel balance shifts that require rebalance actions, and then facilitating those rebalance actions

[Feature Idea] Flat Pay

It would be nice to have a way to push a payment to a destination where the routing fee was inclusive, so pay N amount inclusive of routing fees

[Feature Idea]: Suggested Actions

If you are starting up or running a routing node you may not really know what to do or there may be some marginal actions that require review to automate

balanceofsatoshis could suggest to you commands to run based on an analysis of your node

probe failure on inactive node - TypeError: Cannot read property 'filter' of undefined

$ bos --version
5.39.2

$ lnd --version
lnd version 0.10.99-beta commit=clock/v1.0.0-71-g87880c0d56937f2380acee37910492b2fc7b910f

$ lncli getnodeinfo <inactive_node_pub_key>
[lncli] rpc error: code = Unknown desc = unable to find node

$ bos probe <inactive_node_pub_key>
/usr/lib/node_modules/balanceofsatoshis/network/probe_destination.js:164
return cbk(null, {features: features.filter(n => !!n.is_known)});
^

TypeError: Cannot read property 'filter' of undefined
at asyncAuto.getFeatures (/usr/lib/node_modules/balanceofsatoshis/network/probe_destination.js:164:44)
at runTask (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:227:13)
at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:167:31
at processQueue (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:177:13)
at taskComplete (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:193:9)
at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:220:17
at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/internal/onlyOnce.js:12:16
at /usr/lib/node_modules/balanceofsatoshis/network/probe_destination.js:139:18
at /usr/lib/node_modules/balanceofsatoshis/node_modules/asyncjs-util/return_result.js:22:40
at wrapper (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/internal/once.js:12:16)
at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:217:17
at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/internal/onlyOnce.js:12:16
at /usr/lib/node_modules/balanceofsatoshis/node_modules/ln-service/node_modules/lightning/lnd_methods/info/get_node.js:91:20
at Object.onReceiveStatus (/usr/lib/node_modules/balanceofsatoshis/node_modules/grpc/src/client_interceptors.js:1210:9)
at InterceptingListener._callNext (/usr/lib/node_modules/balanceofsatoshis/node_modules/grpc/src/client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (/usr/lib/node_modules/balanceofsatoshis/node_modules/grpc/src/client_interceptors.js:618:8)

Missing swap recovery argument leads to error.

$ bos --version
5.41.3

$ lnd --version
lnd version 0.10.99-beta commit=clock/v1.0.0-229-ge64e71d86dc1ac716c30a80f85a22e8fb544697f

$ node --version
v14.6.0

$ bos increase-inbound-liquidity --show-raw-recovery --recovery

(node:28266) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received type boolean (true)
    at Function.from (buffer.js:329:9)
    at asyncAuto.recovery (/usr/lib/node_modules/balanceofsatoshis/node_modules/goldengate/lightninglabs/decode_swap_recovery.js:44:35)
    at runTask (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:227:13)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:167:31
    at processQueue (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:177:13)
    at taskComplete (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:193:9)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:220:17
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/internal/onlyOnce.js:12:16
    at validate (/usr/lib/node_modules/balanceofsatoshis/node_modules/goldengate/lightninglabs/decode_swap_recovery.js:39:16)
    at runTask (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:229:13)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:167:31
    at processQueue (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:177:13)
    at auto (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:164:5)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/goldengate/lightninglabs/decode_swap_recovery.js:32:12
    at new Promise (<anonymous>)
    at module.exports (/usr/lib/node_modules/balanceofsatoshis/node_modules/goldengate/lightninglabs/decode_swap_recovery.js:31:10)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:28266) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:28266) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

error when using `bos` with `watch`

$ watch --version
watch from procps-ng 3.3.12

$ bos --version
5.43.2

$ watch bos forwards
/usr/lib/node_modules/balanceofsatoshis/network/get_forwards.js:238
        const isWideSize = size.get().width > wideSizeCols;
                                ^

TypeError: Cannot read property 'get' of undefined
    at asyncAuto.allForwards (/usr/lib/node_modules/balanceofsatoshis/network/get_forwards.js:238:33)
    at runTask (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:227:13)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:167:31
    at processQueue (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:177:13)
    at taskComplete (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:193:9)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:220:17
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/internal/onlyOnce.js:12:16
    at asyncAuto.forwards (/usr/lib/node_modules/balanceofsatoshis/network/get_forwards.js:229:16)
    at runTask (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:227:13)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:167:31
    at processQueue (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:177:13)
    at taskComplete (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:193:9)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:220:17
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/internal/onlyOnce.js:12:16
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/asyncjs-util/return_result.js:26:50      
    at wrapper (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/internal/once.js:12:16)

[Feature Idea] Allow creating liquidity targets for peers

Add a system so that you can define an inbound and outbound liquidity target for a peer

This would then inform rebalances which would go towards the target, peer displays which would illustrate distances from target values, etc

Check for errors in Telegram bot API

After bos telegram is entered, the user is prompted for the bot API. The input is hidden, so the user can't tell if it was entered incorrectly. After the API is submitted, there is no error checking done on the API to ensure that it is legitimate.

UnexpectedPendingChannelsErr error running 2 accounting commands

When I run the following 2 commands:

bos accounting chain-sends
bos accounting invoices

I receive the error:

err:
  - 503
  - UnexpectedPendingChannelsErr
  -
    err:
      message: 14 UNAVAILABLE: failed to connect to all addresses
      stack:
        - Error: 14 UNAVAILABLE: failed to connect to all addresses
        -     at Object.exports.createStatusError (/home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/grpc/src/common.js:91:15)
        -     at Object.onReceiveStatus (/home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/grpc/src/client_interceptors.js:1209:28)
        -     at InterceptingListener._callNext (/home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/grpc/src/client_interceptors.js:568:42)
        -     at InterceptingListener.onReceiveStatus (/home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/grpc/src/client_interceptors.js:618:8)
        -     at callback (/home/tom/.npm-global/lib/node_modules/balanceofsatoshis/node_modules/grpc/src/client_interceptors.js:847:24)

This could be related to this issue.

[Optimization] On max-liquidity tests, do not test obviously too-high amounts

Currently the max-liquidity finding process is inefficient in trying routes that it knows ahead of time are very unlikely or impossible to work. Because of the efficiency of binary search this isn't too much of a problem but it is not optimal.

So when finding the max amount that can be sent using binary search, always scope the binary search to the minimum of the desired amount and the known liquidity, policy restrictions.

Incorrect node requirements

Hi,

As per the readme: Requires an installation of Node v10.12.0+ and NPM.

However, this is incorrect:

▶ yarn add balanceofsatoshis
yarn add v1.22.0
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
warning balanceofsatoshis > [email protected]: Critical
[3/5] 🚚  Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=12.0.0". Got "10.19.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

I believe it is because it depends on [email protected] > [email protected] > [email protected].

The node compatibility was corrected in [email protected].

If it is possible to upgrade the dependencies then it would resolve the issue.

[Feature Idea] rebalance function result

Currently the rebalance result is logged but not returned from the function. Would be great to receive the result as well to be able to show it to the user in the UI

[bug] Price value formatting

Not sure if I'm missing something here but seems like the formatting of the BTCUSD price rate is incorrect?

Screen Shot 2020-02-16 at 9 55 15 AM

Shouldn't it be 9908.81666999?

[Feature Idea] Remove Peer should preserve inbound liquidity

When removing a peer, a circular rebalance can allow for preserving the inbound liquidity present on the peer that is being removed

This could work with multiple HODL invoices, so that all of the inbound would be transferred in a short time window with the channel close.

402 PaymentRequiredToCreateSwap

Hi, getting this error trying to increase inbound liquidity. I'm using a non-standard setup, running from a git clone and a credentials.json file because my cert and macaroons are in non-standard locations. I believe the base64 cert and macaroon are correct. I can see node info so I'm fairly sure the app is setup correctly. 100% of funds are in channels currently.

Just need some info on what the error (402 PaymentRequiredToCreateSwap) means and how to correct it.

Segmentation fault on 5.40.1 on using Telegram messages

Hey @alexbosworth , I am getting segmentation faults. I just did a npm upgrade. I do not get telegram messages, apart from "connected to XXX" messages

# bos telegram --node=DeBitcoinFan --connect 9******

is_connected: true
2020-07-06T09:36:45.213Z 🐔 swaply inbound enabled by XXX on 633615x1873x0
Segmentation fault (core dumped)

# bos --version
5.40.1

Chain-receive not exact amount

Terminal:
bos chain-receive XXX --max-fee=2500 --refund-address=AAA

Then made a tx from exchange to the given bech address, but forgot to subtract the prompting mining fees (are these even given exact in exchanges?).

Now loop is still pending. The bech address has XXX - 1000sats confirmed by se blocks already. What can I do?

I already saved the pay recover key.

Error when recovering swap.

$ bos --version
5.41.3

$ lnd --version
lnd version 0.10.99-beta commit=clock/v1.0.0-229-ge64e71d86dc1ac716c30a80f85a22e8fb544697f

$ node --version
v14.6.0

$ bos increase-inbound-liquidity --show-raw-recovery --recovery <recovery_secret>

/usr/lib/node_modules/balanceofsatoshis/swaps/swap_out.js:404
        if (getLimits.max_cltv_delta < minCltvDelta) {
                      ^
TypeError: Cannot read property 'max_cltv_delta' of undefined
    at asyncAuto.getTimeout (/usr/lib/node_modules/balanceofsatoshis/swaps/swap_out.js:404:23)
    at runTask (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:227:13)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:167:31
    at processQueue (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:177:13)
    at taskComplete (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:193:9)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:220:17
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/internal/onlyOnce.js:12:16
    at asyncAuto.getQuote (/usr/lib/node_modules/balanceofsatoshis/swaps/swap_out.js:328:18)
    at runTask (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:227:13)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:167:31
    at processQueue (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:177:13)
    at taskComplete (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:193:9)
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:220:17
    at /usr/lib/node_modules/balanceofsatoshis/node_modules/async/internal/onlyOnce.js:12:16
    at asyncAuto.startHeight (/usr/lib/node_modules/balanceofsatoshis/swaps/swap_out.js:218:18)
    at runTask (/usr/lib/node_modules/balanceofsatoshis/node_modules/async/auto.js:227:13)

UnexpectedResponseInHistoricRateResponse Error

When attempting to run the following command (or any bos accounting command):

bos accounting chain-fees --month 8 --year 2020 --csv

The command hangs for several minutes, then returns:

UnexpectedResponseInHistoricRateResponse

Problem connecting to remote node

followed instructions to make ~/.bos/mynode/credentials.js:

{
"macaroon": "mymacaroon==",
"cert": "mycert==",
"socket": "mynode.mysite.io:10009"
}

When I run bos nodes, error:

balanceofsatoshis/nodes/get_saved_nodes.js:103
          if (!credentials.macaroon) {
                           ^
TypeError: Cannot read property 'macaroon' of undefined

lnd version 0.8.0-beta commit=v0.8.1-beta
bos 5.6.2
node v10.17.0

Deal with failures on chain-receive to more intelligently select an amount

Currently the chain-receive auto selection of amount simply uses a static scalar.

This leads to some errors like:

err:
  - 503
  - UnexpectedErrorCreatingSwapIn
  -
    err:
      message: 9 FAILED_PRECONDITION: target unreachable
      stack:
        - Error: 9 FAILED_PRECONDITION: target unreachable

This error means that the swap service cannot find a route to pay off-chain, but this is not messaged clearly

Instead this error could be handled and the amount could also be adjusted to be valid for the receiving node

[Feature request] option to communicate over Tor or VPN

When BoS is communicating with external services like Telegram or the Loop server being able to specify a proxy to go through would be very valuable for privacy by avoiding exposing the public IP address of the node (or the server where BoS is running).

[Feature Idea] Push Credentials Request

Currently the flow for transferring credentials in add node is:

  1. Generate transfer public key on client
  2. Go to the server and paste in the public key
  3. Copy the encrypted blob
  4. Paste the blob into the client

Instead it could be

  1. Start credential server on the node
  2. Point the client at the credential server, which will output a confirmation code
  3. Go to the node, check the confirmation code, and accept the request

This would save a step

Probing ACINQ - 503 UnexpectedErrGettingRouteToDestination - message: 2 UNKNOWN: feature pair exists

$ bos --version
5.39.1

$ lnd --version
lnd version 0.10.99-beta commit=clock/v1.0.0-49-g9b8d51231c9cc5505380e911a45378f78d306190

$ bos probe --find-max 03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f
checking_for_path_to: ACINQ 03864ef025fde8fb587d989186ce6a4a186895ee44a926bfc370e2c366597a3f8f
err: 
  - 503
  - UnexpectedErrGettingRouteToDestination
  - 
    err: 
      message: 2 UNKNOWN: feature pair exists
      stack: 
        - Error: 2 UNKNOWN: feature pair exists
        -     at Object.exports.createStatusError (/usr/lib/node_modules/balanceofsatoshis/node_modules/grpc/src/common.js:91:15)
        -     at Object.onReceiveStatus (/usr/lib/node_modules/balanceofsatoshis/node_modules/grpc/src/client_interceptors.js:1209:28)
        -     at InterceptingListener._callNext (/usr/lib/node_modules/balanceofsatoshis/node_modules/grpc/src/client_interceptors.js:568:42)
        -     at InterceptingListener.onReceiveStatus (/usr/lib/node_modules/balanceofsatoshis/node_modules/grpc/src/client_interceptors.js:618:8)
        -     at callback (/usr/lib/node_modules/balanceofsatoshis/node_modules/grpc/src/client_interceptors.js:847:24)

Onchain balance inaccurate

The value returned by bos balance --onchain appears to be total_balance + unconfirmed_balance rather than confirmed_balance + unconfirmed_balance.

Huge lack in performance while bos telegram

I tested the bos telegram in my RaspiBlitz node (Pi 4 B) and it worked great so far. Than i observed kind of performance lags after that installation. cpu was always at 60% on that node process.

Do you expect that huge performance requirements on this? Iam hosting some telegram bots with python and those guys are running on 3% max.

Can you try to confirm that?

[Feature Idea] Privacy Pay

Sometimes you might want more privacy in a payment

Allow specifying:

  • minimum number of hops for a route
  • minimum split of sharded value
  • ignore nodes that have clearnet ips
  • ignore nodes that have URL aliases
  • add additional waiting time between payment attempts

[Feature Idea] Make a fee-inclusive option for opening a channel

Currently when you open a channel with bos open you specify the capacity and it gives you an address to pay that matches that capacity

But what if you want to burn a UTXO or multiple UTXOs into channels with no change leftover?

It would be nice to tell bos open about your UTXOs and have it help you figure out a channel open that left no change

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.