Liquidity Swaps

@paul - I found you through I video you did on CL and opening a channel. I have a question if you don’t mind:

I opened up a liquidity swap (triangle) at lightningnetwork.plus with 2 nodes. One of the nodes is not staying up on a regular basis and I notice that my Lightning wallets balance goes down every time this node goes offline. As of today I see my wallet balance has dropped by 169,00 or so sats.

The question - If I close the channel with this node will I regain those 169,000 sats or do I lose them?

Background: I am an old guy…like the little hair cut girl told me the other day may age bracket is 65+ and wiser. I don’t feel wiser at the moment though. Any advice/direction would be most welcome.

Thanks

ps - and yes I do have your LND channel but I do not know how to interact with it.

1 Like

When you close a channel, you get the balance that is on your side of it (the outbound liquidity) deposited into your base-layer wallet for your Lightning node (minus fees). This balance does not appear immediately, though. If it is a mutual close (where both nodes are online and agree to close), then it should be unlocked within a couple of days. If it is a force-close (i.e. you close the channel because the other node is offline) then you will need to wait several days before it gets unlocked. This is meant to give the other node some time to create a dispute transation in the case where you were trying to cheat them.

Personnally, I wouldn’t mess with liquidity triangles. They were necessary prior to submarine swaps and Boltz.exchange becoming ubiquidous, but now-a-days, just open channels with good, high-uptime, reputable nodes, and use Boltz.exchange when you need to swap some of your outbound liquidity for inbound and move your sats to cold storage.

If you want, I can set up a virtual meeting and walk you though the process I use.

You know this does sound like it would help me. I followed the Start9 manual about adding channels so that is what got me onto this road. I jumped before I learned how to swim.

You mentioned:

This is meant to give the other node some time to create a dispute transation in the case where you were trying to cheat them.

How would one cheat another and I take it “steal” the sats? Should I be respectful (that’s how I roll) and contact the Node operator in question before I just shut the channel down…or should I file a claim?

Any-who…yes if you have the time and it don’t cost me too much I’d love a walk thru. I have a pretty extensive setup on my Start9 and do have RTL, LND and CL running…but CL is acting weird as you say and I’m not comfortable. I also see I might be-able to utilize Alby if I don’t have the option of using Bolts.

Again…I jumped before I learnt to swim.

Let me know how you virtually meet. I’m one a Mac…so I really despise PC (Microsoft) stuff with a passion but if I must use a MS products I’ll make an exception. :wink:

Thank you.

I’m not sure what tools are used for this (I’m not really plugged into hacker circles). Conceptually, one would acquire (or write their own) tool that submits a transaction to close the channel using an old state (one where there was more outbound liquidity on their side). If this transction gets mined, then they walk away with more sats than they are actually owed.

Remember, the activity on a Lightning channel happens outside of what’s happening on the base layer, so there is nothing on the base layer that is aware of what the channel state should be. The channel is techincally a smart contract, and it is set up in a way that if one party attempts to close the channel using an old state, the other party being cheated has a way to prove they are, which allows them to sweep the channel balance (thus punishing the cheater and creating an incentive to not cheat).

I don’t usually charge for short meetings. If we get into something that takes more than an hour or two, we can negotiate what my input is worth.

I self-host an open-source meeting solution called Jitsi, which you can join from your web browser. The Jitsi devs have been sponsered by various companies, but I don’t think Microsoft is among them. I’ll send you a DM to discuss when is a good time and to send you the details to join.

1 Like

Roger on the self host virtual meeting . If I’m stupid to what you are doing I’ll make it “happy Satoshi days” for your time.

Interesting on the hackers exploiting like that. All this extra bs with the Blockchain is why the normal person will never be involved in the network. People like you and I are not the regular people so I imagine it is easier for us to understand the network and why we are here but for mass adoption like Satoshi Nakamoto envisioned everything to do with BTC needs to be brought down to the “peoples” level.

Thanks for your time.

A how-to liquidity video would be popular, Paul :grinning:

1 Like

Yes, I’ve got a video planned to do a deep-dive into my current level of understanding on Lightning. Might be a mini-series, but the idea would be to start with setting up two linked nodes (CLN to support Lightning Offers, linked to LND as the primary node), clearing up inbound liquidity via Boltz, balancing the channel between CLN and LND nodes, pipeline for using the setup to add forward privacy to KYC bitcoin, and connecting up Alby Hub, establishing a lightning address, integrating with Alby Go for lightning on-the-go, and integrating with Nostr.

2 Likes

Yep. I’m looking forward to that for sure. I got off on the wrong foot with liquidity. @paul I really appreciate the one on one yesterday afternoon. Head is swimming a little though. I did get a grasp of some of it but in the interim I broke my ability to sign from RTL to CL so I could control the login to the swap I got myself into.

Today I’m going to continue to figure out how to add my CL channel as a peer in LND. I just gotta make sure I do it right because now I have 1,000,000 sats on the line (don’t wanna lose them puppies).

Cant figure out why the LND node wont show up at 1ml but the CL node does. 1ml reports my CL node so I guess I first have to claim it and then move forward.

Question if I may: When I do a backup are the sats in LND and CL also in the backup?

Any-who. If you want a guinea pig I’ll offer up any help I can.

Thanks again. Most appreciated.

To make your node visible on 1ML, usually you just need to wait a while for your node to propagate the network. Note that you must have at least one public channel before your node will show up in the gossip data. An easy alternative would be to just add 1ML’s node as a peer, and then they’ll definitely know about you:

0217890e3aad8d35bc054f43acc00084b25229ecff0ab68debd82883ad65ee8266@66.109.24.41:9735

Yes, when you do a general StartOS backup for your server, as long as you make sure the the Core Lightning and LND services are also checked, then restoring from the backup will fully restore your lightning nodes (with the balances, channels, etc)

1 Like

Yep. Gotcha on the back-up procedure.

From what I can gather is I do not need to claim my node on 1ml unless I want to broadcast and promote it. Check

For the record LND has been running for 12 months so that’s why I’m confused about it not being seen but regardless of that the CL node is recognized so from what I gather is I can add the CL node as a peer from LND using RTL. Check.

This is were my notes fell apart…should the peer I open between myself be 580,000 sats or is that the channel I would open? See Paul…that is what 65+ and wiser does to you. :wink:

EDIT: Correction…just add 1ml as peer and “do it later”. Check

I’m going to take a shot at this as I see it. No harm no foul in trying. Cant really break anything.

Thank you sir.

ps - I pounder if I may be getting a head of your mini series :thinking:

To summarize the basic architecture:

Core Lightning node with one channel
– 60,000 sats, connected to your LND node

LND node with two channels
– 60,000 sats, connected to your Core Lightning node (same channel mentioned above)
– 500,000 sats, connected to ACINQ

Of course, you will have more channels besides the ones above, but these are needed for the basic architecture.

That 60,000 sat channel between your two nodes can be opened from either end. You can go into Core Lightning and open the channel up from it to your LND node for 60,000 sats. Or you can go into Ride The Lightning (which we configured to point at your LND node) and open a channel up from it to your Core Lightning node for 60,000 sats. Since I think you mentioned you are able to see your Core Lightning node on 1ML, the second option will probably be the simplest.

That 500,000 sat channel to ACINQ should be opened up from your LND node (using Ride The Lightning), and not from your Core Lightning node.

Once all of the channel open transactions have been mined and there have been enough confirmations so that the channels appear active, then you will open some inbound liquidity on your 500,000 sat channel with ACINQ. This can be done going to Boltz.exchange to do a swap from Lightning to Bitcoin. For the receive address, you typically would use a cold storage address (if you’ve got your hardware wallet set up), otherwise just send it to a software wallet that you own (could even be the wallet on your Lightning node if you prefer)

2 Likes

I watched a podcast interview with Jack Dorsey earlier, he was asked what would he change about the bitcoin world if he could? He said Lightning. “It’s not bad,” he said, “it’s just… challenging.” :stuck_out_tongue_closed_eyes:

Haha, nice one! Personally, I disagree with Dorsey about changing it though. I think it just needs to have a better UX built on top of the underlying structure. Nearly everything that consumes my time managing my lightning nodes could be easily automated behind the scenes, while keeping the system non-custodial and self-sovereign.

2 Likes

A bit a challenge for a “newbie operator” but the consumer lightning wallets are a breeze. Here my invoice now please pay me.

This deep dive self-sovereign path is a touch more intricate. Since Paul opened my eyes about building liquidity between my self with my LND node and C-Lightning node he put me on a path to “learn it der’nt”. Now - what Paul said about management…that sounds “fun”. :thinking:

@paul - thanks for the short an sweet description above. Helped immensely. Just waiting on ACINQ. The only thing puzzling is the open channel from LND to CL shows:
Untitled-12

But it’ll get worked out. A work in progress: One step at a time. Any-who it’s coming together and probably would have taken 6 months for me to figure this out on my own. :+1:

That is exactly what you want – 60,000 sats of inbound liquidity on the Core Lightning side. This channel will be a route for payments outside of your Core Lightning node (Ocean payouts, for example) to flow into your Core Lightning node (by way of your LND node). In the distant future, once this channel starts filling up with all your mining rewards, you simply move those 60,000 sats back over to the LND side again like they are now, by creating an invoice from LND, and paying it from Core Lightning.

1 Like

C-lightning log when I try and send to LND:

2025-06-23T17:00:09-06:00 {“level”:“error”,“message”:“\tFailed: We could not find a usable set of paths. The shortest path is 902330x2713x0, but 902330x2713x0/0 layer auto.localchans says max is 0msat”,“timestamp”:“2025-06-23 23:00:09:09”}

That’s because the outbound liquidity is already on the LND side, based on your screenshot (since you opened it from the LND side). That means, on the Core Lightning side it is all inbound liquidity. You won’t need to do the step of sending liquidity from Core Lightning to LND until some time in the distant future after you have mined a lot of rewards and the liquidity starts to fill up on the Core Lightning side.

Now if you are trying to balance your other channels on your Core Lightning node (not the channel with your LND node), then you are likely running into Core Lightning’s routing issues (which of course is why I recommended using LND as your primary lightning node in the first place). You can try sending in smaller chunks, or enabling xpay to see if it can find a route.

Ultimately, I would suggest not fighting with it, and simply close any other channels as their outbound liquidity fills up on the Core Lightning side, and just leave the one channel with your LND node as the single channel on your Core Lightning node. All of your main channels should be on your LND node, so that Core Lightning is only used for Ocean mining (over the one single channel)

Yep. Understand and I’m completely on board with LND as primary node.

I was just testing running for future - I’ll flesh out all other channels I have on C-lightning. The only one I have reservation about closing is the triangle swap, which I should have never gotten into. Just hate to drop it out as it would make me feel like an ass for not completing an agreement. I’ll work on it in my own head. Never the less…your advice is rock sold.

BTW - right now it looks like the swap channel is where the Ocean payout is being handled from what I can tell. I’ll have to pay close attention to balance change

Thanks bud.

It probably won’t hurt anything to keep the triangle swap channel(s). Just treat the sats there as locked up as long as you stay in the agreement. As that one fills up, the other members of the triangle will balance their channels, which will likey result in periodic changes to the liquidity on your LND channel (since that is one of the channels which reaches outside of the triangle). Any time your channel with the LND node fills up, that is when you would do the step to send liquidity from the Core Lightning side to the LND side (to free up room for your Ocean payouts). The rest is just noise (sats will move around between channels as transactions traverse through your nodes).

1 Like

BTW, if you really need to get some of the sats out of that channel and you want to try xpay before resorting to closing the channel, that can be enabled via: Services > Core Lightning > Config > Advanced > Experimental Features > Xpay. Try enabling that, and making the invoices in smaller chunks. That will usually get around Core Lightning’s routing problems.