What cost attribution invariants must survive multi-hop reference propagation?

**Date of Record:** 2026 October 27 **Scope:** Applies when references (URIs, capability descriptors, or resource pointers) propagate through multi-hop chains, and each hop adds cost (bandwidth, compute, storage, verification overhead) that must be attributed to some party or shared according to a policy. Does not apply to single-hop propagation or free references.

Core Distinction

The separation between **reference propagation** (the reference reaches downstream agents) and **cost attribution** (the cost of each hop is explicitly attributed to a party according to policy). Relying on propagation creates the **Free-Riding Hazard**: some agents benefit from references propagated by others without contributing to the propagation cost, or agents that propagate heavily subsidize those that do not, causing propagation infrastructure to collapse as rational agents stop participating.

What Was Observed

In decentralized reference networks, failing to attribute costs produces three primary failure modes:

  1. **Tragedy of Propagation:** Heavy propagers spend more on bandwidth and verification, but receive no compensation from heavy consumers. Over time, propagers stop propagating, and the network's reference flow collapses.
  2. **Unaccounted Verification Cost:** Each hop re-verifies the reference (signature check, resolution check), and the aggregate verification cost is significant but invisible. Consumers see only the terminal reference and have no idea what verification was performed or by whom.
  3. **Hidden Value Extraction:** A large consumer benefits from many references without contributing any themselves, becoming a net extractor. If too many agents behave this way, the network's incentive structure breaks.

Recorded Elements

  1. **`per_hop_cost_receipt`:** For each hop in the reference chain, the exact cost incurred (bandwidth bytes, verification compute, storage), signed by the hop's operator.
  2. **`cost_attribution_policy_signature`:** The exact policy for how costs are attributed (e.g., "origin pays all," "consumers pay pro-rata," "propagators pay for their own hops"), signed by the network's governance.
  3. **`cost_settlement_receipt`:** For each reference, the cryptographic proof of which parties paid which portions of the total cost, whether through direct payment or credit systems.
  4. **`propagation_ledger_hash`:** The cryptographic hash of the aggregate propagation ledger, allowing any participant to verify that costs are being attributed according to policy.

Condition of Validity

* **Applies when:** References propagate through multi-hop chains, hops incur real costs, and agents can choose whether to propagate. * **Does not apply when:** Propagation is free, single-hop, or costs are shared uniformly by all agents (e.g., cooperative infrastructure).

Decision Boundary

  1. **Does the reference traverse multiple hops?** If no, single-hop cost attribution applies. If yes, proceed.
  2. **Is the `cost_attribution_policy_signature` established?** If no, costs are unattributed, and free-riding is inevitable. The network must set policy.
  3. **Does each hop include a `per_hop_cost_receipt`?** If no, individual hop costs cannot be tracked. The network must require receipts.
  4. **Conversely, when can costs be propagated without attribution?** Only when the network has a cooperative cost-sharing mechanism (e.g., community-funded infrastructure), or when agents explicitly accept unaccounted costs as part of network membership.

Operational Effect

  1. **Free-Riding Prevention:** Cost attribution makes each party's contribution visible, preventing free-riding.
  2. **Verification Transparency:** Per-hop costs surface the otherwise invisible verification overhead.
  3. **Sustainable Propagation:** Agents that propagate receive compensation, sustaining the network.
from dataclasses import dataclass
from enum import Enum, auto
import hashlib
import json

class CostVerdict(Enum):
    SINGLE_HOP = auto()
    COST_ATTRIBUTED = auto()
    POLICY_MISSING = auto()
    COST_ATTRIBUTION_INCOMPLETE = auto()

@dataclass(frozen=True)
class HopCost:
    hop_id: str
    cost_units: float
    cost_type: str  # "BANDWIDTH" | "COMPUTE" | "STORAGE"

@dataclass(frozen=True)
class ReferenceChain:
    reference_id: str
    hop_costs: tuple[HopCost, ...]
    attribution_policy: str | None  # "ORIGIN_PAYS" | "CONSUMER_PAYS" | "PROPAGATOR_PAYS"

@dataclass(frozen=True)
class CostPolicy:
    require_attribution_policy: bool

@dataclass(frozen=True)
class CostManifest:
    verdict: CostVerdict
    total_cost: float
    directive: str
    manifest_digest: str

class ReferenceCostAttributionGuard:
    @staticmethod
    def _hash(data: str) -> str:
        return hashlib.sha256(data.encode("utf-8")).hexdigest()

    @classmethod
    def evaluate_chain(
        cls, chain: ReferenceChain, policy: CostPolicy
    ) -> CostManifest:
        
        # Gate 1: Single hop
        if len(chain.hop_costs) <= 1:
            total = sum(h.cost_units for h in chain.hop_costs)
            digest = cls._hash(json.dumps({
                "reference": chain.reference_id,
                "hops": str(len(chain.hop_costs)),
                "cost": f"{total:.2f}"
            }, sort_keys=True))
            return CostManifest(
                verdict=CostVerdict.SINGLE_HOP,
                total_cost=total,
                directive=f"PROCEED: Single hop, cost {total:.2f} attributed to hop.",
                manifest_digest=digest
            )

        # Gate 2: Policy presence
        if policy.require_attribution_policy and not chain.attribution_policy:
            return CostManifest(
                verdict=CostVerdict.POLICY_MISSING,
                total_cost=sum(h.cost_units for h in chain.hop_costs),
                directive=f"HALT: Multi-hop chain without attribution policy. Free-riding risk.",
                manifest_digest=cls._hash(f"NO_POLICY:{chain.reference_id}")
            )

        # Gate 3: Hop completeness
        if any(not h.hop_id for h in chain.hop_costs):
            return CostManifest(
                verdict=CostVerdict.COST_ATTRIBUTION_INCOMPLETE,
                total_cost=0.0,
                directive=f"HALT: Some hop costs lack hop attribution.",
                manifest_digest=cls._hash(f"INCOMPLETE:{chain.reference_id}")
            )

        # Gate 4: Attributed
        total = sum(h.cost_units for h in chain.hop_costs)
        digest = cls._hash(json.dumps({
            "reference": chain.reference_id,
            "hops": tuple(h.hop_id for h in chain.hop_costs),
            "total": f"{total:.2f}",
            "policy": chain.attribution_policy
        }, sort_keys=True))
        
        return CostManifest(
            verdict=CostVerdict.COST_ATTRIBUTED,
            total_cost=total,
            directive=f"PROCEED: Total cost {total:.2f} attributed across {len(chain.hop_costs)} hops per {chain.attribution_policy}.",
            manifest_digest=digest
        )