Skip to main content

logicnodes-pol

Reference verifier and signer for POL/1.0 (Proof-of-Logic) — an open standard for verifiable work receipts in a machine-to-machine economy.

A POL receipt is a small signed attestation that a defined condition was deterministically evaluated against a worker's output and produced a verdict. Verification is a pure function of the receipt and the issuer's public signer address — no secret, no account, and no network call required.

Install

pip install logicnodes-pol

Verify a receipt (Python)

from logicnodes_pol import verify_receipt

receipt = {
    "payload": {
        "receipt": "0x77102c0e...",
        "escrow_id": "0xa8bff8e8...",
        "agent": "example-worker",
        "output_hash": "0x839ee4b2...",
        "verified": True,
        "amount_usdc": 0.01,
        "settlement_tx": None,
        "chain": "base",
    },
    "signature": {
        "standard": "EIP-191",
        "signer": "0x0D12B2B82e4aE84A15a032C31C6A8a23520Ecde7",
        "payload_hash": "0xe2dc732e...",
        "signature": "6738841a...",
    },
}

result = verify_receipt(receipt)
print(result.verified)            # True
print(result.recovered_signer)    # 0x0D12B2B82e4aE84A15a032C31C6A8a23520Ecde7
print(result.payload_hash_matches)  # True

If any field in the signed body is altered after signing, payload_hash_matches becomes False and verified becomes False — the receipt is rejected even though the signature itself is still mathematically valid over the original hash.

Verify from the command line

# verify a receipt file against the default logicnodes.io issuer
pol verify receipt.json

# verify against a different issuer signer
pol verify receipt.json --signer 0xYourIssuerSigner

# machine-readable output
pol verify receipt.json --json

# read from stdin
cat receipt.json | pol verify -

# print the canonical payload_hash of a receipt body
pol hash receipt.json

pol verify exits 0 on PASS and 1 on FAIL, so it composes in CI and shell pipelines.

Sign a receipt (POL/1.0-Producer)

from logicnodes_pol import sign_receipt

signed = sign_receipt(
    {"receipt": "0x...", "verified": True, "agent": "my-worker", "amount_usdc": 0.01, "chain": "base"},
    private_key="0x...",
)

How verification works (POL/1.0 §05)

  1. Canonicalize the signed body: JSON with sort_keys=True, compact separators, _verification key dropped.
  2. Hash: payload_hash = "0x" + sha256(canonical).
  3. Recover: EIP-191 encode_defunct(hexstr=payload_hash) → ecrecover the signer.
  4. Decide: a receipt is verified when the derived hash equals the claimed payload_hash and the recovered signer equals the expected issuer.

This library implements both the POL/1.0-Verifier and POL/1.0-Producer conformance profiles.

Metadata

Release files for logicnodes-pol 1.0.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 logicnodes-pol 1.0.0
File Size Uploaded Provenance
logicnodes_pol-1.0.0.tar.gz 6.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for logicnodes-pol 1.0.0
File Interpreter ABI Platform
logicnodes_pol-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.6 kB

Release files / logicnodes_pol-1.0.0.tar.gz

Download URL logicnodes_pol-1.0.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a6fd43400957980c1921df1cac7edce4c428be81e962f4258cf75509a2bac4c6
BLAKE2b-256 checksum
How to use checksums
c4483c1d9546bffb0482269481763a0846e8cdfbe90fb8b6a9f7e2722a15136a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release files / logicnodes_pol-1.0.0-py3-none-any.whl

Download URL logicnodes_pol-1.0.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a0ca40beb3a70f60ba463313d00739dd3a501eefcf6ed7315be92454d59943f
BLAKE2b-256 checksum
How to use checksums
12a87ebfe127186bc23ed1d108677bba4266bcdf6bbcbb0f15be5e92fab8aed0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Security for logicnodes-pol 1.0.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.

Release history Release notifications | RSS feed

This release

1.0.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