Comment on page
The LitListenerSDK is designed around the principle of conditionally pre-approved chain reactions with account abstraction.
What are chain reactions?
We call them circuits. Because logically, that's what they are. You have a series of things you want to do in an encrypted and decentralized context. But you shouldn't need to be hovering over those actions to make sure they happen, when and how they are supposed to.
This series of actions encrypted, conditional, often on-chain, can be chained together to trigger complex strategies. Circuits are a simple way to represent them.
Here's a few examples of what you can do with them:
- Supply Chain ManagementYou use the SDK to listen for a smart contract event, signaling when a shipped item has reached its destination (verified by a trusted third-party oracle).If the item ID matches the expected value, the SDK triggers an on-chain function. It releases payment to the supplier, and updates the product's status in the supply chain smart contract.Off-chain, it sends a notification to the end customer informing them that their product has arrived.
- Gaming / CollectiblesAAA web3 games are on the horizon. You can use the SDK to listen for events which herald fully autonomous game worlds. Signaling when a player has achieved a milestone, or found a rare item, is just the start.When events are detected, it can trigger an on-chain function that mints unique NFTs, and assigns them to pre-approved addresses for players or spectators.Off-chain, you can use the SDK to send a notification to players, and update their leaderboard status.
- Web3 Fashion When a new fashion line, or streetwear drop, is released, you can use the SDK to be on the lookout for it ahead of time. Helping you be first in line.It can trigger an on-chain function to place a bid, or make a direct purchase on your behalf, if items in the collection match the pre-approved preferences set by the collector.Off-chain, the SDK can update a collector's virtual wardrobe, or send a notification about the successful score.
- DeFi The circuit you’ve set through the SDK listens for a specific webhook event related to market prices (from a trusted API).When the price of a chosen token satisfies a pre-approved threshold, the SDK fires an on-chain function. It triggers a trade, or a series of them, on a decentralized exchange.The SDK can also be used to set an off-chain function to send notifications to the user, with information about the completed trade.
- Web3 Social Media You can also use the SDK to improve your social media experience. By listening for events related to new posts, new likes, and other activity, from accounts you set as worth following more closely than a default friend or follow button can offer on its own.When a new event is detected, it can trigger an on-chain function to tip a creator with tokens, if the content matches the user's pre-approved interests, or set off more elaborate chain reactions.Off-chain, it can mark a post as 'interacted with' or 'liked' in the user's personalized feed.Bringing programmability to like buttons everywhere, makes the difference between decentralized vs archaic social media as clear and simple as a status update.
And wtf is account abstraction?
Account abstraction is about eliminating confusion. Instead of asking you to juggle terms like "wallets" and "accounts", it presents a simple platform where you can manage your assets, communicate with others, and maintain privacy.
You don't have to learn a new language, just to go online, or touch the grass outside.
Programmable Key Pairs (PKPs)
You can create your own PKPs on Lit Protocol's Chronicle network. PKPs are self-contained tools combining programmable logic (hence the name) with conditional signatures that you can use to approve transactions, and other messages, online. And since almost everything is connected online today, that means IRL too.
What makes PKPs special is that they aren't made or maintained by just one entity. They're the result of teamwork in the Lit network, with multiple nodes contributing a piece of the keys, but no one having the whole thing. It's like everyone has a part of the secret recipe, but no one can make the dish on their own unless they meet the conditions spelled out by your pre-approval.
PKPs are managed by a unique token on the Chronicle network. If your wallet holds this token, you can ask the Lit network to combine the key pieces and sign any transaction or message on your behalf.
And Lit Actions?
In our case, we pair Lit Actions with PKPs to manage our decentralized interactions. This allows us to operate smoothly and securely, without the need to know the nitty-gritty of each task.
Your circuit remains dynamic and responsive through three core condition functions: webhooks, on-chain events, and intervals.
Query and Monitor APIs and Webhooks on the Web: Within the LitListenerSDK, webhooks play a role in connecting your circuit (series of actions) with external web services. The SDK is designed to query (request) and monitor information from specific APIs. In a blockchain context, this might include tracking price changes of a specific cryptocurrency or updates from a decentralized app.
Match Returned Data Against Pre-Defined Operators and Values: The data retrieved through the webhooks is analyzed to see if it meets the predetermined conditions you've set up in your circuit. If the conditions are met, the associated chain reaction is triggered within the LitListenerSDK. For example, if you've set up a condition to listen for a particular token's price reaching a specific threshold, the SDK will trigger the corresponding on-chain action once that condition is met.
Subscribe to On-Chain Events Across Various Blockchain Networks: The LitListenerSDK allows you to set up listeners for specific events occurring on the blockchain, like a contract being executed or a new block being added. By subscribing to these events, you're telling the SDK to keep an eye on particular occurrences within the blockchain networks that are relevant to your circuit.
Match Returned Event Log Data Against Pre-Defined Operators and Values: When one of the subscribed on-chain events occurs, the SDK analyzes the event's data, matching it against your predefined conditions. If there's a match, it will trigger the subsequent actions in the circuit. For instance, if your circuit is set to react to a successful transaction involving a specific NFT, once that transaction occurs, the next steps in the circuit are activated.
Specify the Monitor and Check Frequency for Webhooks and On-Chain Events: Intervals within the LitListenerSDK act as the timing mechanism that governs how frequently the SDK checks the webhooks and on-chain events. By setting intervals, you determine how often the SDK will check for updates in the specified webhooks or on-chain events. If you need real-time reaction, you might set a short interval, whereas a less time-sensitive circuit might have longer intervals.