Hacking on Lit: ETHOnline 2024
Your guide to hacking on Lit during ETHOnline 2024.
Your guide to hacking on Lit during ETHOnline 2024.
What is Lit Protocol?
Lit is a decentralized key management and sealed compute network. Builders of apps, wallets, protocols, and AI agents use Lit to advance digital ownership with decentralized keys and private, immutable programs.
Lit provides web3 builders with advanced cryptographic tools and secure hardware to manage non-custodial keys, perform private computations, handle data encryption, execute cross-chain functions, develop privacy-preserving applications, and more.
Read more about how Lit works.
Learn more about potential use cases for Lit.
What are Lit Actions?
Blockchains like Ethereum have smart contracts that let developers encode logic to change that state. As a key management network, Lit provides a method that allows developers to encode logic that dictates signing and encryption / decryption operations.
This logic is called a Lit Action: an immutable JavaScript program that can be used to read and write data across blockchains and off-chain platforms with Lit. You can think of them as decentralized serverless functions with access to their own public / private key pair. You can use Lit Actions to generate signatures when your specified on or off-chain conditions are met, fetch data from off-chain platforms, manage permissions for Lit keys, and so much more.
All Lit Actions are executed within the trusted execution environment (TEE) present within each Lit node, meaning the computation remains completely private and immutable. Additionally, all Lit Actions can be chained together to create even more sophisticated applications and protocols.
All you need to know about Lit v0.1
Lit’s latest v0.1 update introduces several performance improvements and new features. This includes the ability to decrypt and sign within a Lit Action, enabling builders to take advantage of the Lit nodes’ trusted execution environments (TEEs) for privacy-preserving and verifiable signing and compute operations. This is a big change from the previous iteration of Lit Actions which were entirely dependent on the user to perform signing or decryption. Now, developers can create Lit Actions that handle signing and decrypting autonomously, making it possible to replace centralized servers used for signing with decentralized, serverless functions that can be called from dApps when needed as well as computing over private data.
You can read more about this upgrade here.
Building on Lit
Installing the Lit SDK
These docs can be used to install the Lit SDK. The latest version of the SDK can be found here.
Connecting to a Lit Network
After installing the Lit SDK, you can connect to a specific Lit network by creating a new LitNodeClient instance and setting the `litNetwork` property.
- This example demonstrates how to connect to the Lit network in a browser environment.
- This example demonstrates how to connect to the Lit network in a node.js environment.
For the hackathon, we recommend connecting to the centralized Lit devnet, `datil-dev`, as specified in the code linked above.
Authenticating with the Lit Nodes
Authentication is the process of establishing and maintaining a secure connection to the nodes in the Lit network. In order to authenticate with Lit, you’ll need to generate session signatures, which are required when performing most operations such as signing, decryption, and executing Lit Actions.
The following three methods can be used to generate session signatures using the Lit SDK:
- ‘getSessionSignatures` → used to create session signatures.
- `getLitActionSessionSigs` → for creating session signatures using Lit Actions.
- ‘getPkpSessionSigs` → for creating session signatures with Programmable Key Pairs (PKPs).
Lit Actions
To start building with Lit Actions, please check out the overview and quick start guide. The following examples can be used to implement more advanced functionality:
- Conditional Signing with Lit Actions: Generate a signatures with Lit when your predefined conditions are met.
- Using On and Off-Chain Data in Lit Actions: Use the JavaScript `fetch` function to use data from other chains or off-chain sources.
- Decrypting an API Key in a Lit Action: Use the `decryptAndCombine` function to decrypt data within Lit Actions.
- Signing Transactions in Lit Actions: Use the `signAndCombineEcdsa` function to sign a blockchain transaction within a Lit Action and broadcast it on-chain.
Documentation
🛠️ Lit Actions SDK Documentation
Quick Start Guides and Examples
📃 Developer Guides Code Examples
Tools and Resources for Builders
🗺️ Lit Explorer
🫂 Lit Protocol Community Resources
FAQ
🤓 Frequently asked questions about Lit Protocol
App Ideas & Examples:
Identity
- Private credential issuance App: Implement a decentralized identity management system using Lit Actions, where users can request verifiable credentials without revealing their sensitive data.
- Decentralized ID verification App: Create a decentralized ID verification system with Lit Actions, enabling users to control their identity data and share it securely with third-party services.
- Self-sovereign identity: Build a self-sovereign identity platform using Lit Actions, allowing users to manage their digital identities and share verified attributes with organizations and services.
- Zero-Knowledge proof authentication: Implement a zero-knowledge proof authentication system using Lit Actions, where users can prove possession of certain credentials without revealing the credentials themselves.
- Decentralized reputation system: Create a decentralized reputation system with Lit Actions, allowing users to build reputations based on their interactions within a network while maintaining privacy.
- Selective disclosure tools: Develop tools within Lit Actions for selective disclosure of identity attributes, enabling users to share only necessary information for specific transactions or interactions.
Gaming
- Autonomous NPCs application: Create immersive gaming experiences with Lit Actions, where non-player characters (NPCs) can interact with players using decentralized oracles and cross-chain messaging.
- Decentralized gaming tournaments application: Develop a decentralized gaming tournament platform using Lit Actions, where gamers can participate in private and secure tournaments.
- Interactive NFTs: Build an interactive and secure NFT platform using Lit Actions, where NFT attributes can be uniquely updated based on game achievements and external data.
- Player-owned virtual worlds: Create player-owned virtual worlds using Lit Actions, where users can create, own, and monetize their virtual spaces securely and privately.
- Blockchain-based asset trading: Develop a blockchain-based asset trading platform using Lit Actions, allowing players to securely trade virtual assets across different games.
AI (Artificial Intelligence)
- Private AI inference: Develop AI models that run within Lit, ensuring private and secure computations for sensitive data.
- Decentralized AI marketplace: Create a decentralized AI marketplace using Lit Actions, where AI models can be bought and sold securely and privately.
- AI-driven oracles: Build AI-driven oracles using Lit Actions, where AI models can be used to generate predictions and insights in a secure and private manner.
- Federated learning framework: Develop a federated learning framework within Lit Actions, allowing multiple parties to collaborate on AI model training without sharing raw data.
- Privacy-preserving data analysis: Implement privacy-preserving data analysis tools using Lit Actions, enabling organizations to gain insights from sensitive data without compromising privacy.
- Personalized AI assistants: Build personalized AI assistants using Lit Actions, which can provide tailored recommendations and assistance while preserving user privacy.
DeFi (Decentralized Finance)
- Decentralized lending: Develop a decentralized lending platform using Lit Actions, where borrowers and lenders can interact securely and privately.
- Private token trading: Create a private token trading platform using Lit Actions, where users can trade tokens securely and privately.
- Decentralized insurance: Build a decentralized insurance platform using Lit Actions, where users can purchase insurance policies securely and privately.
- Decentralized asset management: Develop a decentralized asset management platform using Lit Actions, allowing users to securely manage their digital assets and investments.
- Privacy-preserving yield farming: Create privacy-preserving yield farming strategies within Lit Actions, enabling users to participate in DeFi protocols without exposing sensitive information.
- Decentralized identity-based loans: Implement decentralized identity-based lending using Lit Actions, where users can secure loans based on their verified identities while maintaining privacy.
Infrastructure
- Decentralized oracles: Design and implement decentralized oracles using Lit Actions, enabling secure and private computations for on-chain data.
- Cross-chain messaging application: Develop a cross-chain messaging platform using Lit Actions, enabling secure and private communication between different blockchain networks.
- Private API gateways: Build a private API gateway using Lit Actions, enabling secure and private API interactions between services.
- Secure data sharing protocols: Design secure data sharing protocols using Lit Actions, enabling encrypted and authenticated data exchange between parties.
- Decentralized governance systems: Develop decentralized governance systems with Lit Actions, allowing communities to make collective decisions while preserving privacy and security.