Skip to main content
Version: v3.x.x

Decentralized Compute with Lit Actions

info

STATE OF THE NETWORK

Using Lit Actions in production IS now supported on the Habanero Mainnet and Manzano Testnet. Check out the docs on migration to learn how you can start building on Habanero today.

Introduction

Blockchains like Ethereum have smart contracts that let developers encode logic to change state. With Lit, you can encode logic that governs signing and encryption.

This logic is encoded using a Lit Action, an immutable JavaScript program that can be "assigned" to the key pairs generated on Lit and used to dictate how they are used.

A simple example would be a Lit Action that checks if a number is prime. To start, you would generate a Programmable Key Pair and assign it to your Lit Action so that it could use it to produce a signature. This signature would only be returned if the conditions defined within your Lit Action were met. In this case, the Lit Action would verify that the input was indeed a prime number. Every Lit node would execute your program independently and provision their key share down to the requesting client. Only after more than two-thirds of these shares have been collected can the complete signature be formed. You can read more about how Lit works here.

Features and Examples

Features

  • Blockchain Agnostic: Lit Actions can be used to read and write data to or even between blockchains with Programmable Key Pairs
  • Immutable: Once a Lit Action has been published, it cannot be modified, just like a smart contract deployed on a blockchain. The Mint/Grant/Burn function allows you to atomically link a PKP to an authorized set of Lit Actions, guaranteeing that a particular PKP can only ever be used to sign data from within the approved set.
  • Off-Chain Compatibility: You can make arbitrary HTTP requests from a Lit Action, meaning you can pull in data from off-chain sources natively, without needing to use of a third party oracle.

Examples

Getting Started

You can create your first Lit Action by following this quick start guide. Below, you'll find some additional resources and example implementations:

  1. GetLit CLI: The GetLitCLI simplifies the Lit Action development process.
  2. Event Listener: Use the Lit Event Listener to create event-based triggers for Lit Actions.
  3. DeFi Automation: Check out this example of using Lit Actions to automate portfolio rebalancing on Uniswap.