Prerequisites
Before installing Light Protocol, ensure you have the following:Node.js and npm
Node.js and npm
Required for JavaScript/TypeScript development.Recommended: Node.js 20.9.0 LTS or higherDownload from nodejs.org
Rust and Cargo
Rust and Cargo
Required for building Solana programs with Light Protocol.Required: Rust stable and nightly toolchains
Solana CLI
Solana CLI
Required for deploying and testing programs.Recommended: Solana CLI 1.18+ (compatible with SDK 2.3)
Build Tools
Build Tools
Platform-specific build dependencies.Linux (Ubuntu/Debian):Linux (Fedora):Linux (Arch):macOS:
CLI Installation
The Light Protocol CLI provides tools for local development and testing.JavaScript SDK
Install the Light Protocol JavaScript libraries for building client applications.Core SDK (@lightprotocol/stateless.js)
For working with compressed accounts and general ZK Compression features:Compressed Token SDK (@lightprotocol/compressed-token)
For working with compressed tokens:The
@lightprotocol/compressed-token package depends on @lightprotocol/stateless.js, so both need to be installed.Quick Test
Verify the installation:Rust SDK
Add Light Protocol to your Solana program’sCargo.toml.
For Anchor Programs
[Cargo.toml]
For Native Programs
[Cargo.toml]
Client Libraries
For building Rust clients or test utilities:[Cargo.toml]
Building from Source
For advanced users who want to build Light Protocol from source.Clone Repository
Install Dependencies
- Solana CLI tools
- Anchor framework
- Node.js dependencies
- Gnark proving keys (subset for testing)
Full Proving Keys (Optional)
Full Proving Keys (Optional)
If you need the complete set of production proving keys:
Activate Development Environment
PATH.
Build the Project
- All Rust programs and libraries
- TypeScript packages
- CLI tools
Run Tests
Development Containers
Light Protocol supports Development Containers for consistent environments.VS Code
- Install the Dev Containers extension
- Open the repository in VS Code
- Click “Reopen in Container” when prompted
Other IDEs
- Neovim: Use nvim-dev-container
- Emacs: Use lsp-docker
Network Endpoints
Configure your application to connect to different networks.Localnet
Devnet
Mainnet Beta
Helius provides the official Photon indexer for devnet and mainnet. Visit helius.dev to get an API key.
Verify Installation
Test your complete setup:Troubleshooting
Command not found: light
Command not found: light
The CLI wasn’t added to PATH. Try:
Test validator fails to start
Test validator fails to start
Ensure no other Solana validator is running:
Rust build errors
Rust build errors
Install missing system dependencies:Ubuntu/Debian:macOS:
Version conflicts
Version conflicts
Ensure all packages use compatible versions:
- Light Protocol SDK: v0.23.0
- Solana SDK: v2.3.x
- Anchor: v0.31.1
Next Steps
Quickstart
Build your first compressed token application
CLI Reference
Explore all CLI commands
JavaScript SDK
Learn the TypeScript SDK
Rust SDK
Integrate into Solana programs