Remix.run Logo
roasbeef 2 hours ago

> Free and open payments should be bitcoin based to be truely decentralized

Agreed. Which is why 5 years ago, I developed L402 (formerly known as LSAT) to fill this very gap:

  * https://github.com/lightninglabs/L402 (https://lightning-labs-2.gitbook.io/lsat)

  * https://lightning.engineering/posts/2020-03-30-lsat/
The x402 protocol as defined uses purely out of band payment verification. This trait makes the "one line of code" to add integration not entirely accurate, as there's still a substantial amount of code needed at both the client and server to verify payment receipt.

L402 is more opinionated as utilizes the Lightning Network (LN) directly within the protocol. The server presents the client with a SHA 256 payment hash embedded within an LN invoice. The server requires the client to present the pre-image for said payment hash. The only way the client can obtain said pre-image is by paying the invoice on the Lightning Network (all payments are conditional payments where a pre-image needs to be revealed to complete a payment).

L402 also adds a layer of macaroons, enabling the protocol handle both payment and fine-grained authentication.

The advantages of LN over something like Coinbase's Base chain include:

  * Privacy: Coinbase and the entire world sees all your transactions. 

  * Decentralization & Reliability: Base is a singleton instance, if it goes down, you can't make any transactions. LN is decentralized, just like the internet, you can always route around failures. 
 
  * Settlement Speed: Base blocks happen every 2 seconds, until that period your transaction isn't finalized. However that's only committing to Base, and not the underlying ETH chain, which has 12 second block time. Latency on LN is primarily a function of e2e network delay, so it can be as little as 100 ms.