Skip to main content

Pure PoUW decision algorithm — the fabric of knit decisions; zero dependencies, embeddable everywhere

Project description

knitfield — The Fabric of Decision

The pure, dependency-free reasoning engine behind Knitweb's Proof-of-Useful-Work settlement. Where individual decision threads (knits) are woven together into the proof fabric.

Design

knitfield answers one fundamental question: given a claimed proof of work, does it satisfy the job's verification policy and therefore warrant settlement?

Job Class Registry  →  (e.g., "synaptic-compile", "distill", "smart-contract-procedure")
                ↓
        Verification Policy  →  (e.g., "uniform" = deterministic; "split" = structural + challenge window)
                ↓
    Pure Decision Predicate  →  (e.g., split_settles: deterministic_ok AND window_closed AND NOT dispute_upheld)
                ↓
        Settlement Decision  →  (accept work, mint token reward, or slash)

Knitfield is embedded locally in every Knitweb node, running inside the node's process alongside its Fabric memory state. There is no central server — each peer independently applies knitfield's logic to weave decisions into the proof fabric, accepting or rejecting work proofs through the P2P network.

Architecture

src/knitweb_knitfield/
  __init__.py
  registry.py       — JobClass, register_job_class, job_class, verification_policy
  settlement.py     — split_settles (pure predicate for distill/split-verified work)

Zero Dependencies

Knitfield imports only Python stdlib. It carries no crypto, networking, or data-structure dependencies, so it can run in any context (IoT, embedded, pure Python, JVM via Jython, etc.) — the decision logic is universally portable.

Usage

from knitweb_knitfield import register_job_class, VERIFICATION_UNIFORM, split_settles

# Register a new job type
register_job_class("my-custom-job", VERIFICATION_UNIFORM)

# Query the registry
policy = job_class("my-custom-job").verification
assert policy == VERIFICATION_UNIFORM

# Pure settlement decision for split-verified work (distill, etc.)
is_settlement_ok = split_settles(
    deterministic_ok=True,
    window_closed=True,
    dispute_upheld=False,
)
assert is_settlement_ok is True

Integration with Knitweb

  • Heart (Knitweb/heart): depends on knitfield; exports the registry + settlement policy.
  • Vein (Knitweb/vein): depends on knitfield; registers the "smart-contract-procedure" job class.
  • Molgang (Knitweb/molgang): uses knitfield to decide work settlement in the P2P quorum.
  • Ledgerfield (Knitweb/ledgerfield): embeds knitfield in settlement nodes for DAO treasury decisions.

Docs

See docs/SETTLEMENT_POLICIES.md for a detailed explanation of VERIFICATION_UNIFORM vs VERIFICATION_SPLIT and how to compose new policies.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

knitweb_knitfield-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file knitweb_knitfield-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for knitweb_knitfield-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43323d5392dc6f616e8f11c61693422e1c807c028103cc89e5c5414ce5df9cdf
MD5 4d4f55bf0840f72c7b299a48811da53d
BLAKE2b-256 ea05b00cfe8b387284ef1ff513d0b0480bba426ed52e2f613e93608f4c75c72c

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