No description
Find a file
bitromortac 53148c5232
chanevents+db: add sync row
We want to know if an update came from an initial sync. This also helps
us to identify data gaps and one can be sure it was not due to an actual
event. Modify the migration as it's unreleased.
2026-04-02 12:25:36 +02:00
.gemini .gemini: add gemini code assist config 2026-03-03 09:08:42 +01:00
.github github: sqlc check 2026-04-01 15:06:37 +02:00
accounting accounting: add error messages for errors 2025-10-02 14:26:31 -03:00
chain multi: optionally connect faraday to a bitcoin node 2020-06-27 14:47:20 +02:00
chanevents chanevents: add event comparison test helper 2026-04-02 12:25:36 +02:00
cmd frcli, frdrpcserver: expose bitfinex fiat backend 2026-02-28 18:43:20 -05:00
dataset multi: update LND, lndclient and btclog deps 2025-03-05 11:51:45 +02:00
db chanevents+db: add sync row 2026-04-02 12:25:36 +02:00
docs docs: formatting and typos/grammar 2024-11-15 09:28:19 +01:00
fees multi: bump btcec/v2 and btcutil to new versions 2022-03-25 16:55:04 +01:00
fiat fiat: add Bitfinex price backend 2026-02-28 18:21:20 -05:00
frdrpc build: bump go version to v1.25.5 2026-03-09 12:40:06 +01:00
frdrpcserver faraday+frdrpcserver: move server infrastructure to faraday package 2026-03-24 09:43:39 +01:00
insights multi: fix linter issues, run imports 2022-11-21 17:12:17 +01:00
itest mod+itest: bump lnd and lndclient versions 2026-03-09 12:40:45 +01:00
lndwrap multi: fix linter issues, run imports 2022-11-21 17:12:17 +01:00
make github: unit tests for both databases 2026-03-30 11:50:55 +02:00
paginater paginater: export paginated query type 2020-11-23 09:34:18 +02:00
recommend multi: update LND, lndclient and btclog deps 2025-03-05 11:51:45 +02:00
resolutions multi: fix linter issues, run imports 2022-11-21 17:12:17 +01:00
revenue multi: update LND, lndclient and btclog deps 2025-03-05 11:51:45 +02:00
scripts mod: add sqldbv2 and boilerplate 2026-03-30 11:50:52 +02:00
tools build: bump go version to v1.25.5 2026-03-09 12:40:06 +01:00
utils utils: add time range validation function for general use 2020-04-29 09:17:08 +02:00
.gitignore itest: add itest setup with two lnd nodes and a single faraday instance 2020-08-12 11:42:09 +02:00
.golangci.yml multi: go and linter version bumps 2025-03-05 12:09:37 +02:00
config.go multi: update LND, lndclient and btclog deps 2025-03-05 11:51:45 +02:00
Dockerfile build: bump go version to v1.25.5 2026-03-09 12:40:06 +01:00
faraday.go faraday: introduce structured lifecycle for the Faraday daemon 2026-03-24 10:02:35 +01:00
go.mod chanevents: implement store 2026-04-01 15:06:37 +02:00
go.sum mod: add sqldbv2 and boilerplate 2026-03-30 11:50:52 +02:00
LICENSE readme: update license and remove status 2020-03-10 11:02:03 +02:00
log.go multi: update LND, lndclient and btclog deps 2025-03-05 11:51:45 +02:00
macaroons.go faraday+frdrpcserver: move server infrastructure to faraday package 2026-03-24 09:43:39 +01:00
Makefile mod: add sqldbv2 and boilerplate 2026-03-30 11:50:52 +02:00
README.md README: describe custom scoped macaroon 2023-04-20 10:12:07 +02:00
release.sh multi: faraday rename 2020-03-30 09:25:46 +02:00
run_itest.sh itest: add itest setup with two lnd nodes and a single faraday instance 2020-08-12 11:42:09 +02:00
sqlc.yaml mod: add sqldbv2 and boilerplate 2026-03-30 11:50:52 +02:00
version.go version: bump to version v0.2.16-alpha 2025-05-26 10:40:19 +02:00

faraday

MIT licensed

Faraday is a suite of tools built to help node operators and businesses run lnd, the leading implementation of the Lightning Network. Faradays tools decrease the operational overhead of running a Lightning node and make it easier to build businesses on Lightning. The current features in the Faraday suite provide insight into node channel performance and support for accounting with both on-chain and off-chain reports for lnd.

LND

Note that Faraday requires lnd to be built with all of its subservers and requires running at least v0.11.1. Download the official release binary or see the instructions in the lnd repo for more detailed installation instructions. If you choose to build lnd from source, following command to enable all the relevant subservers:

make install tags="signrpc walletrpc chainrpc invoicesrpc"

Installation

A Makefile is provided. To install faraday and all its dependencies, run:

git clone https://github.com/lightninglabs/faraday.git
cd faraday
make && make install

Usage

Faraday connects to a single instance of lnd. It requires access to lnd's admin.macaroon (or a custom scoped macaroon, see below) and a valid TLS certificate. It will attempt to use the default lnd values if no command line flags are specified.

./faraday                                                   \
--lnd.macaroonpath={full path to lnd's admin.macaroon}   \
--lnd.tlscertpath={path to lnd cert}                        \
--lnd.rpcserver={host:port of lnd's rpcserver} 

By default, faraday runs on mainnet. The --network flag can be used to run in test environments.

Baking a custom macaroon for Faraday

Faraday needs to derive a shared key with lnd to create an encryption password for its macaroon database. That's why on top of the permissions in the readonly.macaroon the uri:/signrpc.Signer/DeriveSharedKey is also required. A custom scoped macaroon just for Faraday can be baked with:

lncli bakemacaroon onchain:read offchain:read address:read peers:read info:read invoices:read uri:/signrpc.Signer/DeriveSharedKey

Authentication and transport security

The gRPC and REST connections of faraday are encrypted with TLS and secured with macaroon authentication the same way lnd is.

If no custom faraday directory is set then the TLS certificate is stored in ~/.faraday/<network>/tls.cert and the base macaroon in ~/.faraday/<network>/faraday.macaroon.

The frcli command will pick up these file automatically on mainnet if no custom faraday directory is used. For other networks it should be sufficient to add the --network flag to tell the CLI in what sub directory to look for the files.

For more information on macaroons, see the macaroon documentation of lnd.

NOTE: Faraday's macaroons are independent from lnd's. The same macaroon cannot be used for both faraday and lnd.

Chain Backend

Faraday offers node accounting services which require access to a Bitcoin node with --txindex set so that it can perform transaction lookup. Currently the CloseReport endpoint requires this connection, and will fail if it is not present. It is strongly recommended to provide this connection when utilizing the NodeAudit endpoint, but it is not required. This connection is optional, and all other endpoints will function if it is not configured.

To connect Faraday to bitcoind:

--connect_bitcoin                       \
--bitcoin.host={host:port of bitcoind}  \
--bitcoin.user={bitcoind username}      \
--bitcoin.password={bitcoind  password}

To connect Faraday to btcd:

--connect_bitcoin                   \
--bitcoin.host={host:port of btcd}  \
--bitcoin.user={btcd username}      \
--bitcoin.password={btcd password}  \
--bitcoin.usetls                    \
--bitcoin.tlspath={path to btcd cert}

RPCServer

Faraday serves requests over grpc by default on localhost:8465. This default can be overwritten:

--rpclisten={host:port to listen for requests}

Cli Tool

The RPC server can be conveniently accessed using a command line tool.

  1. Run faraday as detailed above
./frcli {command}
Commands
  • insights: expose metrics gathered for one or many channels.
  • revenue: generate a revenue report over a time period for one or many channels.
  • outliers: close recommendations based whether channels are outliers based on a variety of metrics.
  • threshold: close recommendations based on thresholds a variety of metrics.
  • audit: produce an accounting report for your node over a period of time, please see the accounting documentation for details. Chain backend strongly recommended, fee entries for channel closes and sweeps will be missing if a chain connection is not provided.
  • fiat: get the USD price for an amount of Bitcoin at a given time, currently obtained from CoinCap's historical price API.
  • closereport: provides a channel specific fee report, including fees paid on chain. This endpoint is currently only implemented for cooperative closes. Requires chain backend.

Metrics currently tracked

The following metrics are tracked in faraday and exposed via insights and used for outliers and threshold close recommendations.

  • Uptime
  • Revenue
  • Total Volume
  • Incoming Volume
  • Outgoing Volume

Development

If you would like to contribute to Faraday, please see our issues page for currently open issues. If a feature that you would like to add is not covered by an existing issue, please open an issue to discuss the proposed addition. Contributions are hugely appreciated, and we will do our best to review pull requests timeously.

Tests

To run all the unit tests in the repo:

make check

To run Faraday's itests locally, you will need docker installed. To run all itests:

make itest

Individual itests can also be run using:

./run_itest.sh {test name}