Updated 161 days ago

Botanix Lightning Network Trustless Bridge

This project solves the Lightning Network integration problem for Botanix and other BTC-based EVM chains

  • Crypto / Web3
  • Ethereum
  • Bitcoin
  • Infra / API
  • Privacy
  • Crosschain Infrastructure

Description

This is a project to create a trust minimized bridge between Botanix and the Lightning Network. The goal is to allow for the creation of smart contracts that can make trust minimized payments to the Lightning Network. This really only makes sense in the context of chains using Bitcoin as their native currency, but it could be extended to other chains as well. The project includes smart contracts with tests, a frontend, and a Lightning Service Provider (LSP) server which facilitates the lightning payments.

To test the project go to the site and send some sats to a project on https://geyser.fund/

The server is to deny invoices higher than 42 sats or lower than 1 sat for testing purposes.

How it works?

When a user receives a lightning invoice, they create a hash time locked contract HTLC on Botanix which they fund with a BTC amount greater than the invoice amount.

They communicate this information to the LSP server (the invoice and the HTLC id). The server pays the lightning invoice, and thereby recieves the secret pre-image to the lightning invoice (this is how lightning payments work). With the secret pre-image, the server then sweeps the HTLC funds on the Botanix side to be made whole. In the hackathon version, the server does not charge a fee for this service, but in production, a real sever should be charging fees at the very least to rebalance the lightning channels, server costs etc. The server cannot take the HTLC funds without having the lninvoice pre-image, so there is no trust here, and the server cannot run off with the funds without paying the requested invoice.

If the server does not pay the invoice, the user can claw back the funds when the timelock expires.

Main Uses:

  1. Making lightning payments
  2. Not having to run lightning infrastructure
  3. Privacy Onchain, only the hash associated with the preimage of the lninvoice goes onchain. So there's no way for someone to look through the chain and see where that payment went. Also the lightning network has inherent privacy with onion routing. Only the server knows who paid what and to where, but that's 1 person vs. the entire blockchain. And you could, if you really want more privacy, send that money through an ecash mint and anonymize your sats even more.

Frontend Screenshot 2024-03-30 at 14.26.22.png

Architecture Screenshot 2024-03-29 at 22.18.09.png