Lit Protocol x Solana
Use Lit for Transaction Automation and Private Data on Solana
Solana's high throughput, low fees, and robust developer tools make it a leading platform for dApp development. By integrating Lit Protocol's programmable signing and encryption capabilities, developers can simplify onboarding and wallet creation, automate transactions on Solana and trigger cross-chain events, and enforce access control for decrypting private data. Integrating Lit not only streamlines user experience, but can also significantly enhance security in your dApp.
Signing Transactions with Wrapped Keys
Lit Protocol's Wrapped Keys feature lets users instantly create non-custodial, programmable wallets on Solana or any other chain without managing key material themselves.
Wrapped Keys are threshold encrypted private keys that are decrypted within Lit to create signatures. As a result, key material is never exposed in cleartext to anyone, even during the signing process.
Users can authenticate to use their wrapped keys using familiar web2 services like Google and Discord OAuth, or through a Sign In With Solana (SIWS) message, eliminating the need for you or your users to manage private keys directly.
Programmable Signing with Lit Actions
Developers can add programmability to Solana Wrapped Keys by incorporating Lit Actions. Lit Actions are JavaScript programs that allow developers to define custom logic for transaction signing and access control management. They can be triggered by users or by automated infrastructure, are executed off-chain within the trusted execution environment (TEE) of each Lit node, and can access on-chain state and off-chain data via HTTP requests to determine when conditions are met.
How Lit Actions Work with Wrapped Keys
- Define Custom Logic: Specify the exact conditions under which a Wrapped Key is permitted to sign a transaction. This can include checks based on Solana's on-chain state, such as token balances, NFT ownership, or smart contract conditions, as well as any off-chain data that is accessible via HTTP requests.
- Secure Execution: The Lit Action runs within Lit’s secret management network, ensuring that the execution environment is both secure and private.
- Automated Signing: When the conditions defined in the Lit Action are met, the Wrapped Key will automatically sign the transaction. You can optionally configure the Lit Action to broadcast the signed transaction to the Solana network when your conditions are met.
Encryption and Decryption with Lit Protocol
In addition to programmable transaction signing, Lit Protocol enables secure data encryption and decryption for your Solana dApp. By leveraging Lit’s threshold MPC keys, you can encrypt data and set custom access control conditions that determine when and under what circumstances decryption will be permitted. Similar to programmable transaction signing, these conditions can consist of both on-chain data and off-chain data accessible via generic HTTP requests.
Decryption can occur client-side for use cases where data is intended to exist only on the client's device. Access control conditions can also be set to allow decryption within a Lit Action, allowing for secure computing using the private data only within a Lit node's Trusted Execution Environment (TEE).
How Encryption and Decryption Work with Lit Protocol
- Encrypt Data: Use Lit's SDK to perform encryption server-side or client-side.
- Define Access Control Conditions: Set up conditions that must be met for the data to be decrypted. These conditions can be based on Solana's on-chain state --such as token balances, NFT ownership, or specific smart contract conditions --as well as any off-chain data.
- Secure Decryption:
- Client-Side Decryption: When a user attempts to decrypt the data on their device, the Lit network evaluates the access control conditions. If the conditions are met, the Lit network retrieves the decryption shares from each Lit node and returns them to the client, allowing the data to be decrypted locally.
- Decryption within Lit Actions: Alternatively, you can perform decryption within a Lit Action running within a Lit node’s TEE. This is useful for scenarios where the decrypted data should not be exposed outside of a sealed and confidential compute environment. The Lit Action will process the decrypted data based on your conditions and return only the relevant results to the client.
Solana x Lit Protocol Products
Genius - One-Click Cross-Chain Swaps
Genius is a DeFi super-app aiming to redefine how users interact with digital assets on Solana and other chains. Using Genius, you can swap a token on Arbitrum for a meme coin on Solana in a single click without interacting with a bridge or worrying about gas tokens.
How Genius Utilizes Lit Protocol:
- Familiar Onboarding: Users can sign in using familiar authentication methods like web2 OAuth, eliminating the need to manage seed phrases or private keys.
- Programmable Key Pairs (PKPs): PKPs serve as 'orchestrator' accounts that route liquidity between smart contract vaults deployed on supported chains.
- Lit Actions for Transaction Logic: Lit Actions verify and approve transaction logic based on predefined conditions and cross-blockchain events, ensuring secure and automated cross-chain operations.
By integrating Lit Protocol's PKPs and Lit Actions, Genius offers a seamless and secure cross-chain swapping experience, simplifying DeFi interactions and enhancing user convenience.
Bonny - Secure and Rewarding Private Data Sharing
Bonny is a platform that rewards users for uploading and sharing their personal spending habits. By supporting receipt uploads from physical purchases, Bonny compensates users with crypto tokens whenever their anonymized data is shared with companies and data brokers.
How Bonny Utilizes Lit Protocol:
- Encryption and Access Control: Bonny uses Lit Protocol for robust encryption and access control management, ensuring that only permitted parties can access user data.
By integrating Lit Protocol, Bonny enhances data security and user privacy while providing a seamless and rewarding experience for its users.
Chakra: Secure On-Chain File Storage with Lit Protocol
Chakra offers users the ability to save files on-chain for free with end-to-end encryption, powered by Irys and Lit Protocol. Designed with user sovereignty in mind, Chakra ensures that you have full control over your data.
How Chakra Utilizes Lit Protocol:
- End-to-End Encryption: Chakra employs Lit Protocol's encryption capabilities to allow users to securely encrypt files without managing encryption keys themselves.
- Access Control Management: Utilizing Lit's access control features, users can define who can access their files, sharing content publicly or privately to specific Solana public keys.
By integrating Lit Protocol's encryption and access control, Chakra provides a secure and user-friendly solution for on-chain file storage and sharing, enhancing privacy and user experience on Solana.
Getting Started with Lit
Install the Lit SDK
Set up the Lit SDK in your project by following the installation guide. This will provide you with the tools needed to interact with the Lit network and implement its features.
Authenticate with the Lit Network
Implement session signatures to facilitate secure, temporary interactions with the Lit network from your dApp. Session signatures enable users to perform actions without repeatedly signing messages. Use this guide to learn more.
Learn About Wrapped Keys
Read the Wrapped Keys overview to grasp how you can use Lit to enable programmable signing and encryption without exposing private keys.
Explore Lit Actions
Visit the Lit Actions documentation to learn how you can use Lit Actions to define custom logic for transaction signing, encryption, and access control.
Integrating Lit Protocol with Solana
Authenticate SIWS Messages with Lit Actions
Learn how to authenticate users on Solana using Phantom’s Sign In With Solana (SIWS) specification within Lit Actions. Follow this guide to implement SIWS authentication for your dApp.
Generate Session Signatures Using SIWS Messages
Generate Session Signatures using Lit Actions and SIWS messages to implement custom authentication and authorization logic to control when and how session signatures are generated for your users. Learn how by following this guide.
Encrypt and Decrypt Data Using SIWS Messages
Secure sensitive information by encrypting data and controlling who can decrypt it using SIWS messages. This ensures that data is only accessible to users who meet specific conditions. Implement data encryption and decryption by following this guide.
Explore Other Solana Access Control Conditions
Learn how to harness Solana events and data to create complex access rules to secure access to your private data. Use this guide to discover other ways to implement access control.