Introduction to Compute (Lit Actions)
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.
Overview
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.
Serverless signing (AKA Lit Actions), are JavaScript programs that can be used to specify signing and authentication logic for Programmable Key Pairs (PKPs). When used in conjunction with PKPs, Lit Actions are serverless functions with their own private key-pair that can be used to write data to blockchains and other state machines.
A simple example is a Lit Action and associated PKP that checks if a number is prime. The PKP gets atomically assigned to the Lit Action, only returning a signature if the required conditions are met (in this case, if a prime number is inputted). Each node will execute the Lit Action in parallel and verify that it meets the required conditions. If it does, each node independently provisions a signing share to the requesting client. Only after more than two-thirds of these shares have been collected is the complete signature returned.
Features
- Blockchain Agnostic: Lit Actions can be used to write data to and across any supported blockchain and state machine using PKPs.
- Immutable: Once a Lit Action has been published, it cannot be modified, just like a smart contract deployed on-chain. 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: Lit Actions can pull in data from off-chain sources natively, without requiring the use of a third party oracle.
Resources
- Getting Started
- GetLit CLI Tool
- Fetching Off-Chain Data in a Lit Action
- Conditional Signing with Lit Actions
- Using Mint/Grant/Burn: Use the Mint/Grant/Burn function in the Lit
contracts-sdk
to atomically assign a Lit Action(s) to a PKP. The PKP will only return a signed response if the function you've declared in your Lit Action returns 'true'. Learn more about minting PKPs here.