Installation
How to install Veil SDK
Veil is available as a Python package with pre-compiled Rust binaries for major platforms.
Required:
- Python 3.12 or higher
- pip or uv package manager
Optional (for building from source):
- Rust 1.70 or higher
- Cargo (Rust package manager)
The simplest way to get started:
pip install veilUsing uv (recommended for faster installs):
uv pip install veilThis installs the pre-compiled package with Python bindings and Rust core.
Check that Veil is installed correctly:
import veil
print(f"Veil version: {veil.__version__}")
print("Installation successful!")Expected output:
Veil version: 0.1.0
Installation successful!
For contributors or those who want to build from source:
Step 1: Clone Repository
git clone https://github.com/veil-solana/veil
cd veilStep 2: Install Rust (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/envVerify Rust installation:
rustc --version # Should be 1.70 or higherStep 3: Build Rust Core
cd rust
cargo build --releaseThis compiles the Rust cryptographic core with optimizations (~5-10 minutes).
Step 4: Build Python Bindings
cd ..
pip install maturin
maturin develop --releaseThis creates PyO3 bindings between Rust and Python.
Step 5: Install Development Dependencies
pip install -e ".[dev]"This installs Veil in editable mode with development tools:
pytest- Testing frameworkblack- Code formattermypy- Type checkerruff- Fast linter
Step 6: Run Tests
Verify everything works:
# Rust tests
cargo test --workspace
# Python tests
pytest tests/
# Expected: All tests passingExpected output:
Running 80 tests...
test result: ok. 80 passed; 0 failed
Project Structure
veil/
├── crates/ # Rust workspace
│ ├── core/ # Cryptography core (veil-core)
│ │ ├── src/
│ │ │ ├── crypto/ # Commitments, Poseidon, Merkle, encryption
│ │ │ ├── proof/ # Groth16 circuits and proof system
│ │ │ ├── relayer/ # Relayer client infrastructure
│ │ │ └── lib.rs # PyO3 bindings
│ │ └── Cargo.toml
│ │
│ └── program/ # Solana on-chain program (Anchor)
│ ├── src/
│ │ ├── groth16.rs # Groth16 verification
│ │ ├── state.rs # Pool state, Merkle tree
│ │ └── lib.rs # Instruction handlers
│ └── Cargo.toml
│
├── src/veil/ # Python SDK (user-facing)
│ ├── __init__.py # Public API exports
│ ├── client.py # PrivacyClient class
│ ├── types.py # Type definitions
│ ├── utils.py # Utility functions
│ └── solana_client.py # Solana RPC integration
│
├── tests/ # Test suite
│ ├── unit/ # Unit tests
│ ├── integration/ # Integration tests
│ └── e2e/ # End-to-end tests
Running in Development Mode
With file watching (recommended):
# Terminal 1: Watch Rust changes and rebuild
cargo watch -x "build --release"
# Terminal 2: Run Python with live reload
python your_script.pyManual rebuilds:
# After changing Rust code
maturin develop --release
# After changing Python code
# No rebuild needed (editable install)Common Build Issues
Issue: maturin not found
pip install maturinIssue: Rust compiler errors
- Ensure Rust 1.70+:
rustup update - Clean build:
cargo clean && cargo build --release
Issue: Python import errors
- Reinstall:
pip uninstall veil && maturin develop --release - Check Python version:
python --version(must be 3.12+)
Issue: Slow builds
- Use
--releaseflag for optimizations - Consider
moldlinker for faster linking:cargo install mold
macOS
Apple Silicon (M1/M2):
# May need to set architecture
arch -arm64 pip install veilIntel:
pip install veil # Works out of the boxLinux
Ubuntu/Debian:
# Install system dependencies
sudo apt update
sudo apt install build-essential pkg-config libssl-dev
# Then install Veil
pip install veilArch Linux:
sudo pacman -S base-devel openssl
pip install veilWindows
Using WSL (recommended):
# Install WSL2 and Ubuntu
wsl --install
# Then follow Linux instructionsNative Windows:
# Install Visual Studio Build Tools
# https://visualstudio.microsoft.com/downloads/
# Install Rust via rustup
# https://rustup.rs/
pip install veilFor isolated development environments:
FROM python:3.12-slim
RUN apt-get update && apt-get install -y \
build-essential \
pkg-config \
libssl-dev \
curl
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Install Veil
RUN pip install veil
WORKDIR /app
COPY . .
CMD ["python", "main.py"]Build and run:
docker build -t veil-app .
docker run -it veil-appImport Errors
import veil # ModuleNotFoundError
# Solutions:
# 1. Reinstall: pip install --force-reinstall veil
# 2. Check Python path: python -c "import sys; print(sys.path)"
# 3. Virtual environment: python -m venv venv && source venv/bin/activateVersion Conflicts
# Check installed version
pip show veil
# Upgrade to latest
pip install --upgrade veil
# Install specific version
pip install veil==0.1.0Performance Issues
For optimal performance, ensure you're using the release build:
# Development (slow)
maturin develop
# Production (fast)
maturin develop --release- Quick Start - Build your first private transaction
- API Reference - Complete API documentation
- Examples - Code examples and patterns
- Documentation: veil-sdk.com
- GitHub Issues: Report bugs and request features
- X Community: @veilsolana
On This Page
- Installation
- Prerequisites
- Install from PyPI
- Verify Installation
- Install from Source
- Step 1: Clone Repository
- Step 2: Install Rust (if not already installed)
- Step 3: Build Rust Core
- Step 4: Build Python Bindings
- Step 5: Install Development Dependencies
- Step 6: Run Tests
- Development Setup
- Project Structure
- Running in Development Mode
- Common Build Issues
- Platform-Specific Notes
- macOS
- Linux
- Windows
- Docker Setup (Optional)
- Troubleshooting
- Import Errors
- Version Conflicts
- Performance Issues
- Next Steps
- Getting Help