Re: [Lightning-dev] #PickhardtPayments implemented in lnd-manageJ

2022-05-17 Thread Carsten Otto via Lightning-dev
Three small updates:

1)
The most recent version of lnd-manageJ now also considers channels that
charge a base fee. In order to make this work, the worst-case scenario
is assumed (which is: a channel is used for the smallest possible amount)
and the fee rate used for the route computation is adjusted accordingly.

With the default settings (quantization 10,000sat), a channel charging a
base fee of Xsat and a fee rate of Yppm is considered with a virtual fee
rate of (Y+X*100)ppm.

This penalty is linear in the quantization amount, i.e. if you use a
quantization of 100,000sat, a base fee of Xsat only results in a
penalty of X*10ppm.

2)
I added a Dockerfile that should help with experiments.
https://github.com/C-Otto/lnd-manageJ/blob/fix-5746/Dockerfile

The only interesting requirement is that your lnd needs to be patched:
https://github.com/lightningnetwork/lnd/pull/6545

You can tweak the lnd-manageJ.conf (as demonstrated in lines 10-12), see
https://github.com/C-Otto/lnd-manageJ/blob/main/PickhardtPayments.md for
the available options.

As I was unable to figure out how to avoid TLS issues with gRPC, you
need to use "--network host" if you run lnd on localhost.

The docker image boots PostgreSQL on the default port 5432, so make sure
it is available and not in use by your host.

For your experiments please take into account that lnd-manageJ needs to
request the LN graph from lnd, which takes a few seconds. This graph is
cached for up to two minutes and, if used, refreshed before it times out.
As such, please issue a test payment (to request the graph) before
measuring the time it takes to send out any real payment.

3)
Route/hop hints provided in the payment request are now considered so that
private/virtual channels are used for the route computation. This only
works for "route hints" which contain a single hop (which should be
fine?). Each "hint" channel is added with a capacity of 50 BTC and the
algorithm is made to believe that 100% of that is available. This "known
liquidity" is not shown in the streaming NDJSON output you get via HTTP,
though, which is just a display issue which doesn't affect the route
computation.

Happy hacking,
Carsten
-- 
Dr. Carsten Otto
cars...@c-otto.de
https://c-otto.de


signature.asc
Description: PGP signature
___
Lightning-dev mailing list
Lightning-dev@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev


Re: [Lightning-dev] #PickhardtPayments implemented in lnd-manageJ

2022-05-17 Thread Bastien TEINTURIER
I completely agree with Matt, these two components are completely
independent
and too often conflated. Scoring channels and estimating liquidity is
something
that has been regularly discussed by implementations for the last few years,
where every implementation did its own experiments over time.

Eclair has quite a large, configurable set of heuristics around channel
scoring,
along with an A/B testing system that we've been using for a while on
mainnet
(see [1] for details). We've also been toying with channel liquidity
estimation for
more than half a year, which you can follow in [2] and [3].

These are heuristics, and it's impossible to judge whether they work or not
until
you've tried them on mainnet with real payments, so I strongly encourage
people
to run such experiments. But when you do, you should have enough volume for
the result data to be statistically meaningful and you should do A/B
testing,
otherwise you can make the data say pretty much everything you want. What
I believe is mostly missing is the volume, the network doesn't have enough
real
payments yet IMHO for this data to accurately say that one heuristic is
better
than another.

Using an MCF algorithm instead of dijkstra is useful when relaying large
payments
that will need to be split aggressively to reach the destination. It does
make a lot
of sense in that scenario. However, it's important to also take a step back
and
look at whether it is economical to make such payments on lightning.

For a route with an aggregated proportional fee of 1000ppm, here is a rough
comparison of the fees between on-chain and lightning:

* At 1 sat/byte on-chain, payments above 2mBTC cost less on-chain than
off-chain
* At 10 sat/byte on-chain, payments above 20mBTC cost less on-chain than
off-chain
* At 25 sat/byte on-chain, payments above 50mBTC cost less on-chain than
off-chain
* And so on (just keep multiplying)

Of course, making payments on lightning has more benefits than just fees,
they
also confirm faster than on-chain payments, but I think it's important to
keep these
figures in mind.

It would be also useful to think about the shape of the network. Using an
MCF
algorithm makes sense when payments are saturating channels. But if channels
are much bigger than your payment size, this is probably overkill. If
channels are
small "at the edges of the network" and bigger than payments at the "core
of the
network", and we're using trampoline routing [4], it makes sense to run
different
path-finding algorithms depending on where we are (e.g. MCF at the edges on
a small subset of the graph and dijkstra inside the core).

I'm very happy that all this research is happening and helping lightning
payments
become more reliable, thanks for everyone involved! I think the design
space is
still quite large when we take everything into account, so I expect that
we'll see
even more innovation in the coming years.

Cheers,
Bastien

[1]
https://github.com/ACINQ/eclair/blob/10eb9e932f9c0de06cc8926230d8ad4e2d1d9e2c/eclair-core/src/main/resources/reference.conf#L237
[2] https://github.com/ACINQ/eclair/pull/2263
[3] https://github.com/ACINQ/eclair/pull/2071
[4] https://github.com/lightning/bolts/pull/829


Le lun. 16 mai 2022 à 22:59, Matt Corallo  a
écrit :

> Its probably worth somewhat disentangling the concept of switching to a
> minimum-cost flow routing
> algorithm from the concept of "scoring based on channel value and
> estimated available liquidity".
>
> These are two largely-unrelated concepts that are being mashed into one in
> this description - the
> first concept needs zero-base-fee to be exact, though its not clear to me
> that a heuristics-based
> approach won't give equivalent results in practice, given the noise in
> success rate compared to
> theory here.
>
> The second concept is something that LDK (and I believe CLN and maybe even
> eclair now) do already,
> though lnd does not last I checked. For payments where MPP does not add
> much to success rate (i.e.
> payments where the amount is relatively "low" compared to available
> network liquidity) dijkstra's
> with a liquidity/channel-size based scoring will give you the exact same
> result.
>
> For cases where you're sending an amount which is "high" compared to
> available network liquidity,
> taking a minimum-cost-flow algorithm becomes important, as you point out.
> Of course you're always
> going to suffer really slow payment and many retires in this case anyway.
>
> Matt
>
> On 5/15/22 1:01 PM, Carsten Otto via Lightning-dev wrote:
> > Dear all,
> >
> > the most recent version of lnd-manageJ [1] now includes basic, but
> usable,
> > support for #PickhardtPayments. I kindly invite you to check out the
> code, give
> > it a try, and use this work for upcoming experiments.
> >
> > Teaser with video:
> https://twitter.com/c_otto83/status/1525879972786749453
> >
> > The problem, heavily summarized:
> >
> > - Sending payments in the LN often fails, especially with larger amounts.
> > - Splitting a large