MCPcopy Index your code
hub / github.com/Lightprotocol/light-protocol

github.com/Lightprotocol/light-protocol @light-psp10in2out-v0.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release light-psp10in2out-v0.3.0 ↗ · + Follow
1,177 symbols 3,516 edges 316 files 148 documented · 13%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Light Protocol

Light Protocol

Discord Workflow Status

The ZK Layer for Solana

Light is a zkLayer enabling private program execution, purpose-built for Solana.

Developers can use Light to build applications such as

  • encrypted orderbooks
  • private governance
  • on-chain games with private state

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.

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). If you want to install Redis (needed only for the relayer), use the --enable-redis option.

./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.

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:

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

Rust tests

cd light-verifier-sdk/
cargo test

SDK tests

cd zk.js/
pnpm test

Circuit tests

cd light-circuits
pnpm test

Anchor tests

Tests are located in tests/ directory.

The default test is a functional test, setting up a test environment with a Merkle tree and an spl token, conducting two shields and unshields.

Tests can be executed in bulk or one by one.

cd zk.js/
pnpm test
pnpm test-verifiers
pnpm test-merkle-tree

Common errors

If you're seeing this error: - error: package `solana-program v1.16.4` cannot be built because it requires rustc 1.68.0 or newer, while the currently active rustc version is 1.65.0-dev

update your solana-cli version to >=1.16.4.

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

Extension points exported contracts — how you extend this code

Config (Interface)
(no doc) [9 implementers]
verifier-sdk/src/light_transaction.rs
Field (Interface)
(no doc)
zk.js/src/transaction/transactionParameters.ts
IndexedMerkleTree (Interface)
(no doc)
programs/merkle-tree/src/indexed_merkle_tree.rs
LightAccounts (Interface)
(no doc)
verifier-sdk/src/accounts.rs

Core symbols most depended-on inside this repo

toString
called by 486
zk.js/src/utxo.ts
equal
called by 383
zk.js/src/utxo.ts
toString
called by 81
psp-examples/multisig/src/multisig.ts
add
called by 73
psp-examples/multisig/src/multisig.ts
getCommitment
called by 71
zk.js/src/utxo.ts
getBalance
called by 69
zk.js/src/wallet/user.ts
init
called by 60
zk.js/src/wallet/user.ts
getRootIndex
called by 59
zk.js/src/wallet/provider.ts

Shape

Method 431
Function 362
Class 348
Enum 32
Interface 4

Languages

TypeScript71%
Rust29%

Modules by API surface

zk.js/src/errors.ts42 symbols
zk.js/src/account.ts37 symbols
zk.js/src/wallet/user.ts36 symbols
cli/src/utils/utils.ts35 symbols
zk.js/src/merkleTree/merkleTreeConfig.ts34 symbols
zk.js/src/test-utils/userTestAssertHelper.ts32 symbols
verifier-sdk/src/light_transaction.rs29 symbols
programs/merkle-tree/tests/merkle_tree.rs22 symbols
zk.js/src/utils.ts21 symbols
zk.js/src/transaction/transactionParameters.ts20 symbols
zk.js/src/utxo.ts19 symbols
psp-examples/rock-paper-scissors/tests/rock-paper-scissors.ts18 symbols

For agents

$ claude mcp add light-protocol \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page