Client Development
Overview to Client side development. Quick access to TypeScript and Rust SDKs.
Build client applications that interact with ZK Compression across web, Node.js, and native environments using our TypeScript and Rust SDKs.
Typescript Client
@lightprotocol/stateless.js - Core compression SDK to create or interact with compressed accounts via RPC interface
@lightprotocol/compressed-token - SDK to mint, transfer, compress/ decompress, or delegate compressed tokens
Rust Client
For devnet and mainnet use
light-clientAn RPC client for compressed accounts and tokens. Find a full list of JSON RPC methods here.
It connects to the Photon indexer that tracks compressed state to query compressed accounts and the prover service for validity proofs.
For local testing use
light-program-testInitializes in-process Solana VM via LiteSVM with auto-funded payer, local prover server and in-memory indexer.
Installation
npm install --save \
@lightprotocol/stateless.js \
@lightprotocol/compressed-token \
@solana/web3.js \
@lightprotocol/zk-compression-cliyarn add \
@lightprotocol/stateless.js \
@lightprotocol/compressed-token \
@solana/web3.js \
@lightprotocol/zk-compression-cli[dependencies]
light-client = "0.13.1" Environments
Start a local test-validator with the below command. It will start a single-node Solana cluster, an RPC node, and a prover node at ports 8899, 8784, and 3001.
light test-validator See the CLI Installation Guide for more.
CLI InstallationThe Rpc connection is used to interact with the ZK Compression JSON RPC. It's a thin wrapper extending Solana's web3.js Connection class with compression-related endpoints.
Here's how you set up a connection:
import { createRpc } from '@lightprotocol/stateless.js';
// Local development
const connection = createRpc(); // Uses local test validator
// DevNet
const connection = createRpc(
"https://devnet.helius-rpc.com?api-key=YOUR_KEY",
);
// MainNet
const connection = createRpc(
"https://mainnet.helius-rpc.com?api-key=YOUR_KEY"
);Find all ZK Compression related RPC methods below.
JSON RPC methodsExamples
Next Steps
Learn about SDKs for program development.
Program DevelopmentLast updated
Was this helpful?