Unlocking New Possibilities: Sign and Decrypt within Lit Actions

Read about the latest upgrades to Lit Actions.

Unlocking New Possibilities: Sign and Decrypt within Lit Actions

Lit Protocol, a decentralized network and developer platform for key management and private, immutable compute, has been empowering product teams and developers with the capacity to sign and decrypt using network-managed keys through Lit Actions. Lit Actions are the programs that run within the Lit network.

With this announcement, Lit introduces two powerful new primitives for Lit Actions that provide the ability to compute over private data and send transactions directly from Lit. These features, Decrypt within an Action and Sign within an Action, are available on testnet today. With these methods, developers now have a novel way to interact with the Lit network — specifically, moving operations from the user’s computer to the Lit sealed compute environment. This upgrade unlocks a world of possibilities for building innovative applications, protocols, and agents that prioritize security, privacy, and efficiency.

Prior to this upgrade, all signing and decryption done with Lit followed the following pattern:

With this upgrade, the following is available in addition to the above:

This upgrade does not remove the initial flow for using Lit. It simply adds the second, providing developers greater capacity and, in many cases, removing the need for web3 developers to operate servers. 

The rest of this post will go into more detail on the features, use-cases, and how to get started.

Compute Over Private Data via Decrypt Within an Action

As mentioned, prior to this upgrade, users collected authorizations from the Lit Protocol network and decrypted data on their computer. Now, with the ability to decrypt data within Lit Actions, developers can securely use private data within Lit, without exposing any sensitive data, and then use this data as an input to another operation.For example, this feature allows groups to share secrets, like API keys, which can have their usage governed via smart contract.

Implementation Guide

Send a Transaction to Chain with Sign Within an Action

Prior to this upgrade, users collected authorizations from the Lit Protocol network and combined them on their computer in order to get a transaction signed with their Lit key. Now, this feature provides developers with the ability to sign user transactions within the confines of a Lit, without requiring the use of an application server or user-held key material. For example, this feature can be used to build a highly efficient oracle or cross-chain messenger, where Lit Actions are used to fetch data from pre-determined endpoints (such as a price feed) before writing that information directly to a blockchain. In this example, the consensus for data written to the chain is determined in the Lit Action, removing the need to use gas and a smart contract for this. 

Implementation Guide

Lit Action Composability and Additional Examples

All Lit Actions can be chained together, including "sign within" and "decrypt within" functions, to create sophisticated applications and protocols. For example, a privacy preserving collective trading that let’s users upload encrypted signals to IPFS, have all the inputs decrypted within Lit, and then use that data to drive an AI trading bot. To dive deeper into this upgrade, here are some more examples of products across a few categories where builders are innovating with Lit today:

 AI

Community-Owned AI Agents

  • For any topic-focused community (e.g. research group, fandom), encrypted user data is uploaded to web3 storage (e.g. IPFS, Arweave) from many people. Using Lit Actions, you can decrypt that data within Lit and use it as an input for AI inference. 

Self-Sovereign Labeling

  • Similar to the setup above with encrypted data on web3, but in this case, after decryption, you can label the data within Lit. A Lit key can then be used to write back to web3 storage to associate a clear text description of private data. This process lets users share and sell privately on open marketplaces, while giving data consumers a guarantee about what they are purchasing, without revealing the data.

Identity 

Cross-Platform Social

  • User’s can control and aggregate data from all of their social platforms (including web2) by having the user’s encrypted API key decrypted within Lit and using it to fetch and/or post data.

Privacy Preserving Verification

  • Biometric data and state-issued ID analyzed within the sealed Lit environment to answer questions like, “Is this a unique person?” or  “Is this person over 21?” without revealing underlying details about the individual. This is an example of a proof generation method.

Private Credential Issuance

  • A user requests a verifiable credential and they must prove something about themselves in order to receive the credential, but don’t want to reveal their data to the issuer. The data could be sent to Lit where some logic runs that determines if the user should be issued the credential and then a Lit key can sign and issue the credential.

DeFi

Trading Bots on Subscription 

  • Trading bot developers can give their users a bot that has its own noncustodial key and allow users to modify the bot’s instructions, without revealing the underlying algorithm. In this example, the logic for the trading bot is encrypted within a Lit Action. When a user subscribes (pays) to the platform, that logic gets decrypted (within a Lit Action) and used to power trades on behalf of that user.

Automated CEX / DEX Arbitrage

  • Decrypting a CEX API key within Lit can enable the Lit Action to buy and sell tokens on a CEX or DEX, with the ability to use on and off-chain data to determine pricing and slippage.

Stop-Loss Orders on DEXs

  • Lit Actions can be used to create private stop-loss orders on a DEX. The order  details would get decrypted within a Lit Action and when the trigger price is hit, the assets would be automatically sold.

Gaming

Autonomous, On-Chain NPCs

  • Non-playable characters, like a shopkeeper, can use off-chain data in an on-chain game since logic and signing can all execute within Lit, without the game developer having to run a server or manage a key material.

On-Chain Card Games, like Poker

  • Players' hands are encrypted and stored on-chain. When a player wants to make a move (e.g., bet, call, fold), they initiate an Action which would decrypt all the player hands within Lit, run the game logic, and then update the outcome and game state back on chain. A Lit Action could also be used to distribute the pot.

Dynamic NFTs

  • Use signing within actions to dynamically update NFT attributes based on game achievements or external data, without compromising the security of the NFT's ownership.

Web3 Infrastructure 

Smart Contract Oracle

  • Use Lit to read from a trusted data source, for pricing data or anything else, and then write the results to blockchain. This method can also be used for private personal data, like fiat bank account balances, where a proof about the bank account information is generated and written to the chain, without revealing the underlying information. 

Cross-Chain Messaging

APIs with On-Chain Control

  • Encrypt an API, for something like Claude, and then allow users to send inputs to that service with rate limiting and usage governed by smart contract-based rules and roles.

 Secure Randomness

  • Run an action to generate a random number and then use Sign within an Action to write the result to the chain.

It’s Time to Build

With the introduction of Sign Within an Action and Decrypt Within an Action, Lit Protocol has unlocked a new realm of possibilities for developers. With these capabilities, creators are building innovative, secure, and privacy-focused applications that are shaping the future of digital ownership. 

Now live on the Cayenne testnet, these new features are ready for developers to explore and experiment with. Additionally, Lit will be a sponsor in the upcoming HackFS hackathon and there'll be $10k in prizes up for grabs for those building with these new features. Check out the official announcement post to learn more. 

To start building the next generation of Web3 applications, head over to the Lit Protocol developer docs. If you have any questions or need assistance, you can reach out to the team in Discord.

It is time to Free The Web!