Skip to main content

aimarket-zk

Documentation

Document Description
User guide Install, configure, verify plugin is loaded
User cases Personas and cross-plugin workflows
SDK integration Code examples and hook behavior

Zero-knowledge proofs for private AI capability invocation. Consumer proves "I sent valid input matching the schema" without revealing the input. Provider proves "I executed correctly" without revealing model weights or computation trace. Neither party sees the other's private data.

When to Use

  • Consumer sends proprietary business data — wants proof it was processed correctly, but doesn't want provider to see it
  • Provider runs proprietary model — wants to prove correct execution without revealing weights
  • Regulatory compliance — prove invocation happened correctly without disclosing contents
  • Double-spend protection — ZK nullifiers prevent replay attacks on paid invocations

Installation

pip install aimarket-zk

Or from a checkout of the monorepo:

pip install -e plugins/aimarket-zk

Proving backend: the plugin loads and registers its routes with no backend configured, and the /zk/* endpoints then refuse with an explanation rather than the plugin vanishing from the catalogue. Set AIMARKET_ZK_SIMULATED=1 for the development simulation — it is not real zero-knowledge and the hub says so at every call.

Behind a reverse proxy: set AIMARKET_ZK_TRUSTED_PROXIES to the proxy's addresses as comma-separated CIDRs (for example 127.0.0.1/32). The prove rate limit then keys on the right-most X-Forwarded-For hop, but only for requests whose socket peer is in that list. It replaces AIMARKET_ZK_TRUST_FORWARDED_FOR (2026-11-16), which trusted the header from any caller. The old flag is no longer read, and the plugin logs one warning if it is still set.

Example

from aimarket_hub.signing import Signer
from aimarket_zk.zk_proofs import ZKProver

signer = Signer()
prover = ZKProver(signer)

schema = {"type": "object", "properties": {"text": {"type": "string"}}}
secret_input = {"text": "confidential merger terms between CorpA and CorpB"}

# Consumer: prove input is valid without revealing it
input_proof = prover.prove_input("legal.review@v1", schema, secret_input)
print(f"Input commitment: {input_proof.input_commitment[:16]}...")
# Provider sees only the hash — not "confidential merger terms"

# Provider: verify input proof → execute → prove output
import hashlib, json
schema_hash = hashlib.sha256(json.dumps(schema, sort_keys=True).encode()).hexdigest()
verification = prover.verify_input_proof(input_proof, schema_hash, "legal.review@v1",
                                         signer.public_key_b64)
print(f"Input proof valid: {verification['valid']}")  # True
print(f"Privacy: {verification['reason']}")  # "input is valid without being revealed"

# Full private invoke cycle (input + output proofs)
def executor(pid, cid, inp):
    return {"risk_assessment": "low", "issues_found": 0}

result = prover.private_invoke_flow(
    "legal.review@v1", "prod-legal",
    schema, secret_input, executor
)
print(f"Success: {result['success']}")
print(f"Privacy: {result['privacy_guarantees']}")
# {"input_hidden": true, "execution_trace_hidden": true,
#  "double_spend_protected": true, "zk_scheme": "Groth16 (simulated)"}

ZK Scheme

Reference implementation uses simulated Groth16 for development. Production: circom circuits compiled to bn254 curve via bellman/gnark. The interface is identical — swap the prover backend and proofs become cryptographically sound.

License

MIT · Maintained by AI-Factory

Metadata

Release files for aimarket-zk 2.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aimarket-zk 2.1.2
File Size Uploaded Provenance Actions
aimarket_zk-2.1.2.tar.gz 9.1 kB Without provenance Details for aimarket_zk-2.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aimarket-zk 2.1.2
File Interpreter ABI Platform Actions
aimarket_zk-2.1.2-py3-none-any.whl Python 3 none any Details for aimarket_zk-2.1.2-py3-none-any.whl

Total release size: 17.5 kB

Release files / aimarket_zk-2.1.2.tar.gz

Download URL aimarket_zk-2.1.2.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5c5ca82ec5a99b04de8d81988b19222c43df5c59e89fc8c2112f698934f52f46
BLAKE2b-256 checksum
How to use checksums
8e13ac881602a89c7eacb74e23c7ee4c053fba9c3092b437a91eb59cb313bab9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / aimarket_zk-2.1.2-py3-none-any.whl

Download URL aimarket_zk-2.1.2-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c9bf9213ac23cc17a25ddac8c93e8fe0781e7d76c46aa678e1809c6ff8f4fd5
BLAKE2b-256 checksum
How to use checksums
bfa812aac13697418d7e5c67e1e64601cd53dcd62332e83e777c6dc418c338a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for aimarket-zk 2.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page