The ZK Compression Protocol for Solana
Light is a ZK protocol enabling stateless program execution that is purpose-built for Solana.
Developers can use Light to...
The documentation is available here: https://github.com/Lightprotocol/developer-content/tree/main/docs.
Prerequisites:
solana-verify
with cargo-install solana-verify
or see github for alternative install instructions.
See https://docs.docker.com/engine/install/ for docker
install instructions../scripts/build-verifiable.sh
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
Light Protocol programs have been audited, and Light protocol circuits are formally verified:
Note: All other tooling such as light-sdk-macros and light-sdk are in active development and unaudited.
There are three ways of setting up the development environment:
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
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.
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:
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
To build the project, use the following commands:
./scripts/build.sh
Before doing any development or running any tests, you need to generate a new local keypair:
solana-keygen new -o ~/.config/solana/id.json
./scripts/test.sh
Program tests are located in test-programs.
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
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