Skip to main content

helixhash

A tamper-evident append-only log. Proves a sequence of bytestrings existed in this order at these times and has not been altered.

Institution role (Node 34539544): integrity protocol library used by geniusflow-engine Granth / helix chain. Sister: witnessfield. Full map: sangat-architecture/INSTITUTION_REPOSITORY_MAP.md.

v1.0 is a clean rewrite. In v0.x, scoring and priors were baked into the protocol, which created circular dependencies between the two libraries (HelixHash was a high-trust witness class inside witnessfield, and witnessfield-style credibility values leaked into HelixHash entries). v1.0 separates the protocol (what the library guarantees) from policy (opinions about how to weight things). HelixHash now only guarantees order and non-tampering. witnessfield now only describes witness structure. Scoring is a separate, swappable policy layer.

Install

pip install helixhash

# Optional: Ed25519 signing support
pip install helixhash cryptography

Metalayer cold-start (agents)

pip install is the library only — not institutional truth, not a paid confidence product.

Surface URL
Agent entry (llms.txt) https://geniusflow-federation.vercel.app/llms.txt
Free Mode A (cite → verify → package) https://kaydeep0.github.io/eigenstate-research/mode-a-walkthrough/
Public research face https://kaydeep0.github.io/eigenstate-research/

Pilot SKU stays DRAFT / not for sale. Layer 6 LIVE is not claimed. Sister library: witnessfield.

What it guarantees

HelixHash proves a sequence of bytestrings existed in this order at these times and has not been altered. It makes no claim about whether the bytestrings are true, meaningful, or correct. Evaluating the content is the job of a witness layer — see witnessfield.

Quickstart

from helixhash import HelixHash

h = HelixHash()
h.append(b"first event")
h.append(b"second event")
h.append(b"third event")

print(h.length)   # 3
print(h.head)     # SHA-256 of the last entry (64-char hex)
print(h.verify()) # True — chain is intact

Hash formula

Each entry's hash commits to: its index, its payload, its timestamp, its signer's public key (if signed), and the previous entry's hash.

SHA-256(
    index            (8 bytes, big-endian)
  | payload_length   (8 bytes, big-endian)
  | payload          (variable)
  | timestamp        (8 bytes, big-endian double)
  | pubkey_length    (2 bytes, big-endian; 0 if unsigned)
  | signer_pubkey    (0 or 32 bytes)
  | prev_hash        (64 ASCII bytes)
)

signer_pubkey is in the hash so that swapping an entry's public key breaks the chain immediately. verify() catches it.

Tamper detection

verify() replays the full chain in O(n). It catches:

  • Any change to a payload
  • Any change to a timestamp
  • Any change to a signer pubkey
  • Any reordering of entries
  • Any inserted or deleted entry
# Mutate a payload — verify() returns False
h._entries[1] = Entry(
    index=1, payload=b"tampered", timestamp=h._entries[1].timestamp,
    prev_hash=h._entries[1].prev_hash, hash=h._entries[1].hash,
    signature=None, signer_pubkey=None,
)
print(h.verify())  # False

Optional signing

Pass an Ed25519PrivateKey from the cryptography library to sign entries. The signature covers the entry hash. The signer's public key is stored in the entry and included in the hash.

from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey

key = Ed25519PrivateKey.generate()

h = HelixHash()
h.append(b"signed payload", signer=key)
print(h.verify())  # True — signature checks out

# Forge the signer key: replace pubkey in export
exported = h.export()
from base64 import b64encode
other_key = Ed25519PrivateKey.generate()
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
exported[0]["signer_pubkey"] = b64encode(
    other_key.public_key().public_bytes(Encoding.Raw, PublicFormat.Raw)
).decode()
h2 = HelixHash.from_export(exported)
print(h2.verify())  # False — pubkey swap breaks the hash

Export and import

import json

# Export to JSON-serialisable list
data = h.export()
json_str = json.dumps(data)

# Reconstruct from export
h2 = HelixHash.from_export(json.loads(json_str))
print(h2.head == h.head)   # True
print(h2.verify())         # True

from_export validates structural integrity (index order, timestamp monotonicity, prev_hash chain) before loading. Call verify() to additionally confirm hash integrity.

API reference

class HelixHash:
    def append(self, payload: bytes, signer=None) -> Entry
    def verify(self) -> bool
    def export(self) -> list[dict]

    @classmethod
    def from_export(cls, entries: list[dict]) -> "HelixHash"

    @property
    def head(self) -> str     # tip hash, or GENESIS_HASH if empty
    @property
    def length(self) -> int

@dataclass(frozen=True)
class Entry:
    index:         int
    payload:       bytes
    timestamp:     float          # unix seconds, monotonically increasing
    prev_hash:     str
    hash:          str
    signature:     Optional[bytes]
    signer_pubkey: Optional[bytes]

GENESIS_HASH: str = "0" * 64    # sentinel for first entry's prev_hash

Tests

pytest tests/test_helixhash.py -v

Honest limitations

  • time.time() is used for timestamps. If two appends happen within 1 microsecond, the second timestamp is bumped to previous + 1µs. Sub-microsecond ordering is not guaranteed.
  • Signing requires the cryptography package. Without it, signer=None works but signed entries cannot be verified.
  • from_export does not recompute hashes on load; call verify() to do the full integrity check.

License

MIT — Kirandeep Kaur, 2026

Release files for helixhash 1.0.1

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

Source distribution (sdist)

Source distribution for helixhash 1.0.1
File Size Uploaded
helixhash-1.0.1.tar.gz 13.0 kB Details

Built distribution (wheel)

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

Total release size: 21.9 kB

Release files / helixhash-1.0.1.tar.gz

Download URL helixhash-1.0.1.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cdbc71e0f473e874b10717c8c63a819550aa42451496cf968442768618678a54
BLAKE2b-256 checksum
How to use checksums
bf84711e4b9d62ac939cad6b3e3b48cef113fcfd36b629078f39732235b69585
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / helixhash-1.0.1-py3-none-any.whl

Download URL helixhash-1.0.1-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fdddf4a04eb41a99d7a243cccad4b4fb9b6832fcf216373566037f9f853bc476
BLAKE2b-256 checksum
How to use checksums
0cd4af15d8b540d11740097843a7c411fab481177e00737a3196e500150b6b9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.1.1

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