Blog
Harnessing Lightning Network for AI Innovation - Pt 2

Harnessing Lightning Network for AI Innovation - Pt 2

Lorenzo
Lorenzo

August 15, 2023

Inspired by Hivemind’s thesis on “How (Actually) Open AI Wins,” this series will explore how AI companies and projects can harness the power of the Lightning Network to push innovation and what tools builders can use to build this future.

AI Agents

An AI (Artificial Intelligence) agent can be considered a digital assistant or robot that can make decisions and take actions to achieve specific goals. These goals can be anything from winning a game of chess to recognizing and tagging images to driving a car.

An AI agent works by gathering information about its environment through sensors (which can be anything from cameras to data inputs, to internet crawlers), processing this information to understand the current situation, making decisions based on what it knows, and then acting on those decisions.

For example, a self-driving car AI agent collects information from cameras, radar, and other sensors. It processes this information to understand its surroundings, like where other cars are, what the traffic signals are showing, and so on. Then, it makes decisions, such as when to speed up, slow down, turn, etc. Finally, it acts on those decisions to control the car's movements.

Thinking outside the box

Currently, AI agents are trapped inside their environments. For instance, agents that act on the Internet can’t use paid services. They are like skilled violinists playing only simple nursery rhymes. We’ll only hear the symphonies when these AI agents can communicate with other services and with each other. But there’s a problem: there’s no free lunch.

This is already a reality of software today. When applications need to “talk” to external services, like Twitter, they do it through an API. You can think of an API just like an app but for computer programs instead of humans. Usually, APIs will charge a price to access the data they provide. This is the internet version of walled gardens. According to the Silicon Valley Business Journal, Uber paid roughly $53,000 daily to google maps between 2016 and 2018.

AI agents paying with Lightning Network

If AI agents were to start interacting with paid services, how would they pay for these services? Bank accounts seem like a far-fetched solution. This is a technology designed by humans. How would an agent prove its identity or address, for instance?

There’s room for the legacy banking system to improve its tech to adapt to this new paradigm. Still, if this were to happen, it’ll not happen as fast as innovation in agents technology is happening. You can be sure that developers won’t wait for the legacy banking system to catch up.

This is where Bitcoin and the Lightning Network fit in. Bitcoin is already native money for the internet. Furthermore, Bitcoin doesn't have a concept of accounts or identities. Instead, it uses a wallet mechanism, simply grouping pairs of public and private keys. This can be used out of the box by an AI agent.

Therefore, service providers could charge Bitcoin via Lightning to grant access to their data and services. If they’re not interested in being paid with Bitcoin, they could seamlessly convert to traditional fiat currencies through a point of sale that integrate with Bitcoin and provide on/off ramps. Lightning could be used just as the “rails” for the payment, with both ends – the agent and the service provider – operating in their native currencies. This can be extremely useful when dealing with payments across different jurisdictions.

Microtransactions for AI business models

The capacity of Lightning to manage microtransactions can pave the way for new, viable business models. This contrasts with traditional models structured around credit card-based monthly billing cycles. Instead of paying monthly, the Lightning Network could be used in a pay-per-use model. This can make these services more accessible, particularly for AI agents requiring small-scale data or services access.

Lightning’s speed and scalability provide significant advantages for AI agents. The ability to complete payments at an internet connection speed and conduct thousands of transactions per minute means that AI agents can swiftly respond to and interact with their environment.

This can be particularly beneficial when they need to make frequent microtransactions, for example, to access or use data or services on the internet. This efficiency and fluidity could ultimately lead to a more seamless and productive operation of AI agents, potentially unlocking new use cases and capabilities.

Lightning payments can serve as an effective spam prevention measure for AI agents. If every action taken has an associated cost, AI agents are intrinsically regulated by the limited scarcity of Bitcoin. In other words, the necessity to pay for each action discourages indiscriminate activity or 'spamming' on online services.

This built-in mechanism curbs excessive behaviors and promotes more intentional and meaningful actions from AI agents on the internet. Consequently, it ensures an orderly and balanced digital ecosystem where AI agents interact sustainably and resource-consciously.

402 – The forgotten HTTP status code

HTTP, or Hypertext Transfer Protocol, is like the internet language, enabling computers to talk to each other. Imagine it as a courier service. When you send a request to view a website, it's like you're sending a letter (the request) via this courier. The website server receives this letter, reads it, and sends back a response, much like a return letter. The "status code" is like a quick note on the envelope, telling you at a glance what happened with your request. For instance, the infamous 404 status code is used when the requested page isn't located. You've likely encountered this one during your internet browsing.

Interestingly, the 402 status code holds a unique tale in the chronicles of the internet. Introduced back in 1997, this code was designed with the intent of representing "Payment Required". Despite its early inception, the 402 code was largely forgotten, as there were no appropriate mechanisms for its intended use. Fast-forward to the present, with the rise of technologies like Bitcoin and the Lightning Network, the 402 code is poised for a revival, potentially reshaping the online economic landscape.

This is most likely how service providers will leverage this approach to charge for access to their data and services, regardless of whether it's a human or an AI agent making the request. Upon receiving a 402 response from a server, an invoice could be included within the response body. The requesting entity would then fulfill the payment to gain the necessary access. Lighting Labs is working on a protocol to make charging satoshis for API requests easy. It’s called L402, and you can look at it here.

Concluding

As we dive into artificial intelligence and the Lightning Network, we find new potentials and solutions to current challenges. Currently limited by the inability to interact with paid services, AI agents can harness the power of Bitcoin and the Lightning Network. This offers a feasible payment system and opens doors to new business models, with microtransactions at their heart.

Moreover, the Lightning Network could effectively guard against AI-driven spamming, ensuring a balanced digital ecosystem. In an exciting twist, the largely forgotten HTTP 402 status code from 1997, which signifies "Payment Required", gains new relevance in this landscape.

As we move forward, Lightning Labs is crafting a protocol, L402, for charging satoshis for API requests. A peek into the future hints at more connected, efficient, and innovative prospects. So, stay tuned as we further unravel the possibilities of AI and the Lightning Network. 

In our upcoming installment of this series, we'll dive further into the technologies being crafted to realize the potential use cases we've discussed thus far. Be sure to stay connected and subscribe to our newsletter for insights on how to shape the future with Lightning and AI.


If you are exploring building in AI and want to easily integrate the Lightning Network, check out our dashboard, spin up your lightning node, and easily get your first channel of inbound liquidity on our LSP Flow.

Share this post

Start Building on Bitcoin Now