Skip to content

Lightprotocol/light-protocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Light Protocol

Light Protocol

Discord Workflow Status

The ZK Compression Protocol for Solana

Developers can use Light to create rent-free tokens and PDAs on Solana without sacrificing performance, security and composability.

Documentation is available here: www.zkcompression.com.

Our friends at Helius maintain the official ZK Compression indexer here.

Custom Circuits

ZK Compression works with any regular onchain program on Solana. You don't have to know how to use ZK, the protocol just uses it under the hood. However, if you are building a custom ZK based app, you can also compose with compressed state inside your circuit.

Verifiable Build

Prerequisites:

./scripts/build-verifiable.sh

Verify Deployment

Release 1.0 commit hash: 1cb0f067b3d2d4e012e76507c077fc348eb88091

$ solana-verify verify-from-repo --program-id Lighton6oQpVkeewmo2mcPTQQp7kYHr4fWpAgJyEmDX -u main --library-name light_registry --commit-hash 1cb0f067b3d2d4e012e76507c077fc348eb88091 https://github.com/Lightprotocol/light-protocol
$ solana-verify verify-from-repo --program-id compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq -u main --library-name account_compression --commit-hash 1cb0f067b3d2d4e012e76507c077fc348eb88091 https://github.com/Lightprotocol/light-protocol
$ solana-verify verify-from-repo --program-id SySTEM1eSU2p4BGQfQpimFEWWSC1XDFeun3Nqzz3rT7 -u main --library-name light_system_program --commit-hash 1cb0f067b3d2d4e012e76507c077fc348eb88091 https://github.com/Lightprotocol/light-protocol
$ solana-verify verify-from-repo --program-id cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m -u main --library-name light_compressed_token --commit-hash 1cb0f067b3d2d4e012e76507c077fc348eb88091 https://github.com/Lightprotocol/light-protocol

Security

The released Light Protocol programs have been audited, and the Light Protocol circuits are formally verified:

Note: All other tooling, such as light-sdk-macros and light-sdk, are in active development and unaudited.

Development environment

There are three ways of setting up the development environment:

  • devenv.sh script - the most recommended one, both for Linux and macOS. Works with Bash and zsh.
  • Development Containers - recommended on Linux, unfortunately has performance problems on macOS.
  • Manual setup - not recommended, but may be useful if the methods above don't work for you.
  • Windows is not supported.

Prerequisites:

  • Ubuntu, sudo apt-get install lld clang
  • Fedora, sudo dnf install clang lld
  • Arch, sudo pacman -S lld clang
  • Mac, brew install llvm

devenv.sh

The easiest way to setup the development environment is to use our scripts and development environment.

First, install the dependencies (they will be installed in the .local directory inside your repository clone).

./scripts/install.sh

By default, this will install a subset of gnark keys with Merkle tree heights sufficient for running tests. If you need the full set of production keys, you can use the --full-keys flag:

./scripts/install.sh --full-keys

Note: The default subset of keys is adequate for most development and testing purposes. The full set of keys is larger and includes additional Merkle tree heights used in production environments.

Then, activate the development environment:

./scripts/devenv.sh

Then follow the sections below, which describe the usage of build.sh and test.sh scripts.

When the development environment is active, you can manually run commands like pnpm, cargo, solana, solana-test-validator. They are going to use the dependencies installed in .local directory, so even if you have different global installations, they are not going to interfere.

Development Containers

Light Protocol fully embraces Development Containers, providing a ready-to-use Docker container image that comes pre-configured with all necessary dependencies for building and testing.

Support for Development Containers (either native or through a plugin) is provided by the following IDEs and editors:

Manual setup

If you still want to setup dependencies manually, these are the requirements:

If you are using Ubuntu and encounter errors during the build process, you may need to install additional dependencies. Use the following command:

sudo apt install build-essential autoconf automake libtool zlib1g-dev pkg-config libssl-dev

Building

To build the project, use the following commands:

./scripts/build.sh

Solana keypair

Before doing any development or running any tests, you need to generate a new local keypair:

solana-keygen new -o ~/.config/solana/id.json

Tests

Global

./scripts/test.sh

Program tests

Program tests are located in program-tests. Many tests start a local prover server. To avoid conflicts between local prover servers run program tests with --test-threads=1 so that tests are executed in sequence.

cargo test-sbf -p account-compression-test -- --test-threads=1

SDK tests

cd js/stateless.js
pnpm test
cd js/compressed-token.js
pnpm test

For more support from the community and core developers, open a GitHub issue or join the Light Protocol Discord: https://discord.gg/x4nyjT8fK5