LN routing and caveats

whats wrong with my questions?

There is nothing wrong, I guess people are just focused on different things.

How technically these things are done?

Does Dijsktra’s in Electrum handle chunking automatically?

You can see it by running regtest, and setting up a network, where you can have more than one client, and then you can confirm it experimentally, which node can see what things, and what decisions can be made by which participant.

Is it possible that ACINQ node will deny to open a channel with me? For instance, for AML reasons

Of course. And exactly the same attack can be done by miners, because they decide, which transactions are included, and which are not. In case of main chain, you can in theory force the network to accept your transaction, by mining a valid block (as long as hashrate majority is not actively reorging your blocks). In case of LN, you can only choose a different node, because there is no mining (but it can be introduced, if needed).

Could interim nodes do the same when P0 is negotiated?

Anyone can disturb LN, by simply being offline. I think you are worried about AML reasons, or similar things, but LN can stop working in a much easier way: some node operators could simply disconnect, and wait. To raise a panic, all that is needed, is just convincing enough nodes to go offline.

And do they on practice?

There is no way to tell, because “being offline” and “rejecting connection for AML reasons” can give you the same end result: forcing you to settle things on-chain. And anyone can tell you “please check your connection”, instead of informing you about any AML rules.

Capacity of 50 BTC doesn’t guarantee that there will be a route summing up exactly to 50 BTC.

LN payment can always fail. Some people prefer sidechains, instead of LN, because then, you can always send every coin to everyone else. In LN, you simply use the main chain to open and close channels, but contrary to the sidechains, it is hard to send and receive coins “inside LN”, without touching the main chain. It is possible to fix that by using fake channels, but if LN is “experimental”, then fake channels are “double experimental”.

it seems impossible to find all route permutations

The same is true with all transactions’ permutations within a block. So it is based on “best effort”, where you start with any solution, and improve it gradually. Because Bitcoin mining is NP-hard, and in case of LN, it is not any better than that, and LN nodes also solve NP-hard problems.

Is it better to send huge sum in small chunks or it doesn’t matter?

It is a philosophical question, because there are also fees. In theory, you could make a lot of transactions, sending one satoshi each, and have a higher chances of sending a payment, which wouldn’t fail. But in practice, LN fees could make that approach impractical. So, the amount you can send, and the way of sending it, is driven by network conditions. Just like on-chain, you can have lower or higher fees, when mempools are more or less congested, the same is true in LN: you can find a single connection, which will handle it atomically, or your payment can fail, if it would be a single payment, so you will be forced to split it into N smaller payments, to have any chances to succeed.

Also, after reaching a certain amount, sending it on-chain may be cheaper, than sending it through LN. Because LN is made for small payments, where on-chain fees are too high to proceed. However, if you can see lower on-chain fees, than LN fees, then just use on-chain. Which is also a reason, why there is more on-chain than LN activity: after going beyond certain amount, it is more profitable, to close all channels, than to keep using them.

what are the real constraints I must consider when using LN regularly for B2B on a technical level?

Mainly transaction fees, and the risk of nodes being offline. Because LN is not a sidechain. You cannot send anything anywhere. Your actions highly depend on current network state, at the moment when you want to transact (which is also why anchors were introduced, to allow adjusting on-chain fees). If anything goes wrong, then you have to touch on-chain coins, so LN is just layer “one and a half”, instead of being the proper “layer two”.

For example: some casinos officially rejected introducing LN, because they considered it “not worth the effort”. Also, some Bitcoin ATM company decided to not support LN, because they tried and failed. And you can read their statement here: https://shitcoins.club/resources/pdf/stand_LN_en.pdf

So, LN can help you, if you want to make a lot of transactions, between participants, which are almost always online, and where you don’t want to change network topology too much (which means, that the same amounts are constantly flying in both directions between similar participants, so you don’t have liquidity problems, and you can delay going on-chain forever, and do almost everything off-chain). If your business doesn’t meet this definition, then using LN may be more expensive, if you will be forced to go on-chain anyway, and then pay on-chain fees, and off-chain fees, instead of moving fractions of satoshis purely off-chain.