Hacking on a Lightning swap app

Hacking on a Lightning swap app

The Lightning swap app is one of Alby´s hack projects. Swapping your tokens and cryptocurrencies to Bitcoin and moving into your Alby-connected Lightning wallet is now just a tap away. Users can access this app from the Alby browser extension and top up their connected Lightning wallet through a seamless coin swap. A little but essential building block to grow the ecosystem.


  • An easy way to refuel your Lightning wallet with any coin
  • Only one-way swaps are allowed: Onto the Lightning Network ;-)
  • Keep in mind: It is an experiment!

Why do we need a Lightning swap app?

Receiving bitcoin into your Lightning wallet is still not straightforward for many of us. But there are ways if you do not earn directly bitcoin: Big exchanges such as Kraken or OKcoin offer withdrawals to Lightning wallets after you bought bitcoin with fiat; if you operate your own Lightning Node you can open a Lightning channel using bitcoin and there are so-called swap services that allow you to exchange your tokens and cryptocurrencies to Bitcoin and send it to your Lightning wallet.

Still, the user experience is not ideal as several switches between different apps and devices are required. It has to become easier and it can.

What is the Lightning swap app?

The Lightning swap app is an automated cryptocurrency exchange service built on the FixedFloat API. Registration is not required to complete the exchange. The exchange takes place immediately after receiving the coins and the required number of network confirmations. Read their FAQ here.

While FixedFloat provides support to swap a multitude of cryptocurrencies and tokens directly onto the Lightning Network,  the integration with Alby is something special because it automates the exchange flow even further. Being able to make a smooth coin swap to bitcoin and then use that bitcoin with near-instant transaction speed and negligible fees on the Lightning Network is exciting. And with Alby, the bitcoins you swapped for other coins are immediately available to use on Lightning-enabled apps and websites.

The app uses the Lightning Web Standard (WebLN) to ease the process of coin swaps and to receive bitcoin on the Lightning Network. WebLN is a set of specifications for Lightning apps and client providers to facilitate communication between web apps and users' Lightning wallets in a secure way. The app is just one of many showcases how programmatic interactions between wallets and websites can improve the user experience. No copying and pasting of invoices, QR code scanning, or switching to a mobile phone.

The Lightning swap app was built during a hackathon and has to be considered a prototype in its very early stages. There is a lot of room for improvement and you might come across some errors. If you are reckless enough though, we would love to get you as an early adopter and hear your feedback! 🧡

How to swap your tokens and coins to bitcoin

You can access the app through the Alby browser extension on the ‘Websites’ screen or directly here

  1. Choose the cryptocurrency, the amount you want to swap and click on "Top up"
  2. The Alby browser extension asks you to create an invoice. Click on "Confirm"  
  3. Copy the address and send the indicated amount. To be on the safe side, make sure your transaction is executed within 10 minutes before the order is set on on-hold by FixedFloat.
  4. That´s it. When the swap process is over you will receive bitcoin directly in your Lightning wallet connected to Alby.  

In the background, Alby requests a Lightning invoice from the wallet that you connected to the extension and hands it over to the swap service. All that happens programmatically thanks to WebLN. The coin swap service pays the invoice and sends bitcoin to your Lightning wallet.

The first step toward a more convenient service to top up your wallet

Now you can top up any Lightning wallet that you connected to the Alby extension by swapping a multitude of tokens and coins. And who does not want to hold bitcoin, the most secure cryptocurrency and get rid of other coins?
However, the story continues, as this is the first step towards providing more convenient on ramps and ways to receive bitcoin to top up your Lightning wallet.

Please be aware the app is still experimental. If you want to support further development, we would appreciate your feedback here a lot.

Do you want to build a Lightning web app yourself? Check out the WebLN guide.