pull down to refresh
0 sats \ 1 reply \ @160ed04091 1 Jul \ on: L402: internet-native paywalls builders
How are internet-native paywalls implemented?
For a detailed flow chart, you can check the main page but here's the TL;DR version:
-
The client requests an HTTP resource.
-
The server checks if the client is authorized to access the resource (authentication + authorization + payment).
-
If payment is required, the server responds with a 402 (Payment Required) error code, including credentials and a challenge in the HTTP response headers.
-
The client solves the challenge and obtains proof of completion.
-
The client requests the same HTTP resource again, this time including the credentials and proof of completion in the authentication headers.
-
The server validates the client's credentials and the completed challenge.
-
The server processes the request and serves the HTTP resource.
Currently, the credentials are Macaroons (a type of cookie), and the challenge is a Lightning invoice (proof of completion is the preimage).
You can check out the full flow with code in our notebook tutorial:
reply