LnHedgehog: Protect your Lightning Channel Balances during Bear Markets

Kollider
3 min readNov 30, 2021

--

A practical example of how to protect your Lightning channel balance using LnHedgehog and the Kollider API during volatile times.

If you’re interested in an in-depth review on why lightning node operators might be interested in this, check out this post.

The Problem

Imagine you want to launch a business of selling t-shirts for Bitcoin using the Lightning Network. To do this, you ask a popular wallet to open a lightning channel to you because you know a lot of your potential customers use this wallet. Now you’re ordering 100 t-shirts from a whole seller for $5 a pop. You expect to get an invoice for $500 at the end of the month, which gives you plenty of time to sell your dope merch. Furthermore, you know your monthly fixed cost is $300. Again, utilities have to be paid in dollars. You decide to sell each shirt for $10 giving you a juicy 25% profit margin. At the end of the month, you get excited because you actually managed to sell all 100 t-shirts and your local channel balance amounts to 1.6 million Sats, suggesting that you have sold each t-shirt at an average Bitcoin price of $62k.

However, because you were busy packaging up and sending out the t-shirts to your customers, you lost track of the Bitcoin price. On the last day of the month, just when you wanted to close your channel and pay your dues, you realized that the Bitcoin price had been tumbling in the last few days, and it’s now $50k. This means you just broke even, shattering your dreams of creating generational wealth.

While the reality might be much less dramatic as the example above makes it out to be, it is undeniable that merchants take on a significant amount of currency risk when accepting Bitcoin. One way to solve this is to build an automatic Bitcoin hedging mechanism.

Introducing LnHedgehog.

LnHedgehog 🦔

LnHedgehog is an open-source project that aims to allow anyone with a lightning wallet to peg their wallet balance against the US dollar. In a nutshell, what the service does is:

  1. Connects to your LND node and checks your current local channel balance.
  2. Executes a short sell of all or some of the value of the channel balance on Kollider.
  3. As you spend funds from that channel, LnHedgehog automatically adjusts the size of your hedged position.

All transactions between Kollider and LnHedgehog are automatic, and the current state can be tracked using the CLI.

LnHedgehog CLI

Using this, merchants wouldn’t need to worry about the volatility of Bitcoin, as their Satoshi balance would always equal a fixed USD value. Since this is all done on the Lightning network, no transaction fees would need to be paid and no channels would need to be closed.

Can I use LnHedgehog?

Only if you really know what you’re doing! This project is meant for educational purposes only and should not be used on mainnet. Its purpose is to exemplify how different tools can be combined to solve inherent practical problems of the Lightning Network. Future improvements could include but are not limited to:

  • Adding a simple UI.
  • Add the support of different fiat currencies (EUR, JPY, AUD etc).
  • Add a more sophisticated hedging strategy.

Feel free to fork this project or contribute to it. If you have a cool idea on how this could be further developed, head on over to our Discord or Telegram and let us know!

--

--

Kollider

Building new ways to access cryptocurrency markets.