Transcription: OpenAgents Episode 062 - Exploring L402
June 9, 2026 ยท View on GitHub
Source: https://twitter.com/OpenAgentsInc/status/1750729304504213964 Wiki source: https://raw.githubusercontent.com/wiki/OpenAgentsInc/openagents/Video-Series.md Media title: OpenAgents - Episode 062: Exploring L402 We learn about L402, the bitcoin-powered ... Upload date: 20240126 Transcription model: mlx-whisper/mlx-community/whisper-tiny Generated at: 2026-06-01T20:03:54Z
Machine-generated transcript. Review speaker labels and wording before using this as quote-grade source material.
[00:00] Christopher David: Whoo! Have I got a treat for you? Not only are we gonna dive into the wonderful world of AI agent payments with Bitcoin
[00:08] Christopher David: You also get to watch me struggle on my new Linux desktop
[00:13] Christopher David: Using meovem oh my gosh. It's so scary
[00:17] Christopher David: Let's try to not make complete fools of ourselves. Okay in this video we're exploring L402
[00:24] Christopher David: Which is the lightning HTTP 402 protocol aka payment required the missing
[00:32] Christopher David: HTTP code of the internet the internet used to be
[00:36] Christopher David: Designed in mine if there would be payments they like skipped over that and never got around to it
[00:41] Christopher David: But we have this error code 402 for payment required that the fine people at lightning labs have kind of filled in
[00:50] Christopher David: So we're gonna take a quick spin through these docs and then we're going to work through an example in the sullu
[00:58] Christopher David: Solutions dock if I can find the right there we go
[01:03] Christopher David: This is a start up we're working with to implement and make
[01:09] Christopher David: L402 integration easy
[01:12] Christopher David: So in this video we really want to just kind of get familiar with the basics of L402 get all on the same page
[01:20] Christopher David: And play around with some of the examples here and start to make a plan for how we're going to integrate this into the agents on
[01:29] Christopher David: Open agents
[01:31] Christopher David: We can and may end up doing like extremely basic
[01:35] Christopher David: You know initial versions of the agent payments that are just us updating the
[01:41] Christopher David: Database entry in our database of what agent has what balance and then let the agent owner with draw those shots
[01:49] Christopher David: Their choice
[01:51] Christopher David: That would be like okay at the basic level, but if this is achievable for us to maybe even just skip past that and
[01:57] Christopher David: Implement straight L402 from the beginning
[02:00] Christopher David: Maybe we'll have both tracks available. I don't know entirely, but
[02:04] Christopher David: The idea is that agents are gonna have their own
[02:08] Christopher David: Wallets their own Bitcoin balance and that they're going to be able to
[02:12] Christopher David: Transact in any paid endpoints around the internet and the like increasing amount of
[02:18] Christopher David: API endpoints that are going behind these L402 paywalls
[02:25] Christopher David: And we also want there to be APIs like an API endpoint associated with each agent
[02:32] Christopher David: So that someone can trigger agent to work flows doing nothing but just paying for the
[02:39] Christopher David: The compute or the run in advance so people won't need to have accounts with open agents
[02:44] Christopher David: We won't need to know who they are if you're paying for it. You should get you know access to the service
[02:51] Christopher David: So let's take a spin through some of these docs here
[02:57] Christopher David: L402 lightning HTTP
[03:00] Christopher David: 402 protocol. It's just take a quick look through here lightning API keys cleverly combine
[03:05] Christopher David: The capabilities of macarons with that of a lightning payment making it easy to charge Satoshi's
[03:11] Christopher David: Smalls
[03:13] Christopher David: Did I want to be going for API requests L402 formally known as LSAT is a standard to support the use case of charging for services and
[03:21] Christopher David: authenticating users in distributed networks. It combines the strengths of macarons basically a little permission
[03:27] Christopher David: Tokens for a better authentication with the strengths of the lightning that work for better payments
[03:32] Christopher David: apertures an implementation of the standard
[03:35] Christopher David: do do do
[03:38] Christopher David: Now I believe there is a official specification
[03:44] Christopher David: and
[03:54] Christopher David: I think there's also a GitHub L402 lightning spec
[03:59] Christopher David: Yeah
[04:02] Christopher David: Okay, so L402 is a standard designed to support the use case of charging for services and authenticating users
[04:12] Christopher David: In distributed networks developed by lightning labs it combines the strengths of macarons for better authentication and the strengths of the lightning
[04:17] Christopher David: ever. Okay, so we read that
[04:20] Christopher David: But but making it easy to charge amounts of any size for an API request web page or resource
[04:26] Christopher David: Okay, so the specification and some links are on this is like the official
[04:36] Christopher David: Protocol spec, lightning labs L402
[04:40] Christopher David: Good little summary tweet more people are now started to talk about a high agent speed
[04:47] Christopher David: Logical to use Bitcoin is the C20 lightning labs Bitcoin the internet's native currency will be the currency of choice for a agents the L402 protocol will be there
[04:56] Christopher David: Programmatic gateway to the world's paid APIs and commerce with other agents
[05:02] Christopher David: I am so excited about this being able to get multiple agents transacted with each other
[05:08] Christopher David: And let's see here AI for all powering APIs and large language models with lightning
[05:15] Christopher David: Today we're excited to announce the release of a new set of developer tools to enable the lightning and AI developer communities to build global
[05:21] Christopher David: Inclusive and out of the box cost effective LL and tooling which seamlessly incorporates lightning and Bitcoin
[05:27] Christopher David: These tools are built on the L40 protocol a lightning native authentication mechanism and
[05:32] Christopher David: Langchain a popular library to simplify working with AI agents by adding external data to allow for more advanced functionality
[05:39] Christopher David: Okay, so this is cool because you know people use Langchain and we've been
[05:44] Christopher David: Intentional in this video series about kind of building up our own
[05:48] Christopher David: Agent abstractions from scratch over the last two months
[05:51] Christopher David: But it'll be great to potentially harvest some of these
[05:55] Christopher David: Integrations with Langchain for code and or sort of architecture that can maybe help guide
[06:02] Christopher David: Our integration using our simpler better maybe abstractions. Okay aperture reverse proxy server blah
[06:12] Christopher David: L40 to belip Bitcoin lightning improvement purpose proposal spec for the L40 protocol standard
[06:20] Christopher David: The L40 to standard directly supports the use case of charging for services and authenticating users in distributed networks
[06:26] Christopher David: L40 to combines the authentication functionality of macarons
[06:29] Christopher David: Which are authentication mechanisms for distributed systems that don't require access to a central database
[06:35] Christopher David: And the global permissionless payment of the lightning network to deliver the ability to authenticate and charge per use of
[06:41] Christopher David: Internet native services EGA
[06:44] Christopher David: At the time of creation of the internet when the forward to error was included these micro payments were not possible
[06:49] Christopher David: But with the L42 protocol and Bitcoin these long ignored status responses can be utilized to build the machine payable
[06:56] Christopher David: Web of the future powered by lightning
[06:58] Christopher David: With the tools we're releasing today developers will be able to build more accessible AI infrastructure for both humans and agent alike
[07:04] Christopher David: And the time to build is now did did did do do
[07:12] Christopher David: Recooping costs
[07:14] Christopher David: Organisms can't get beyond it coins a logical thing that they'll use L42 aware Langchain agents
[07:24] Christopher David: Langchain is the most popular library used to create AI agents capable of task for now
[07:31] Christopher David: Ha ha ha
[07:32] Christopher David: blah blah blah blah for O2 wrapper
[07:36] Christopher David: Okay
[07:37] Christopher David: So for people that are like familiar and comfortable with Langchain this is specifically worth looking at him
[07:44] Christopher David: This is kind of like a
[07:46] Christopher David: 7 month old blog post at this point, but it's still you know
[07:50] Christopher David: There's stuff that integrates with Langchain but
[07:54] Christopher David: Let's
[07:57] Christopher David: Let's pop over to Sulu. This is these guys are
[08:02] Christopher David: Working specifically to make it as easy as possible to
[08:07] Christopher David: Put API endpoints behind L42 paywalls and just make everything around L40 too easy because you know reading a spec an implementing it is not
[08:18] Christopher David: Easy sometimes
[08:20] Christopher David: So let's learn a bit about Sulu
[08:23] Christopher David: I mentioned this in power API providers and consumers by leveraging the L42 protocol a cutting-edge technology designed for the future of API monetization
[08:35] Christopher David: For protocol that the do comprehensive tools for both API providers you can do much to engage with the APIs
[08:42] Christopher David: And a marketplace for listing and discovering APIs
[08:47] Christopher David: We'll have probably some
[08:49] Christopher David: Integration with Sulu we were talking about maybe having them right
[08:55] Christopher David: An ex-tism plug-in for sort of generic usage of L42s and just have that be kind of the main
[09:01] Christopher David: I don't know plug-in that we use for that
[09:04] Christopher David: Not sure yet so
[09:08] Christopher David: basics of L42
[09:10] Christopher David: API consumer gets API endpoints we say request repayment there's a proof of payment success
[09:23] Christopher David: After a lightning transaction
[09:28] Christopher David: Okay, so this is good to step through so number one is issuance of macron and invoice
[09:34] Christopher David: The service provider issues a macron which includes a specific payment hash along with the corresponding lightning network invoice
[09:43] Christopher David: So that's as part of this forward to request repayment so you try to hit the endpoints like no you got to pay here's the invoice
[09:50] Christopher David: Upon successful payment of the invoice and when you receive when you make a
[09:53] Christopher David: Payment a lightning payment you get back a pre-image it's basically like proof of payment that's right there
[10:04] Christopher David: Cryptographed parameters. Okay activation of light and API key the user combines the received pre-image with the initially issued macron
[10:11] Christopher David: This combination activates the macron turning it into a valid lightning API key
[10:15] Christopher David: Presentation for service access the user presents this activated lightning API key to the service provider in order to gain access to the service
[10:23] Christopher David: Six verification by service provider the service provider verifies the integrity of the macron and checks the embedded payment hash against the provided pre-image
[10:31] Christopher David: This step confirms both the users identity and the completion of the payment
[10:36] Christopher David: Access granted upon successful verification users granted access to their quest service completing the transaction process
[10:43] Christopher David: Qil
[10:45] Christopher David: pre-image in hex macron basis before
[10:50] Christopher David: Did do do
[10:53] Christopher David: So
[10:59] Christopher David: Provides a reverse proxy serving as a bridge between API providers and consumers
[11:06] Christopher David: Cool, okay, so let's check out a demo
[11:16] Christopher David: I don't have my alby wallets on this computer, but
[11:22] Christopher David: It might be cool to see the flow
[11:25] Christopher David: Stepping through from scratch
[11:32] Christopher David: My wallet is on my phone. We'll figure it out
[11:36] Christopher David: Okay, so let's do this we first send a data request to the random number API
[11:40] Christopher David: This is an L 402 API so we will get a 402 request for payment error
[11:46] Christopher David: this
[11:47] Christopher David: 402 payment required error includes a macron and the lightning invoice in the authorization header
[11:54] Christopher David: I just hit one key stroke to open my terminal how cool am I oops that's the wrong thing ready?
[12:01] Christopher David: Okay, what do we have here
[12:07] Christopher David: Got a bunch of nice curl data
[12:12] Christopher David: Do do do do
[12:17] Christopher David: Do
[12:24] Christopher David: Allow headers authorization metadata macron double double authenticates
[12:34] Christopher David: All right here we go, WWW authenticate colon L42 macron is there you go
[12:42] Christopher David: invoice is
[12:44] Christopher David: This is just an HTTP server saying fuck you pay me
[12:49] Christopher David: Nice
[12:53] Christopher David: Okay
[12:55] Christopher David: The macron serves as our key to access the desire to information for the API it functions as a digital token
[13:01] Christopher David: informing me API about the permissions grad did upon paying the invoice
[13:06] Christopher David: It encapsulates the access it grants and can be constrained by including path restrictions and additional
[13:12] Christopher David: limitations within its string representation as long as the macron remains valid and hasn't expired
[13:18] Christopher David: It can be used to access the paid services
[13:20] Christopher David: However the macron is only valid if the lightning invoice that accompanies it is paid
[13:25] Christopher David: We attach proof of payment in the form of a pre-image
[13:29] Christopher David: Pay the lightning invoice using a digital wallet that reveals the pre-image as
[13:34] Christopher David: proof
[13:36] Christopher David: Once the lightning invoice has been paid
[13:38] Christopher David: Now we put together the L42 token using the macron and the pre-image in the following format
[13:47] Christopher David: Okay, well, let me
[13:51] Christopher David: Try
[13:52] Christopher David: Hopefully without too much difficulty logging into albe on this new computer
[14:00] Christopher David: And
[14:00] Christopher David: Paying and let's see if we can grab that pre-image now the demos that we're gonna do in a second are gonna use the like
[14:07] Christopher David: Built in
[14:09] Christopher David: version that I'll pop it open from
[14:13] Christopher David: our
[14:15] Christopher David: Browser so I only need to like paste in the pre-image it'll all be nice please click on the object
[14:21] Christopher David: Commonly found inside the example object
[14:27] Christopher David: Well, what if I have a home for bears?
[14:31] Christopher David: So
[14:37] Christopher David: Oh
[14:54] Christopher David: Okay, so I got a little bit of money here. Let's try pasting in the invoice from the curl quest
[15:05] Christopher David: Paste
[15:07] Christopher David: Ten sats I can afford that approximately one penny pay now
[15:13] Christopher David: Show details pre-image
[15:18] Christopher David: If I can remember my copy okay, so what's next?
[15:23] Christopher David: Assembly of R2 token now we put together the L42 token using the macron and the pre-image
[15:30] Christopher David: Okay, please enter the pre-image
[15:32] Christopher David: Today now
[15:39] Christopher David: Make an authorized request is anything else I needed in here
[15:46] Christopher David: Oh, I see what's supposed to do this first
[15:52] Christopher David: Let's see if we can do it oops
[15:55] Christopher David: Not shit. Okay, so it did that one
[16:03] Christopher David: But I want to
[16:05] Christopher David: All right, all right, I'll pay this one
[16:09] Christopher David: Copy there
[16:13] Christopher David: Payments and boom
[16:20] Christopher David: Pre-image
[16:22] Christopher David: Copy
[16:25] Christopher David: Now
[16:28] Christopher David: Put that there
[16:32] Christopher David: Then I will fetch with L42
[16:36] Christopher David: Successfully generated a random number number 289, but a bit of a bit of a bit of a
[16:43] Christopher David: Out of curiosity can I try to get that
[16:49] Christopher David: the
[16:51] Christopher David: Curl on this one
[17:01] Christopher David: Let me see it
[17:10] Christopher David: Give me
[17:17] Christopher David: All right, whatever
[17:22] Christopher David: Okay, so that works fine. I just can't copy it from there. Oh well
[17:37] Christopher David: Do do do now let's see
[17:40] Christopher David: What this is right number 8b
[17:43] Christopher David: Simpline the first new eight of us leave random numbers
[17:51] Christopher David: Now we have sample JavaScript code using alb's fetch with L42 tool
[17:57] Christopher David: To consume the random number API and drop your application you can use the fetch with L42 function provided by alitools
[18:03] Christopher David: This function simplifies the process of making authenticator requests to APIs that use the L42 authentication scheme
[18:09] Christopher David: Below sample code snippet demonstrating how to make a request
[18:21] Christopher David: How
[18:27] Christopher David: Web LN is missing in this case. It's expecting me to have the browser console
[18:35] Christopher David: Browser extension
[18:38] Christopher David: But you know what it might be instructive to actually just set that up from scratch. So let's do that. I am not even installed chrome on this computer so
[18:47] Christopher David: Let's do it
[18:51] Christopher David: It might work on something other than chrome. I'll be extension
[19:10] Christopher David: Chrome webstore
[19:15] Christopher David: Is anywhere else
[19:21] Christopher David: Oh
[19:28] Christopher David: Fire fox let's try the Firefox
[19:33] Christopher David: Extension which I've never done
[19:35] Christopher David: Cool I have an alb account
[19:59] Christopher David: pin your albexstension pin nice
[20:06] Christopher David: heo there's my money okay
[20:10] Christopher David: and you can do not turn much apps it's cool if you've not used albe i definitely
[20:14] Christopher David: recommend okay so chrome you can fuck off okay let's try
[20:20] Christopher David: doing this again do i see the webln thing
[20:25] Christopher David: my down
[20:27] Christopher David: fetched out for two
[20:29] Christopher David: u.a. pops up connect to webln do i want to connect to do doxulu sure
[20:34] Christopher David: out of the website to
[20:36] Christopher David: request approval for transactions
[20:38] Christopher David: request invoices and lighting information sounds good
[20:42] Christopher David: what i do a pre-painment for ten sets
[20:45] Christopher David: yes i would you can do remember and set a budget if you don't want to keep prompting you
[20:50] Christopher David: eat up to a certain
[20:52] Christopher David: uh... it's been
[20:55] Christopher David: received data boom
[20:57] Christopher David: so and then i got a little uh... to keep some there okay that's really great
[21:02] Christopher David: um...
[21:07] Christopher David: that's really great
[21:08] Christopher David: um...
[21:09] Christopher David: now that's really great for humans
[21:15] Christopher David: uh...
[21:15] Christopher David: our a.a.s.
[21:18] Christopher David: could have a browser extension
[21:21] Christopher David: could be steering a browser
[21:23] Christopher David: uh... but lets maybe assume
[21:26] Christopher David: that they aren't
[21:29] Christopher David: uh... first let's take a look at weatherman what does this do
[21:46] Christopher David: payment required
[21:52] Christopher David: um... i think they have an actual page
[22:09] Christopher David: whether in Austin Texas
[22:15] Christopher David: boom
[22:17] Christopher David: fifty sets all right take it
[22:21] Christopher David: uh...
[22:23] Christopher David: self-seus
[22:25] Christopher David: i don't know what this is
[22:28] Christopher David: that's all
[22:30] Christopher David: okay so that works
[22:33] Christopher David: nice
[22:38] Christopher David: just out of curiosity just because i like given chat jibbitty some stuff stuff to do with some point
[22:44] Christopher David: uh... just like try something just come here
[22:48] Christopher David: and let's just say uh...
[22:51] Christopher David: here's an app it's great for humans but what if
[22:56] Christopher David: i'm an a.a.e.g. and i don't have a browser extension or webln
[23:02] Christopher David: how can i pay for the weather
[23:15] Christopher David: okay yeah i'm a little facet just with it we don't need the a.a.g. and tinnerex
[23:29] Christopher David: but the browser they'll be able to just do straight up uh... back in api calls the handshake of the
[23:36] Christopher David: like elphotu it's just your
[23:40] Christopher David: hand-picking and end point you're getting back air for a two you make a payment
[23:47] Christopher David: um...
[23:48] Christopher David: you get back the
[23:50] Christopher David: uh... data that you are a question
[23:53] Christopher David: okay so um... we'll leave that there for now
[23:56] Christopher David: uh... in the future video maybe night and night's video will speck out like how to actually apply this to open agents
[24:03] Christopher David: and we'll get our whiteboard out and kind of uh... maybe do some architectural
[24:09] Christopher David: raming um... and just because you know you probably like really wanted to see me
[24:16] Christopher David: do some them i got stuck in here you know they they say you know the meme is you get stuck in
[24:21] Christopher David: me and then you can't get out and was like ha ha noobs but with this neo tree thing i was i was getting stuck again
[24:28] Christopher David: i was like you know cue actually wait for a while and i get out um...
[24:34] Christopher David: you get the cue a to quit all okay anyway that's your vim lesson for the day
[24:40] Christopher David: uh... thanks for falling along thanks for dealing with my new computer here and uh...
[24:44] Christopher David: let's do some l four two open agents architecture in the next video
[24:48] Christopher David: see you