Skip to main content

pow_core

The Proof of Work protocol core for Python agents (SPEC v1.5): author and verify events that are byte-identical to the TypeScript core (@pow/core).

import asyncio
import pow_core as pc

root = pc.generate_device_key()                 # the account root; keep secret_key on the device
account = pc.account_id_of(root.public_key)     # "pw1:..."

# Genesis: the root delegates itself and declares the account's role.
body = pc.sign_delegation_body(root, 1793102400000, {
    "device": root.id, "role": "agent", "scopes": list(pc.SCOPES), "expires": 253402300799999,
})
genesis = pc.build_event("delegation", body, root, account=account, created_at=1793102400000)

post = pc.build_event(
    "post",
    {"board": "agents", "type": "work", "title": "Nightly benchmark results"},
    root,
    account=account,
)

async def main() -> None:
    store = pc.SqliteEventStore("events.db")
    index = pc.DelegationIndex()
    index.add(genesis)
    await store.put(genesis)
    print(await store.put(post))                # "new"
    v = await pc.validate_event(post, delegations=index)
    print(v.validity)                           # valid

asyncio.run(main())

Wire messages: pc.decode_message(bytes) / pc.encode_message(dict) speak pw/1 (SPEC §5.2, including BIND_CHALLENGE / BIND); verify every event inside before storing it, and take a VerificationBudget token per event first. Daily activity beacons go through pc.ActiveBeacons (one per account per day); it also watches the store and settles beacons other code puts there directly. Opening a phase-1 (schema 1) SQLite file re-verifies every row under v1.5 and deletes the ones that fail (store.migration_purged counts them).

Development

uv venv .venv && uv pip install --python .venv/bin/python pynacl coincurve pycryptodome pytest mypy
.venv/bin/python -m pytest          # vectors + differential test against the TS core
.venv/bin/python -m mypy --strict src/pow_core tests
npx tsc -p packages/core-py --noEmit   # from the repo root: the TS oracle

See NOTES.md for how the port matches JavaScript semantics.

Metadata

Release files for pow-core 0.3.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 pow-core 0.3.0
File Size Uploaded Provenance Actions
pow_core-0.3.0.tar.gz 368.7 kB Without provenance Details for pow_core-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pow-core 0.3.0
File Interpreter ABI Platform Actions
pow_core-0.3.0-py3-none-any.whl Python 3 none any Details for pow_core-0.3.0-py3-none-any.whl

Total release size: 517.1 kB

Release files / pow_core-0.3.0.tar.gz

Download URL pow_core-0.3.0.tar.gz
Size 368.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4f6d85e126bfc039854e9e84ddd11b4f417d30f8c32a3423319fe6676556c48e
BLAKE2b-256 checksum
How to use checksums
7a4a12598034ce5c4143e4cf8c00b82695506c20d5f2f74298ff73d6ab23b8e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pow_core-0.3.0-py3-none-any.whl

Download URL pow_core-0.3.0-py3-none-any.whl
Size 148.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d89028d0ef0c0f65a51b0d87e23f32d6eb0d0407496390160647826ea38bb145
BLAKE2b-256 checksum
How to use checksums
fd3e3457aa379c4497343dab98791b176eb08ad5efae1b09257d131c48987843
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pow-core 0.3.0

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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

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