Liquidity Bound Calculation for Lightning Network
1. Inbound Liquidity (IL): The liquidity available for receiving funds.
2. Outbound Liquidity (OL): The liquidity available for sending funds.
3. Transaction Fees (TF): Fees associated with channel transactions.
4. Network Demand Factor (NDF): A factor reflecting network demand and routing.
5. Safety Margin (SM): A buffer for volatility and unexpected scenarios.
We can express the liquidity components as follows:
6. Total Capacity:
TotalCapacity = IL + OL
7. Available Liquidity:
AvailableLiquidity = min(IL, OL)
8. Adjusted Liquidity:
AdjustedLiquidity = AvailableLiquidity - TF
= min(IL, OL) - TF
9. Effective Liquidity:
EffectiveLiquidity = AdjustedLiquidity * NDF
= (min(IL, OL) - TF) * NDF
10. Safe Liquidity Bound:
SafeLiquidityBound = EffectiveLiquidity - SM
= ((min(IL, OL) - TF) * NDF) - SM
Example 1:
11. Inbound Liquidity (IL): 3 BTC
12. Outbound Liquidity (OL): 2 BTC
13. Transaction Fees (TF): 0.01 BTC
14. Network Demand Factor (NDF): 0.9
15. Safety Margin (SM): 0.05 BTC
Calculation:
16. Total Capacity: 3 BTC + 2 BTC = 5 BTC (Not directly needed for the final calculation)
17. Available Liquidity: min(3 BTC, 2 BTC) = 2 BTC
18. Adjusted Liquidity: 2 BTC - 0.01 BTC = 1.99 BTC
19. Effective Liquidity: 1.99 BTC * 0.9 = 1.791 BTC
20. Safe Liquidity Bound: 1.791 BTC - 0.05 BTC = 1.741 BTC
Example 2:
21. Inbound Liquidity (IL): 1.5 BTC
22. Outbound Liquidity (OL): 4 BTC
23. Transaction Fees (TF): 0.02 BTC
24. Network Demand Factor (NDF): 0.8
25. Safety Margin (SM): 0.1 BTC
Calculation:
26. Total Capacity: 1.5 BTC + 4 BTC = 5.5 BTC (Not directly needed for the final calculation)
27. Available Liquidity: min(1.5 BTC, 4 BTC) = 1.5 BTC
28. Adjusted Liquidity: 1.5 BTC - 0.02 BTC = 1.48 BTC
29. Effective Liquidity: 1.48 BTC * 0.8 = 1.184 BTC
30. Safe Liquidity Bound: 1.184 BTC - 0.1 BTC = 1.084 BTC

