mirror of
https://github.com/aljazceru/lnflow.git
synced 2025-12-19 05:24:20 +01:00
146 lines
8.4 KiB
Bash
Executable File
146 lines
8.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Lightning Fee Optimizer - Inbound Fee Commands
|
|
#
|
|
# Ready-to-use lncli commands that include both outbound and inbound fees
|
|
# for advanced liquidity management and drain protection
|
|
|
|
echo "Lightning Network - Advanced Fee Strategy with Inbound Fees"
|
|
echo "=========================================================="
|
|
echo ""
|
|
echo "PREREQUISITE: Add to lnd.conf and restart LND:"
|
|
echo "accept-positive-inbound-fees=true"
|
|
echo ""
|
|
|
|
echo "PHASE 1: DRAIN PROTECTION (Apply first)"
|
|
echo "Protect your most valuable channels from being drained"
|
|
echo ""
|
|
|
|
echo "# High-earning channels - add inbound fees to prevent drains:"
|
|
echo "lncli updatechanpolicy --chan_id 799714x355x0 --fee_rate 367 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm 150 --inbound_base_fee_msat 0 # Prevent drain"
|
|
echo "lncli updatechanpolicy --chan_id 878853x1612x1 --fee_rate 445 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm 150 --inbound_base_fee_msat 0 # Prevent drain"
|
|
echo "lncli updatechanpolicy --chan_id 691130x155x1 --fee_rate 282 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm 100 --inbound_base_fee_msat 0 # Moderate protection"
|
|
echo "lncli updatechanpolicy --chan_id 903613x2575x1 --fee_rate 303 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm 100 --inbound_base_fee_msat 0 # Moderate protection"
|
|
echo ""
|
|
|
|
echo "PHASE 2: HIGH-PERFORMANCE OPTIMIZATION (Apply after 48h)"
|
|
echo "Optimize your best channels with small inbound fees for balance"
|
|
echo ""
|
|
|
|
echo "# Top performers - small inbound fees to maintain optimal balance:"
|
|
echo "lncli updatechanpolicy --chan_id 803265x3020x1 --fee_rate 229 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm 25 --inbound_base_fee_msat 0 # RecklessApotheosis"
|
|
echo "lncli updatechanpolicy --chan_id 779651x576x1 --fee_rate 11 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm 5 --inbound_base_fee_msat 0 # WalletOfSatoshi"
|
|
echo "lncli updatechanpolicy --chan_id 880360x2328x1 --fee_rate 96 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm 15 --inbound_base_fee_msat 0 # Voltage"
|
|
echo "lncli updatechanpolicy --chan_id 890401x1900x1 --fee_rate 11 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm 5 --inbound_base_fee_msat 0 # DeutscheBank|CLN"
|
|
echo "lncli updatechanpolicy --chan_id 721508x1824x1 --fee_rate 11 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm 5 --inbound_base_fee_msat 0 # node_way_jose"
|
|
echo ""
|
|
|
|
echo "💧 PHASE 3: LIQUIDITY REBALANCING (Apply after 1 week)"
|
|
echo "Use negative inbound fees to attract liquidity to unbalanced channels"
|
|
echo ""
|
|
|
|
echo "# Channels with too much local balance - discount inbound to rebalance:"
|
|
echo "lncli updatechanpolicy --chan_id 845867x2612x0 --fee_rate 80 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm -30 --inbound_base_fee_msat 0 # 99.9% local"
|
|
echo "lncli updatechanpolicy --chan_id 902317x2151x0 --fee_rate 28 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm -20 --inbound_base_fee_msat 0 # 98.8% local"
|
|
echo "lncli updatechanpolicy --chan_id 900023x1554x0 --fee_rate 22 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm -15 --inbound_base_fee_msat 0 # 99.9% local"
|
|
echo "lncli updatechanpolicy --chan_id 893297x1850x1 --fee_rate 23 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm -10 --inbound_base_fee_msat 0 # Too much local"
|
|
echo ""
|
|
|
|
echo "PHASE 4: DORMANT CHANNEL ACTIVATION (Apply after 2 weeks)"
|
|
echo "Aggressive inbound discounts to try activating unused channels"
|
|
echo ""
|
|
|
|
echo "# Low activity channels - large inbound discounts to attract routing:"
|
|
echo "lncli updatechanpolicy --chan_id 687420x2350x1 --fee_rate 25 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm -50 --inbound_base_fee_msat 0 # volcano"
|
|
echo "lncli updatechanpolicy --chan_id 691153x813x1 --fee_rate 7 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm -30 --inbound_base_fee_msat 0 # WOWZAA"
|
|
echo "lncli updatechanpolicy --chan_id 896882x554x1 --fee_rate 49 --base_fee_msat 0 --time_lock_delta 80 --inbound_fee_rate_ppm -40 --inbound_base_fee_msat 0 # Low activity"
|
|
echo ""
|
|
|
|
echo "MONITORING COMMANDS"
|
|
echo "═══════════════════════"
|
|
echo ""
|
|
|
|
echo "# Check your inbound fee policies:"
|
|
echo "lncli listchannels | jq '.channels[] | select(.chan_id | startswith(\"803265\") or startswith(\"779651\")) | {chan_id: .chan_id[0:13], local_balance, remote_balance}'"
|
|
echo ""
|
|
|
|
echo "# Verify inbound fees are active:"
|
|
echo "lncli getchaninfo --chan_id 803265x3020x1 | jq '.node1_policy.inbound_fee_rate_milli_msat, .node2_policy.inbound_fee_rate_milli_msat'"
|
|
echo ""
|
|
|
|
echo "# Monitor routing success (important with inbound fees):"
|
|
echo "lncli fwdinghistory --start_time=\$(date -d '24 hours ago' +%s) --max_events 50 | jq '.forwarding_events | map(select(.fee_msat > 0)) | length'"
|
|
echo ""
|
|
|
|
echo "# Check for routing failures (inbound fee related):"
|
|
echo "lncli listpayments | jq '.payments[-10:] | .[] | select(.status==\"FAILED\") | {creation_date, failure_reason}'"
|
|
|
|
echo ""
|
|
echo "INBOUND FEE STRATEGY SUMMARY"
|
|
echo "═══════════════════════════════"
|
|
echo ""
|
|
echo "POSITIVE INBOUND FEES (+5 to +150 ppm):"
|
|
echo "✓ Prevent outbound drains on valuable channels"
|
|
echo "✓ Compensate for providing liquidity"
|
|
echo "✓ Signal that your inbound liquidity is valuable"
|
|
echo "✓ Maintain channel balance longer"
|
|
echo ""
|
|
echo "NEGATIVE INBOUND FEES (-10 to -50 ppm):"
|
|
echo "✓ Attract routing to rebalance channels"
|
|
echo "✓ Activate dormant channels"
|
|
echo "✓ Backwards compatible (discount on total fee)"
|
|
echo "✓ Compete for routing when you have excess liquidity"
|
|
echo ""
|
|
echo "ZERO INBOUND FEES (0 ppm) - Current default:"
|
|
echo "• No additional incentives or disincentives"
|
|
echo "• Standard routing behavior"
|
|
|
|
echo ""
|
|
echo "💰 PROJECTED REVENUE IMPACT"
|
|
echo "═══════════════════════════"
|
|
echo ""
|
|
echo "Phase 1 (Drain Protection): +3,000-8,000 sats/month (prevented losses)"
|
|
echo "Phase 2 (Performance Boost): +5,000-12,000 sats/month (optimized flow)"
|
|
echo "Phase 3 (Better Balance): +2,000-5,000 sats/month (reduced rebalancing)"
|
|
echo "Phase 4 (Channel Activation): +500-3,000 sats/month (if successful)"
|
|
echo ""
|
|
echo "Total with Inbound Fees: +35-45% revenue increase"
|
|
echo "Original estimate was: +24.6% (outbound only)"
|
|
echo "Additional from inbound: +10-20% (inbound optimization)"
|
|
|
|
echo ""
|
|
echo "SAFETY CONSIDERATIONS"
|
|
echo "═════════════════════════"
|
|
echo ""
|
|
echo "1. COMPATIBILITY: Some older nodes may not understand positive inbound fees"
|
|
echo "2. ROUTING FAILURES: Monitor for increased payment failures"
|
|
echo "3. GRADUAL ROLLOUT: Apply phases 1-2 weeks apart with monitoring"
|
|
echo "4. TOTAL FEES: Keep combined inbound+outbound fees competitive"
|
|
echo "5. MARKET RESPONSE: Other nodes may adjust their fees in response"
|
|
|
|
echo ""
|
|
echo "QUICK ROLLBACK (remove all inbound fees)"
|
|
echo "═══════════════════════════════════════════"
|
|
echo ""
|
|
echo "# Reset all inbound fees to 0 (keep outbound changes):"
|
|
echo "lncli updatechanpolicy --chan_id 803265x3020x1 --fee_rate 229 --inbound_fee_rate_ppm 0"
|
|
echo "lncli updatechanpolicy --chan_id 779651x576x1 --fee_rate 11 --inbound_fee_rate_ppm 0"
|
|
echo "lncli updatechanpolicy --chan_id 880360x2328x1 --fee_rate 96 --inbound_fee_rate_ppm 0"
|
|
echo "lncli updatechanpolicy --chan_id 799714x355x0 --fee_rate 367 --inbound_fee_rate_ppm 0"
|
|
echo "lncli updatechanpolicy --chan_id 845867x2612x0 --fee_rate 80 --inbound_fee_rate_ppm 0"
|
|
echo ""
|
|
echo "# Complete rollback to original settings:"
|
|
echo "lncli updatechanpolicy --chan_id 803265x3020x1 --fee_rate 209 --inbound_fee_rate_ppm 0"
|
|
echo "lncli updatechanpolicy --chan_id 779651x576x1 --fee_rate 10 --inbound_fee_rate_ppm 0"
|
|
echo "lncli updatechanpolicy --chan_id 880360x2328x1 --fee_rate 88 --inbound_fee_rate_ppm 0"
|
|
|
|
echo ""
|
|
echo "IMPLEMENTATION TIMELINE"
|
|
echo "═════════════════════════"
|
|
echo ""
|
|
echo "Week 1: Phase 1 (Drain Protection) + monitor routing success"
|
|
echo "Week 2: Phase 2 (Performance Optimization) + assess balance impact"
|
|
echo "Week 3: Phase 3 (Liquidity Rebalancing) + monitor channel health"
|
|
echo "Week 4: Phase 4 (Dormant Activation) + evaluate overall performance"
|
|
echo ""
|
|
echo "Expected Result: 35-45% total revenue increase with better channel longevity" |