Docs
/getting started
/Installation

Installation

How to install Veil SDK

Installation

Veil is available as a Python package with pre-compiled Rust binaries for major platforms.

Prerequisites

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)

Install from PyPI

The simplest way to get started:

pip install veil

Using uv (recommended for faster installs):

uv pip install veil

This installs the pre-compiled package with Python bindings and Rust core.

Verify Installation

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!

Install from Source

For contributors or those who want to build from source:

Step 1: Clone Repository

git clone https://github.com/veil-solana/veil
cd veil

Step 2: Install Rust (if not already installed)

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env

Verify Rust installation:

rustc --version  # Should be 1.70 or higher

Step 3: Build Rust Core

cd rust
cargo build --release

This compiles the Rust cryptographic core with optimizations (~5-10 minutes).

Step 4: Build Python Bindings

cd ..
pip install maturin
maturin develop --release

This 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 framework
  • black - Code formatter
  • mypy - Type checker
  • ruff - Fast linter

Step 6: Run Tests

Verify everything works:

# Rust tests
cargo test --workspace
 
# Python tests
pytest tests/
 
# Expected: All tests passing

Expected output:

Running 80 tests...
test result: ok. 80 passed; 0 failed

Development Setup

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

Manual 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 maturin

Issue: 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 --release flag for optimizations
  • Consider mold linker for faster linking: cargo install mold

Platform-Specific Notes

macOS

Apple Silicon (M1/M2):

# May need to set architecture
arch -arm64 pip install veil

Intel:

pip install veil  # Works out of the box

Linux

Ubuntu/Debian:

# Install system dependencies
sudo apt update
sudo apt install build-essential pkg-config libssl-dev
 
# Then install Veil
pip install veil

Arch Linux:

sudo pacman -S base-devel openssl
pip install veil

Windows

Using WSL (recommended):

# Install WSL2 and Ubuntu
wsl --install
 
# Then follow Linux instructions

Native Windows:

# Install Visual Studio Build Tools
# https://visualstudio.microsoft.com/downloads/
 
# Install Rust via rustup
# https://rustup.rs/
 
pip install veil

Docker Setup (Optional)

For 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-app

Troubleshooting

Import 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/activate

Version Conflicts

# Check installed version
pip show veil
 
# Upgrade to latest
pip install --upgrade veil
 
# Install specific version
pip install veil==0.1.0

Performance Issues

For optimal performance, ensure you're using the release build:

# Development (slow)
maturin develop
 
# Production (fast)
maturin develop --release

Next Steps

Getting Help

Veil - Privacy by Design for Solana