Inspiration
Lightning balances being onesided is a big problem. if we get a way to rebalance channels with our channels partners that is quick and efficient it would be a great win.
What it does
a LND node checks when routing a payment. if there is not enough liquidity on its side. it will check with its channel partner and ask to pay an invoice for a certain amount.
The routing node will give in exchange the same amount of ecash or more than the invoice that is being paid. This ecash will be locked to the hash of the preimage of the invoice and the pubkey of the node that is paying the invoice. There will be also be a locktime and the refund locked to the routing node's pubkey in the case that the invoice doesn't get paid in a timely manner.
How we built it
Using a golang application. Running two threads I used GRPC and LND nodes. Communicating with the HTLCInterceptor and lightning custom messages. One thread does htlc interceptions and the other listens to lightning custom messages.
At the time the lightning nodes have a common Cashu mint.
There is also a cashu wallet to hold the proofs and interact with the mint.(not yet implemented. there has been problems)
Challenges we ran into
LND documentation can be confusing at times and it is not standard. Some calls will return SAT and other MSAT. Other things like getting confused on what parameters were needed for the GRPC were also fairly common.
The biggest problem that is still precent at the time of writing is that the gonuts library for wallet doesn't support HTLCs. I notice this fairly late into the hackaton. I'm still thinking solutions on this.
Accomplishments that we're proud of
Communication actually works and it is actually possible to do this work and get it into a decent state.
What we learned
This could be a great way to solve some of the biggest liquidity issues that plague lightning. You obviously have to trust a custodian but we need all the tools possible to get lightning to work.
What's next for HTLC rebalancer
Hopefully getting it into a stable state and do things like mint notifications and mint independence.
NOTICE
Before the hackaton I had already developed the listener to the HTLCInterceptor. No work was done after that.
Built With
- go
- grpc
- lnd
Log in or sign up for Devpost to join the conversation.