Skip to main content

Zero-Knowledge KYC for Algorand — verify KYC status on-chain without exposing personal data

Project description

ciphera

Zero-Knowledge KYC for Algorand — verify KYC status on-chain without exposing personal data.

PyPI version Python License: MIT

Install

pip install ciphera

What is Ciphera?

Ciphera is a privacy-preserving zero-knowledge KYC system on Algorand. Users prove they are KYC-verified Indian adults without revealing any personal data. ZK proofs are generated in the browser — private inputs never leave the device.

Quick Start

Check KYC Status (any dApp)

from ciphera import CipheraClient

client = CipheraClient()  # connects to Algorand Testnet by default

# Check total registered credentials on-chain
status = client.verify_kyc()
print(status.is_verified)        # True if any credentials registered
print(status.total_registered)   # e.g. 42
print(status.app_id)             # 756272073

Check a Specific Nullifier

client = CipheraClient()

# Check if a specific nullifier is registered
is_verified = client.is_nullifier_registered("3b1f8a2c" + "0" * 56)
print(is_verified)  # True / False

Verify a ZK Proof (Issuer Backend)

import json
from ciphera import verify_proof

vk = json.load(open("verification_key.json"))

result = verify_proof(
    verification_key=vk,
    proof=proof_dict,           # from browser SDK
    public_signals=signals_list,
    expected_app_id=756272073   # prevents cross-app attacks
)

if result.valid:
    print(result.nullifier_hex)    # 32-byte hex to register on-chain
    print(result.public_signals.is_adult)   # "1"
else:
    print(result.error)

Connect to Different Networks

from ciphera import CipheraClient

# Testnet (default)
client = CipheraClient()

# Mainnet
client = CipheraClient(network="mainnet")

# LocalNet (development)
client = CipheraClient(network="localnet")

# Custom endpoint
client = CipheraClient(
    algod_url="https://my-algod.example.com",
    algod_token="my-token"
)

API Reference

CipheraClient

CipheraClient(
    network="testnet",   # "testnet" | "mainnet" | "localnet"
    algod_url=None,      # Override endpoint
    algod_token="",      # Override token
    contract_ids=None,   # Override deployed contract IDs (dict)
)
Method Returns Description
verify_kyc(wallet_address=None) KYCStatus Check on-chain KYC registry
is_nullifier_registered(hex) bool Direct nullifier box check
get_credential_asa_id() int KYCRED ASA ID
CipheraClient.explorer_tx_url(txid) str Allo.info TX URL
CipheraClient.explorer_app_url(app_id) str Allo.info app URL

verify_proof(vk, proof, public_signals, expected_app_id=None)

Verify a Groth16 ZK proof off-chain.

Requires Node.js (node must be in PATH) as it delegates to snarkjs.

Returns ProofResult with .valid, .nullifier_hex, .public_signals, .error.


Models

@dataclass
class KYCStatus:
    is_verified: bool
    app_id: int
    total_registered: Optional[int]
    nullifier: Optional[str]
    error: Optional[str]

@dataclass
class ProofResult:
    valid: bool
    nullifier_hex: Optional[str]
    public_signals: Optional[PublicSignals]
    error: Optional[str]

Deployed Contracts (Algorand Testnet)

Contract App ID
NullifierRegistry 756272073
SMTRegistry 756272075
KYCBoxStorage 756272299
CredentialManager 756281076
KYCRED ASA 756281102

Requirements

  • Python 3.9+
  • py-algorand-sdk (installed automatically)
  • Node.js (only required for verify_proof())

License

MIT © Aditya Pandey

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

ciphera-0.1.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

ciphera-0.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file ciphera-0.1.0.tar.gz.

File metadata

  • Download URL: ciphera-0.1.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for ciphera-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b5c74a9aa224af5396aac602d8fe7cb40afce97989fbd8f92d065459d6773512
MD5 ee6a6925e27a4fa6f2214d4e856c8d2f
BLAKE2b-256 09d40e1cd7ceebef1b27683a85fb85b4bda935476a786e518ddd165784c0ec71

See more details on using hashes here.

File details

Details for the file ciphera-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ciphera-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for ciphera-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7465baef1d10810785bde227d16fdce89ff6941a600df36b65fba4a87ebbc1d9
MD5 44bcfe7573953984244a821a5708f496
BLAKE2b-256 065b4d3773742c75542fa6ee4558e3ba758c1445eb8a800d9c90e035a26c573f

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