Lit Protocol Developer Documentation
website·Indexed 35 days ago
https://developer.litprotocol.com/Documentation for Lit Protocol, a programmable runtime for executing signed actions within a chain-secured TEE. It features Lit Actions—immutable JavaScript programs executed in a TEE—and the Lit Agent Keychain for providing AI agents with scoped, revocable access to API keys and credentials. The platform includes a programmable KMS, PKP wallets, and support for WebAssembly (WASM) and third-party ESM packages.
What's inside Lit Protocol
- Lit Chipotle uses an On-Chain KMS provided by Phala, which replaces a centralized cloud provider's authorization with smart contracts on the Base blockchain. The KMS only releases keys to a CVM if its attestation (hardware, OS, and code compose hash) matches a whitelist maintained on-chain. This ensures that no single party, including Lit Protocol, can unilaterally change the whitelist or authorize key release without multi-party approval via a Safe multisig.
Overview of Lit Protocol Connected Services
Connected services allow an agent to use a credential inside the Lit enclave without the agent ever receiving the credential itself. The enclave decrypts the credential, makes a fixed upstream call over TLS to a pinned host, and returns only documented fields. This prevents the agent from exporting the key, calling unauthorized URLs, or running arbitrary code.
Warning: Because credentials cannot be exported from the enclave, you must maintain a separate secure copy of the original credential; lost credentials cannot be recovered from the ciphertext.
Overview of Lit Protocol Programmable Runtime
Lit Protocol is a programmable runtime that enables developers to execute JavaScript within a chain-secured Trusted Execution Environment (TEE). It allows for reading data from any source, performing computations, and signing actions on any chain or API. Key security features include: keys never leave the enclave, and the code authorized to use those keys is governed on-chain, providing the expressiveness of a runtime with the auditability of a smart contract.Overview of Lit Agent Keychain
Lit Agent Keychain is a secure vault for AI agent credentials. It allows users to encrypt secrets in their browser and grant scoped, revocable access to specific agent public keys. Access is enforced by Lit Protocol's network of hardware enclaves, which verify signed approvals on every request. It is accessible via an SDK, CLI, or MCP clients (e.g., Claude Code, Codex, Cursor). The hosted application is available at keychain.litprotocol.com.Overview of Lit Triggers
Lit Triggers allows you to run a Lit Action automatically when a specific event occurs, turning the action into an autonomous agent capable of fetching data, signing, and transacting without a human holding the signing key. The signing key is derived from the action's IPFS CID via
Lit.Actions.getLitActionPrivateKey(), ensuring that any change to the action code changes the signer address.Supported trigger types:
- Webhook: Triggered when an external service POSTs to a generated URL.
- Schedule: Triggered automatically based on a cron expression.
- Chain event: Triggered by an EVM log matching a specific chain, contract, and event signature.
Service URL:
https://triggers.litprotocol.comOverview of Lit Chipotle self-hosting options
Lit Chipotle is open source, allowing teams to audit the stack and operate their own deployments for greater infrastructure ownership, private deployment controls, or custom compliance. There are two primary ownership models:
- Local development: Used for testing, demos, and auditing. Involves running Anvil, dstack simulator, contracts,
lit-api-server,lit-actions, and the static dashboard from a workstation. - Production self-hosting: Used for teams requiring full infrastructure control and independently managed uptime. Involves operating a TEE-backed deployment, Docker images, API server, Lit Actions runtime, chain configuration, RPC access, monitoring, and verification evidence.
- Local development: Used for testing, demos, and auditing. Involves running Anvil, dstack simulator, contracts,
Overview of Derived Actions
Derived Actions allow you to mint a new immutable action and a corresponding TEE-held secp256k1 private key by appending a small configuration object (a manifest) to an audited action template. Because Lit Action keys are derived from the action's IPFS CID, changing a single byte in the source (e.g., changing the manifest) results in a new CID and a new unique key. This pattern is used to create per-user, per-secret, or per-tenant isolation where the configuration is trusted (part of the source) rather than untrusted (passed viajs_params).Understand Lit Actions fundamentals
Lit Actions are immutable JavaScript programs identified by their IPFS CID and executed within the Lit network's Trusted Execution Environment (TEE). Because the code is immutable and keys never leave the enclave, any signed output serves as a proof that a specific piece of code produced a specific result. Actions can sign data, encrypt/decrypt secrets, and make HTTP requests to APIs, oracles, or blockchains.Understand the On-Chain KMS contract architecture
Two contracts on the Base network gate key release for Lit Chipotle CVMs:
- Phala KMS (
0x2f83172A49584C017F2B256F0FB2Dca14126Ba9C): A shared registry that manages approved dstack OS images (allowedOsImages), KMS instance measurements (kmsAllowedAggregatedMrs), and acts as a factory for application-specific contracts. - DstackApp (
0x3F91Deaf16FF7C823eE65081d6bAFA1cEea05FfC): The application-specific contract for Lit Chipotle. It maintains the whitelist ofapp-compose.jsonSHA-256 hashes (allowedComposeHashes) and approved hardware device identifiers (allowedDeviceIds).
- Phala KMS (
Understand the Lit Chipotle upgrade governance process
Upgrading Lit Chipotle requires two independent actions to prevent any single party from unilaterally pushing code to production. Both actions must be completed for a release to be successful:
- Governance: A Safe multisig must approve an on-chain transaction to add the new release's compose hash to the
DstackAppwhitelist. - Deployment: The new image must be built, pushed, and the CVM restarted.
If a deployment occurs without whitelisting, the enclave boots but the KMS refuses to issue keys. If whitelisting occurs without deployment, no code changes take effect.
- Governance: A Safe multisig must approve an on-chain transaction to add the new release's compose hash to the
Understand Lit Chipotle credit-based pricing
Lit Chipotle uses a credit-based billing model where credits are pre-purchased and drawn down based on API usage. There are no subscriptions or per-seat fees. Read-only operations (GET requests that do not modify on-chain state, such as viewing groups, wallets, IPFS actions, listing usage API keys, or checking account balances) are free of charge.Understand the Lit Protocol Attestation Model
Lit Protocol uses remote attestation to replace trust in human operators with trust in silicon and mathematics. By using a Trusted Execution Environment (TEE), specifically Intel TDX (Trust Domain Extensions), Lit ensures that:
- Memory is encrypted by the CPU, preventing root users or cloud providers from reading plaintext data.
- The boot chain is measured via cryptographic hashes stored in tamper-proof registers.
- Secrets (like TLS private keys) are generated inside the TEE and cannot be extracted via API.
This model allows users to verify exactly what code is running on a server without trusting the cloud provider (Phala/Intel) or the application operator (Lit).