Skip to main content

Privacy-Preserving Compliance Attestation SDK with Zcash blockchain anchoring

Project description

๐Ÿ” CompZ

Privacy-Preserving Compliance Attestation SDK

Anchor compliance proofs to Zcash blockchain without revealing sensitive data

License: MIT Python 3.10+ Zcash PRs Welcome

Features โ€ข Quick Start โ€ข Architecture โ€ข API โ€ข Documentation โ€ข Contributing


๐Ÿ“– Overview

CompZ is a lightweight, open-source SDK that transforms compliance evaluations into cryptographic proofs anchored on the Zcash blockchain. It enables:

โœ… Immutable audit trails - Blockchain-backed compliance records
โœ… Privacy preservation - Only hashes on-chain, sensitive data stays private
โœ… Tamper detection - Cryptographic verification of compliance data
โœ… Timestamp proofs - Blockchain proves "when" compliance was checked
โœ… Zero-knowledge ready - Compatible with ZK proof systems

Use Cases

  • ๐Ÿข Enterprise Compliance - Prove SOC2/ISO27001/PCI compliance without revealing architecture
  • ๐Ÿ”’ Security Audits - Immutable records of vulnerability assessments
  • ๐Ÿ“‹ Regulatory Reporting - Tamper-proof compliance evidence for auditors
  • โšก DevSecOps - CI/CD pipeline compliance attestations
  • ๐ŸŒ Web3 Projects - DeFi protocol compliance for regulators

โœจ Key Features

๐ŸŽฏ Compliance Rule Evaluation

Built-in evaluators for major frameworks:

Framework Controls Description
๐ŸŸฆ PCI DSS 5 sample controls Payment card security (firewall, encryption, MFA, logging)
๐ŸŸฉ SOC 2 Security 5 sample controls Trust services criteria (access, risk, monitoring)
๐ŸŸง FedRAMP Moderate 8 NIST 800-53 controls Federal security requirements (AC-2, AU-2, CM-2, etc.)

๐Ÿ” Privacy-Preserving Design

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Sensitive Data     โ”‚  โ† Stays in your environment
โ”‚  - Source code      โ”‚
โ”‚  - Configs          โ”‚
โ”‚  - Credentials      โ”‚
โ”‚  - Business logic   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚
           โ–ผ SHA-256 Hash
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  0xabc123def456...  โ”‚  โ† Only this goes on-chain
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

No sensitive data ever leaves your infrastructure.

๐Ÿ”— Zcash Blockchain Anchoring

  • โœ… Shielded transactions with 512-byte memo field
  • โœ… Privacy-first - Transaction details encrypted
  • โœ… Testnet & Mainnet support
  • โœ… Low fees (~$0.001 per attestation)
  • โœ… 2.5 min block time for confirmations

โœ“ Cryptographic Verification

# Anchor compliance data
$ compz anchor compliance.json
โ†’ Hash: 0xabc123...
โ†’ TXID: 9c8f7e6d...

# Verify later (or share with auditor)
$ compz verify compliance.json 9c8f7e6d...
โ†’ โœ… VALID - Hashes match
โ†’ Block: 2500123
โ†’ Timestamp: 2024-01-01 10:30:00 UTC

๐Ÿ”ง Integration Ready

Works standalone or integrates with:

  • CompliLedger - AI-driven compliance platform
  • COMP-LEO - Compliance orchestration engine
  • GitHub Sentinel - Repository security monitoring
  • Any CI/CD pipeline - Jenkins, GitLab, GitHub Actions
  • SBOM/SCA tools - SPDX, CycloneDX, Snyk, etc.

๐Ÿš€ Quickstart

Prerequisites

  • Python 3.10 or higher
  • Access to a Zcash node (testnet or mainnet)
  • Basic understanding of JSON and command-line tools

Step 1: Installation

# Clone the repository
git clone https://github.com/Compliledger/CompZ.git
cd CompZ

# Install dependencies
pip install -e .

Note: PyPI release coming soon. For now, install from source using pip install -e .

Quick Start Options

Option 1: Local Mode (No Setup Required)

  • Hashing and verification work immediately
  • No blockchain connection needed
  • Perfect for testing the SDK
# Try it now - no configuration required!
compz status

Option 2: Self-Hosted Mode (Full Blockchain Integration)

  • Requires Zcash node setup
  • Enables real on-chain anchoring
  • See configuration steps below

Step 2: Set Up Zcash Node

โš ๏ธ Optional: Only required for self-hosted mode with real blockchain anchoring. You can skip this and use local mode or Zashi wallet integration instead.

Option A: Docker (Recommended for Testing)

# Run Zcash testnet node
docker run -d \
  --name zcash-testnet \
  -p 18232:18232 \
  -v ~/.zcash:/root/.zcash \
  electriccoinco/zcashd \
  -testnet \
  -rpcuser=compz \
  -rpcpassword=your_secure_password \
  -rpcallowip=127.0.0.1

# Wait for sync (2-4 hours for testnet)
docker exec zcash-testnet zcash-cli -testnet getblockchaininfo

Option B: Use Existing Node

If you already have a Zcash node running, just configure the connection.

Step 3: Configure Environment

For self-hosted mode only. Copy the template and configure:

cp .env.example .env
# Edit .env with your Zcash node credentials

Example .env configuration:

# .env
ZCASH_RPC_URL=http://127.0.0.1:18232
ZCASH_RPC_USER=compz
ZCASH_RPC_PASS=your_secure_password
ZCASH_DEFAULT_ADDRESS=ztestsapling1...  # Your z-address
ZCASH_TESTNET=true

Generate a z-address:

# Create a new shielded address
docker exec zcash-testnet zcash-cli -testnet z_getnewaddress sapling

# Get testnet funds from faucet
# Visit: https://faucet.testnet.z.cash/

Step 4: Run Your First Attestation

# Anchor compliance data to Zcash
compz anchor examples/compliance_result.json

# Output:
# {
#   "hash": "0xabc123def456...",
#   "txid": "9c8f7e6d5c4b3a2...",
#   "network": "testnet",
#   "timestamp": "2024-01-01T10:30:00Z",
#   "block_height": 2500123,
#   "explorer_url": "https://explorer.testnet.z.cash/tx/9c8f..."
# }

Step 5: Verify the Attestation

# Verify compliance data matches blockchain record
compz verify examples/compliance_result.json 9c8f7e6d5c4b3a2...

# Output:
# โœ… VALID - Compliance data matches blockchain record
# {
#   "valid": true,
#   "local_hash": "0xabc123def456...",
#   "onchain_hash": "0xabc123def456...",
#   "txid": "9c8f7e6d5c4b3a2...",
#   "block_time": "2024-01-01T10:30:00Z",
#   "confirmations": 42
# }

Step 6: Try Tampering (Demo)

# Edit the JSON file (change any value)
# Then try to verify again
compz verify examples/compliance_result.json 9c8f7e6d5c4b3a2...

# Output:
# โŒ INVALID - Hash mismatch detected
# {
#   "valid": false,
#   "local_hash": "0xDIFFERENT...",
#   "onchain_hash": "0xabc123def456...",
#   "reason": "Data has been tampered with"
# }

๐Ÿง  How CompZ Works

  1. Input โ†’ Raw System Payload

You supply system metadata (e.g., config settings) in JSON.

  1. Rule Evaluation

CompZ evaluates this data against minimal demonstrative control sets:

PCI DSS (5 controls) โ€ข Firewall rules โ€ข Secure defaults โ€ข PAN encryption โ€ข MFA โ€ข Logging

SOC 2 Security (5 controls) โ€ข Access policies โ€ข Risk assessment โ€ข Change management โ€ข Monitoring โ€ข Business continuity

FedRAMP Moderate (8 NIST controls) โ€ข AC-2, AC-3, AU-2, AU-6 โ€ข CM-2, CM-6 โ€ข SC-13 โ€ข SI-2

Output is a structured ComplianceResult object.

โธป

  1. Normalization

ComplianceResult โ†’ Deterministic normalized JSON: โ€ข Sorted keys โ€ข UTF-8 safe โ€ข No whitespace variance

โธป

  1. Hashing

SHA-256 hash returned as: 0x This is the privacy-preserving compliance attestation.

โธป

  1. Zcash Anchoring

CompZ: โ€ข Connects to a Zcash node โ€ข Creates a transaction โ€ข Embeds the hash in the memo field โ€ข Returns the transaction ID for auditability

โธป

  1. Verification

Given: โ€ข The original JSON โ€ข A Zcash txid

CompZ will: โ€ข Recompute the hash locally โ€ข Retrieve memo/OP_RETURN from Zcash โ€ข Compare hashes โ€ข Output match = true or false

โธป

๐Ÿงช Example Directory Layout CompZ/ โ”œโ”€โ”€ compz/ โ”‚ โ”œโ”€โ”€ models.py โ”‚ โ”œโ”€โ”€ evaluator.py โ”‚ โ”œโ”€โ”€ normalize.py โ”‚ โ”œโ”€โ”€ hash.py โ”‚ โ”œโ”€โ”€ zcash_client.py โ”‚ โ”œโ”€โ”€ anchor.py โ”‚ โ””โ”€โ”€ verify.py โ”œโ”€โ”€ examples/ โ”‚ โ”œโ”€โ”€ compliance_result_example.json โ”‚ โ”œโ”€โ”€ run_anchor.sh โ”‚ โ””โ”€โ”€ run_verify.sh โ””โ”€โ”€ docs/ โ””โ”€โ”€ architecture.md ๐Ÿ›  Roadmap โ€ข Shielded-pool anchoring โ€ข ZK-SNARK/Circuit attestation proofs โ€ข Full PCI/SOC2/FedRAMP/HIPAA libraries โ€ข GitHub Sentinel integration โ€ข CompliLedger DevSync / AuditSync integration โ€ข DID/VC support โ€ข Zero-Knowledge control evaluation pipelines

โธป

๐Ÿค Contributing

Pull requests, issues, and feature requests are welcome. We encourage contributions focused on: โ€ข Zcash memo integration โ€ข Compliance rule expansion โ€ข Privacy-preserving computation โ€ข Open-source compliance tooling

โธป

๐Ÿ“„ License

MIT License. See LICENSE for details.

โธป

๐ŸŽ‰ Built by CompliLedger

CompZ is an open-source privacy attestation toolkit from CompliLedger, an AI-driven compliance intelligence platform for regulated industries, cloud environments, stablecoins, and Web3 ecosystems.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

compz-1.0.0.tar.gz (40.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

compz-1.0.0-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

Details for the file compz-1.0.0.tar.gz.

File metadata

  • Download URL: compz-1.0.0.tar.gz
  • Upload date:
  • Size: 40.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for compz-1.0.0.tar.gz
Algorithm Hash digest
SHA256 78d1325e9d4c77bb613955b34cbc6acc391a4b1e994e4723c7c2a4b7713a1b12
MD5 25e7a83a9446244c1e22d2130631433d
BLAKE2b-256 5b739051864d71cbb146240f7b389168ec14b5bed0f1acce6b2fc5703a989adc

See more details on using hashes here.

File details

Details for the file compz-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: compz-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 31.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for compz-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1172e1aa1d7dfeddee5fb74a028f55cc9c50a78e4cd523053f2432e0377cea51
MD5 e96c25126673457b4ccb93963fed6ebd
BLAKE2b-256 35930a7e5b143f0cf0149237e2e4a3c11c76abb77a332310f4acde2bc196f449

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page