Skip to main content

orphograph

A Python SDK for anchoring a local folder to the Bitcoin chain through the Orphograph hosted service.

  • License: MIT
  • Python: 3.9 or newer
  • Runtime dependencies: Python standard library only

Privacy contract

The library does not transmit file contents. For each file the SDK reads the bytes locally, streams them through SHA-256 in one megabyte chunks, and commits the digest into an RFC 6962 Merkle leaf bound to the file's POSIX relative path. Only the resulting manifest (paths, per-file digests, leaf hashes, and the 32-byte root) is sent across the network. The verification path is symmetric: the root is recomputed locally from the folder on disk and compared to the root recorded in the receipt.

The Merkle module is a verbatim copy of the server's reference implementation, carrying the source SHA-256 in its header so divergence from the canonical algorithm is immediately visible.

Install

pip install orphograph

Anchor a folder

from orphograph import anchor_folder

result = anchor_folder("/path/to/folder")
# {
#   "receipt_id": "...",
#   "root_hex": "...",
#   "leaf_count": 42,
#   "calendars_ok": 5,
#   "calendars_total": 5,
# }

Optional arguments:

Argument Purpose
server_url Base URL of the service (default https://orphograph.com).
api_key Sent as X-Orpho-Api-Key when present.
client_label Short free-form label persisted with the receipt.
exclude Sequence of fnmatch patterns. None selects the default deny list (OS detritus, editor backups, build caches). Passing [] disables exclusion.

Verify a folder

from orphograph import verify_folder

ok = verify_folder("/path/to/folder", receipt_id="...")

The folder is walked locally, the Merkle root is recomputed, and the SDK returns True only if the recomputed root equals the root recorded in the receipt's manifest.

Inclusion proofs

A folder receipt can be queried for a proof that a single file belonged to the anchored tree. The proof is verified locally; no further network call is required to confirm it.

from orphograph import inclusion_proof, verify_inclusion

proof = inclusion_proof(receipt_id="...", path="sub/photo.jpg")
ok = verify_inclusion(
    file_path="/path/to/sub/photo.jpg",
    rel_path="sub/photo.jpg",
    proof=proof["proof"],
    root_hex=proof["root_hex"],
)

Command line

The package installs an orphograph console script and is also runnable as a module.

python -m orphograph anchor /path/to/folder
python -m orphograph verify /path/to/folder <receipt_id>
python -m orphograph inclusion-proof <receipt_id> <posix/rel/path>

Each subcommand writes a single line of JSON to standard output. The verify subcommand exits with status 0 on a match and 1 on a mismatch.

Environment variables:

Variable Purpose
ORPHO_SERVER_URL Default base URL.
ORPHO_API_KEY Default API key (sent as X-Orpho-Api-Key).

Algorithm

The Merkle construction is RFC 6962 with a domain-separated leaf (0x00 || rel_path_utf8 || 0x00 || file_sha256) and a domain-separated internal node (0x01 || left || right). Odd-level remainders are promoted, never duplicated, to avoid the second-preimage ambiguity of the duplicate-last construction. The algorithm tag orphograph-merkle-v1-rfc6962 is embedded in every manifest.

License

MIT. See LICENSE.

Metadata

Release files for orphograph 0.1.0

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

Source distribution (sdist)

Source distribution for orphograph 0.1.0
File Size Uploaded
orphograph-0.1.0.tar.gz 21.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for orphograph 0.1.0
File Interpreter ABI Platform
orphograph-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.2 kB

Release files / orphograph-0.1.0.tar.gz

Download URL orphograph-0.1.0.tar.gz
Size 21.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1f0ae0be426464c1197913b0793a18201232b0f4192416c4955c10a417f6cca7
BLAKE2b-256 checksum
How to use checksums
44fecd983b25709f451dbcdb53a231e9bb92c38c9b0febddbd7dd95309320002
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / orphograph-0.1.0-py3-none-any.whl

Download URL orphograph-0.1.0-py3-none-any.whl
Size 18.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b695da95d9385b1aa191316e10c12ab2828cba196c4d3ba2282d0eb7390d622
BLAKE2b-256 checksum
How to use checksums
bd395dbe77f5a065aeeddbb991c0e886222fa219fdc77fa78e470441fc52dc94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

2 release files

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