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

github.com/Lightprotocol/light-protocol-v1 @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
431 symbols 1,197 edges 43 files 25 documented · 6%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Light Protocol

This is the Light Protocol repository. For the deployed code see the deploy branch which features the right config file and a non-rentexempt temporary storage account to save costs.

Tests

  • cargo test-bpf deposit_should_succeed
  • cargo test-bpf withdrawal_should_succeed

Run tests selectively test-bpf crashes sometimes if tests run in parallel.

General Description

The Light Protocol program verifies zkSNARK proofs to enable anonymous transactions on Solana.

An SDK will follow soon. Developers will be able to build solana-based programs on top of private transactions. If you're a developer interested in using or integrating with the program, reach out to us: Discord community / Twitter

Zero-knowledge proofs verify that the owner of recipient address B has deposited tokens to a shielded pool (similar to Zcash) from another address A before. The zero-knowledge proof includes meta data such as the recipient address. In case this data is tampered with the zero-knowledge proof becomes invalid and the withdrawal fails. Therefore, Light Protocol is completely trustless.

Documentation

For additional documentation refer to DOCUMENTATION.md.

State

We keep state in four types of accounts, a large persistent account for a sparse merkle tree, many small accounts storing two leaves each, many small accounts storing one nullifier each, plus temporary accounts to store intermediate results of computation for SNARK verification and updating the Merkle tree root. For every interaction with the shielded pool a new temporary account has to be created. Since, computation is conducted over 1502 instructions temporary accounts keep an index of the current computational step.

Security:

Light Protocol has been audited at commit 5a79cdff5e9ea4d621b5d50be16d938124b24723. Read the audit report here. A follow up audit for recent program modifications to improve UX will follow soon.

Notes:

Also note that we're using a fork of arkwork's ark-ec: https://github.com/Lightprotocol/algebra where we've made certain functions/structs public:

...bls12/g2.rs - G2HomProjective - mul_by_char - doubling_step - addition_step

...models/bn/mod.rs - ell

so we can reuse them mostly in tests.

Core symbols most depended-on inside this repo

_process_instruction
called by 66
program/src/poseidon_merkle_tree/processor.rs
parse_fp256_to_bytes
called by 42
program/src/groth16_verifier/parsers.rs
parse_quad_to_bytes
called by 40
program/src/groth16_verifier/parsers.rs
parse_f_to_bytes
called by 37
program/src/groth16_verifier/parsers.rs
mul_assign_1
called by 36
program/src/groth16_verifier/final_exponentiation/instructions.rs
mul_assign_2
called by 36
program/src/groth16_verifier/final_exponentiation/instructions.rs
conjugate_wrapper
called by 22
program/src/groth16_verifier/final_exponentiation/instructions.rs
parse_cubic_from_bytes_sub
called by 17
program/src/groth16_verifier/parsers.rs

Shape

Function 370
Method 43
Class 18

Languages

Rust100%

Modules by API surface

program/src/utils/prepared_verifying_key.rs194 symbols
program/tests/onchain.rs34 symbols
program/tests/offchain_merkle_tree.rs30 symbols
program/src/groth16_verifier/final_exponentiation/instructions.rs27 symbols
program/src/groth16_verifier/parsers.rs20 symbols
program/src/groth16_verifier/miller_loop/instructions.rs19 symbols
program/src/groth16_verifier/prepare_inputs/instructions.rs11 symbols
program/src/poseidon_merkle_tree/instructions_poseidon.rs10 symbols
program/src/instructions.rs9 symbols
program/tests/test_utils/mod.rs8 symbols
program/src/poseidon_merkle_tree/state.rs7 symbols
program/src/poseidon_merkle_tree/processor.rs7 symbols

For agents

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

⬇ download graph artifact