Skip to main content

Zero-Knowledge Proof framework for verifiable, private portfolio performance metrics

Project description

Proof of Portfolio

A decentralized framework for verifiable, private performance metrics using Zero-Knowledge Proofs.

Proof of Portfolio (PoP) is a framework that enables Validators to generate verifiable attestations of private portfolio performance. The system provides tooling for the original data owners (Miners) and consumers (Signal Purchasers) to cryptographically verify these attestations—ensuring both data inclusion and correctness of calculated metrics—all without the validator ever exposing the underlying private data.

This is achieved by combining Merkle trees to commit to a history of portfolio data and Noir, a DSL for creating and verifying zero-knowledge proofs.


Table of Contents


Core Concepts

The PoP system establishes trust through a validator-centric attestation model. It assumes a validator already has access to a set of private miner data. The tooling then facilitates a cryptographic process built on two key principles:

  1. Merkle Trees: A validator takes a miner's private portfolio history (checkpoints, positions, orders) and builds a Merkle tree from it. The resulting Merkle Root is made public. This root acts as a secure, tamper-proof fingerprint of the miner's entire dataset.

  2. Zero-Knowledge Proofs (ZKPs): Using circuits written in Noir, the validator generates a proof that specific performance metrics were calculated correctly over the private data corresponding to the public Merkle root.

This combination allows for verifiable, private computation. Miners and signal purchasers can trust the publicly-stated performance metrics because:

  • They can cryptographically verify their data was included in the calculation (by comparing their own data's Merkle root to the one the validator published).
  • They can cryptographically verify the calculation itself was performed correctly (via the ZK proof).

The miner's sensitive financial data remains confidential throughout the entire process.


Project Structure

The repository is organized into two main directories:

  • circuits/: Contains all the Noir source code. The core logic for financial calculations (Sharpe ratio, returns, etc.) and the main circuit for verifying a miner's data against their Merkle root are defined here.
  • src/: Contains the Python source code for the CLI, miner and validator logic, and demonstration scripts.

Installation

The project is managed with Python and requires the nargo toolchain for interacting with Noir circuits.

Automatically

uv add proof-of-portfolio

or

pip install proof-of-portfolio

[!NOTE] When you run pop via the command line or import the package for the first time, it will automatically attempt to install the required barretenburg (bbup) and noir (nargo / noirup) dependencies

Manually

1. Prerequisites

Ensure you have Noir/Nargo installed.

2. Standard Installation

Clone the repository and install the package in editable mode. This will install the pop command-line tool and all necessary Python dependencies.

git clone https://github.com/inference-labs-inc/proof-of-portfolio.git
cd proof-of-portfolio
pip install -e .

3. Installer Script (Optional)

An install.sh script is provided for convenience, which can help automate dependency setup.

./install.sh

Usage Workflow

The pop command-line interface provides tools for all participants in the ecosystem. The primary workflow is validator-driven.

1. Validator: Generating Proofs

Validators use the PoP toolkit to attest to the performance of miner data they possess.

First, a validator might use analyse-data to split a large file of all miner data into a standardized directory structure.

pop analyse-data --path validator_checkpoint.json --output ./miner_data/

Next, the validator processes each miner's data to generate a score and a Merkle root.

# Process a single miner's data
pop validate --path ./miner_data/5H.../data.json

# Process all miners in a directory
pop validate-all --path ./miner_data/

This produces a score.json file for each miner, containing the calculated metrics and the public Merkle root that commits to the data used.

2. Miner: Verifying Inclusion

After a validator publishes a Merkle root, a miner can independently verify that their data was included and processed correctly without tampering.

The miner runs the generate-tree command on their own private data.

# Miner provides the path to their own data file
pop generate-tree --path ./path/to/my_private_data.json

This command outputs a Merkle root. The miner can then compare this root to the one published by the validator. If they match, the miner has cryptographic proof that the validator used their exact data.

Utility Commands

  • generate-test-data: Creates a randomized validator_checkpoint.json-style file for testing.
    pop generate-test-data --num-miners 5 --output-file test_data.json
    
  • save-tree: A helper utility to save a tree.json file to a different location.

Demos

The CLI includes several demos to test and compare the Python and Noir circuit implementations.

pop demo --help
  • main: Runs a comprehensive end-to-end test, including ZKP generation and verification with Barretenberg.
  • Other demos: log-returns, returns, sharpe, drawdown.

Example:

pop demo main --hotkey 5H...

Development

The project is under active development. Contributions are welcome. Please refer to the source code and circuits for detailed implementation information.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

proof_of_portfolio-0.0.121.tar.gz (40.3 MB view details)

Uploaded Source

Built Distribution

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

proof_of_portfolio-0.0.121-py3-none-any.whl (40.3 MB view details)

Uploaded Python 3

File details

Details for the file proof_of_portfolio-0.0.121.tar.gz.

File metadata

  • Download URL: proof_of_portfolio-0.0.121.tar.gz
  • Upload date:
  • Size: 40.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.17

File hashes

Hashes for proof_of_portfolio-0.0.121.tar.gz
Algorithm Hash digest
SHA256 40ff777682651314a2591029da5b6bb51f0919d3da66f494e01bcad179f493f8
MD5 5b28dbdb5b01d84259643fbe2bfc6afb
BLAKE2b-256 253590156c1e1835daa80fd92f6f3bbb03b7810ae6ed8990c5975be8bd1a13bd

See more details on using hashes here.

File details

Details for the file proof_of_portfolio-0.0.121-py3-none-any.whl.

File metadata

File hashes

Hashes for proof_of_portfolio-0.0.121-py3-none-any.whl
Algorithm Hash digest
SHA256 9e091f9c2aa784e8f8bd158e310c356324b37c322e5ae801808c5f748398c3d4
MD5 6e4a36187b59b269d39eb0c6f1e1ab1d
BLAKE2b-256 1f7448756ab84df33c2e55d6903f591253e93f150e6b92b2a27d1ba452a50c3f

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