Skip to main content

Local Python SDK for Vera Anchor

Project description

vera-anchor

Local-first Python SDK for deterministic evidence generation, ingest workflows, and dataset anchoring for Hash Factory. Part of the Vera Anchor ecosystem.

Raw data never leaves your machine. Only derived evidence packages are submitted to Hash Factory when you choose to do so.

License: Source-available under MIT with Commons Clause.
See LICENSE.

Installation

pip install vera-anchor

Requires Python 3.8+.

What it does

vera-anchor builds deterministic evidence packages on your machine composed of SHA3-512 hashes, Merkle proofs, bundle manifests, fingerprints, and receipts. It then optionally submits that evidence to Hash Factory for registration, HCS anchoring, and certificate issuance.

Two operating modes:

  • Local only — build evidence, inspect it, keep raw files private. No network calls.
  • Local then submit — build evidence locally, then send the evidence package to Hash Factory.

Quickstart (no API key needed)

Generate a local evidence package for any directory — no account, no network:

import asyncio, tempfile, pathlib
from vera_anchor.datasets.remote import ExecuteDatasetAnchorLocalOnlyInput, execute_dataset_anchor_local_only
from vera_anchor.datasets.types import DatasetIdentity

async def main():
    # Use any local directory — here we create a temp one with sample files
    root = pathlib.Path(tempfile.mkdtemp())
    (root / "hello.txt").write_text("hello world")
    (root / "data.json").write_text('{"x": 1}')

    result = await execute_dataset_anchor_local_only(
        ExecuteDatasetAnchorLocalOnlyInput(
            identity=DatasetIdentity(
                dataset_key="my-org.demo.quickstart",
                program="demo",
                version_label="v1",
            ),
            root_dir=str(root),
            evidence_pointer=f"file://{root}",
            hooks=None,
        )
    )
    print("merkle_root:  ", result.local.evidence.merkle_root)
    print("bundle_digest:", result.local.evidence.bundle_digest)
    print("receipt_id:   ", result.local.receipt["receipt_id"])

asyncio.run(main())

Run the same directory twice and the hashes are identical — that's the determinism guarantee.

Dataset flow

For directory-backed datasets.

Local only

import asyncio
from vera_anchor.datasets.remote import ExecuteDatasetAnchorLocalOnlyInput, execute_dataset_anchor_local_only
from vera_anchor.datasets.types import DatasetIdentity

async def main():
    result = await execute_dataset_anchor_local_only(
        ExecuteDatasetAnchorLocalOnlyInput(
            identity=DatasetIdentity(
                dataset_key="<org_id>.<program>.<name>",
                program="my_program",
                version_label="v1",
            ),
            root_dir="/path/to/dataset",
            evidence_pointer="file:///path/to/dataset",
            hooks=None,
        )
    )

    print(result.local.receipt)
    print(result.local.evidence)

asyncio.run(main())

Local then submit to Hash Factory

import asyncio
import os
from vera_anchor import HfLocalAuth, HfLocalClientConfig
from vera_anchor.datasets.remote import ExecuteDatasetAnchorLocalThenSubmitInput, execute_dataset_anchor_local_then_submit
from vera_anchor.datasets.types import DatasetIdentity

async def main():
    config = HfLocalClientConfig(
        base_url="https://hfapi.veraanchor.com",
        auth=HfLocalAuth(apiKey=os.environ["HF_API_KEY"]),
    )

    result = await execute_dataset_anchor_local_then_submit(
        config,
        ExecuteDatasetAnchorLocalThenSubmitInput(
            identity=DatasetIdentity(
                dataset_key="<org_id>.<program>.<name>",
                program="my_program",
                version_label="v1",
            ),
            root_dir="/path/to/dataset",
            evidence_pointer="file:///path/to/dataset",
            display_name="My Dataset",
            publish_visibility="unlisted",
            set_active=True,
            hooks=None,
        ),
    )

    print(result.local.receipt)
    print(result.remote)

asyncio.run(main())

Verify

import asyncio
import os
from vera_anchor import HfLocalAuth, HfLocalClientConfig
from vera_anchor.datasets.remote import verify_dataset_anchor_remote

async def main():
    config = HfLocalClientConfig(
        base_url="https://hfapi.veraanchor.com",
        auth=HfLocalAuth(apiKey=os.environ["HF_API_KEY"]),
    )

    result = await verify_dataset_anchor_remote(
        config,
        {
            "receipt": receipt,   # from a previous run
            "bundle": bundle,     # from a previous run
            "root_dir": "/path/to/dataset",  # optional local consistency check
        },
    )

    print(result)

asyncio.run(main())

Ingest flow

For generic evidence objects — file_set, file, text, or json.

Local only

import asyncio
from vera_anchor.ingest.remote import ExecuteIngestLocalOnlyInput, execute_ingest_local_only

async def main():
    result = await execute_ingest_local_only(
        ExecuteIngestLocalOnlyInput(
            request={
                "mode": "merkle_only",
                "identity": {
                    "object_key": "my_object",
                    "object_kind": "file_set",
                    "program": "my_program",
                    "version_label": "v1",
                },
                "material": {
                    "kind": "file_set",
                    "root_dir": "/path/to/input",
                    "rules": {"follow_symlinks": False},
                },
                "evidence_pointer": "file:///path/to/input",
            },
            hooks=None,
        )
    )

    print(result.local.receipt)
    print(result.local.evidence)

asyncio.run(main())

Local then submit

import asyncio
import os
from vera_anchor import HfLocalAuth, HfLocalClientConfig
from vera_anchor.ingest.remote import ExecuteIngestLocalThenSubmitInput, execute_ingest_local_then_submit

async def main():
    config = HfLocalClientConfig(
        base_url="https://hfapi.veraanchor.com",
        auth=HfLocalAuth(apiKey=os.environ["HF_API_KEY"]),
    )

    result = await execute_ingest_local_then_submit(
        config,
        ExecuteIngestLocalThenSubmitInput(
            request={
                "mode": "register_and_anchor",
                "identity": {
                    "object_key": "my_object",
                    "object_kind": "file_set",
                    "program": "my_program",
                    "version_label": "v1",
                },
                "material": {
                    "kind": "file_set",
                    "root_dir": "/path/to/input",
                    "rules": {"follow_symlinks": False},
                },
                "evidence_pointer": "file:///path/to/input",
                "domain": "hf:ingest|org",
                "proof_date": "2026-03-23",
            },
            hooks=None,
        ),
    )

    print(result.local.receipt)
    print(result.remote)

asyncio.run(main())

Example scripts

The package includes runnable example scripts:

Script Description
scripts/example_dataset_local_only.py Local-only dataset evidence generation
scripts/example_dataset_local_submit.py Local build + submit to Hash Factory
scripts/example_dataset_verify.py Verify a receipt and bundle
scripts/example_ingest_local_only.py Local-only ingest evidence generation
scripts/example_ingest_local_submit.py Local ingest + submit to Hash Factory
scripts/example_ingest_verify.py Verify an ingest receipt and bundle

Copy .env.example to .env and fill in your values before running any submit or verify script.

Run a dataset submit example:

HF_API_KEY=your_key \
HF_BASE_URL=https://hfapi.veraanchor.com \
TEST_ROOT_DIR=/path/to/dataset \
TEST_DATASET_KEY=<org_id>.<program>.<name> \
TEST_EVIDENCE_POINTER=s3://your-bucket/path \
python scripts/example_dataset_local_then_submit.py

Run an ingest local-only example:

TEST_ROOT_DIR=/path/to/input \
TEST_OBJECT_KIND=file_set \
TEST_OBJECT_KEY=my_object \
python scripts/example_ingest_local_only.py

Hash Factory

hf.veraanchor.com — live deployment.

Hash Factory is the web interface where users onboard, manage evidence packages, view HCS anchors, and receive HTS certificate NFTs on Hedera.

License

Source-available under the MIT License with Commons Clause. Commercial resale of the software itself is restricted. See LICENSE.

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

vera_anchor-0.1.3.tar.gz (69.2 kB view details)

Uploaded Source

Built Distribution

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

vera_anchor-0.1.3-py3-none-any.whl (85.8 kB view details)

Uploaded Python 3

File details

Details for the file vera_anchor-0.1.3.tar.gz.

File metadata

  • Download URL: vera_anchor-0.1.3.tar.gz
  • Upload date:
  • Size: 69.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for vera_anchor-0.1.3.tar.gz
Algorithm Hash digest
SHA256 13db318675b2b1665dc38e9d259491abb7fb84d8b483871cfaedae1328a560f6
MD5 3694d536d511264f7a3e8c63271ae8f1
BLAKE2b-256 0db89d72a9fdc7c8c3ba8b37b45fffd120c5add146f99852dfd68ad2072bb7a7

See more details on using hashes here.

File details

Details for the file vera_anchor-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: vera_anchor-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 85.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for vera_anchor-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9a8022cc898f99168e3c01e098bad7d3952b2eb08d842243bb7dc44f3de7362b
MD5 735b49ed5a693eb438ca8c758a89469d
BLAKE2b-256 203a360e47331e3c51062d90a02183258366e7f202509be87bc8eb14d392e1a8

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