{
  "tool_id": "art-595-ap2-cartmandate-hashchain-builder",
  "tool_version": "1.0.0",
  "display_name": "AP2 CartMandate Hash-Chain Builder",
  "mcp_name": "build_ap2_cartmandate_hashchain",
  "mandate_type": "payment_policy",
  "wave": 99,
  "gpu": false,
  "url": "https://ainumbers.co/chaingraph/art-595-ap2-cartmandate-hashchain-builder.html",
  "description": "Builds an illustrative Google AP2 CartMandate Verifiable Digital Credential (VDC) skeleton whose credentialSubject carries a deterministic hash-chain over an ordered list of cart line items: link_0 = keccak256(canon({index:0,item})), link_i = keccak256(canon({index:i,item,prev:link_(i-1)})), cart_root = the final link. Reuses this repo's existing RFC 8785/JCS canonicalization (cgCanon, from _hash.mjs) and the already-vendored @noble/hashes keccak256 bundle -- no new vendoring, no hand-rolled canonicalization or hashing. Stands beside art-16 (Google AP2 Mandate Builder) as a new node, not an edit to it -- art-16's flat CheckoutMandate/PaymentMandate shape has no line-item array to chain over. An intact chain proves the ordered cart_items list was not altered after the chain was built; it does NOT prove human authorisation, delivery, settlement, or that item prices are correct or current. Given a prior chain's per-item links (claimed_links) and a (possibly tampered) cart_items, the kernel recomputes and reports CART_CHAIN_INTACT plus the earliest divergent index, never a thrown exception. Zero network calls; never a facilitator, proxy, gateway, or settlement relay.",
  "input_schema_ref": "chaingraph/art-595-ap2-cartmandate-hashchain-builder.html#manifest",
  "consumes": [],
  "feeds": [
    "art-596-ap2-x402-cart-correlation"
  ],
  "status": "live",
  "conformance_fixtures": true,
  "compute_capability": "server",
  "compute_images": [
    {
      "system": "sha256-source",
      "image_id": "sha256:b0b1ed06bbeb16d1227f7073af8e46c323bff835b503b0d2f3a7231baa44803e",
      "valid_from": "2026-07-10"
    },
    {
      "system": "risc0",
      "image_id": "sha256:a1a0bc89b5b1febaeda3519f6dbade0fa5ac16beeb143c4e1b01689573567bc6",
      "valid_from": "2026-08-20"
    }
  ],
  "export_capability": [
    "json"
  ],
  "standards_basis": "not_applicable",
  "cited_clause_digest": [],
  "compute_proof_ready": "ready",
  "deferred_reason": "Prove attempted 2026-08-13 (PROVE-8-DEFERRED-0812-1) and FAILED: the guest returns an error journal {error:\"ocg_run\",code:-3} with a stack at utf8ToBytes <- _canonBytes <- compute, so run_verify refuses at cgv_undefined rather than stage a proof over an error journal. Deterministic guest error (art-476/art-607 signature); not retried. Root cause unresolved; needs a diagnosis row.",
  "compute_proof": {
    "type": "ZkVmReceipt",
    "system": "risc0",
    "receiptFormat": "groth16-bn254",
    "imageId": "sha256:a1a0bc89b5b1febaeda3519f6dbade0fa5ac16beeb143c4e1b01689573567bc6",
    "seal": "Gk2PjTg1f7RVdBVvyeDTtt6h6Nlbsefboej85qP8hOon2GaypFdhHjQg0vR4ugaTmfxSDAK8gK0P/mnhwiIJuiMZbniD3o24RkOJ9NueNwcEL06EhTZk07nNa1IsSS7aFUQPCWanNEn2emX6/XMnybPlzHv/Fu7YP4l2WnG3ArIAwy540MgEGTPHuhRqkz2Z2+mDu5m+i5GQkkqoswOeYhzb8LxjFMaH1RsX7SkkO91nf6OhMB72F//WzVDszxlqKsE53DbWDTVPTsee/bjhwLCFq2ulgk09+jnFO/ZNx0MLzshJSpft/hv463HGK6EdY/lGJr8b3o2LZETjRdMqTA==",
    "journal": {
      "chaingraph_version": "0.4.0",
      "kernel_digest": "sha256:b0b1ed06bbeb16d1227f7073af8e46c323bff835b503b0d2f3a7231baa44803e",
      "output": {
        "cart_chain_intact": false,
        "cart_root": "0x4254fc9cc00df63f6c8157e31682b1abde3b6e0337f5923970164ab1a52340b1",
        "chain_length": 2,
        "chain_links": [
          "0xfce9e5feb64ec005b5f801ecf528a63503dd72c23bf12783816a527f5cfaf05f",
          "0x4254fc9cc00df63f6c8157e31682b1abde3b6e0337f5923970164ab1a52340b1"
        ],
        "first_divergent_index": 1,
        "note": "Illustrative AP2 CartMandate hash-chain skeleton (external Google AP2 payments-protocol shape, ap2-protocol.org) -- distinct from the AINumbers Policy Mandate. This chain proves the ordered cart_items list was not altered after the chain was built -- nothing more. It does NOT prove the mandate was authorised by a human, that goods were delivered, that the merchant accepted the cart, that any payment occurred, or that item prices are correct or current (unit_price is caller-supplied, unchecked against any catalog). Zero network calls; never a facilitator, proxy, gateway, or settlement relay. Sign with the agent key and verify against the live AP2 spec before real use.",
        "reasons": [],
        "vdc": {
          "@context": [
            "https://www.w3.org/ns/credentials/v2",
            "https://ap2-protocol.org/context/v1"
          ],
          "credentialSubject": {
            "cart_items": [
              {
                "currency": "USD",
                "description": "Widget",
                "quantity": 2,
                "sku": "SKU-100",
                "unit_price": 9.99
              },
              {
                "currency": "USD",
                "description": "Gadget",
                "quantity": 1,
                "sku": "SKU-200",
                "unit_price": 999
              }
            ],
            "cart_root": "0x4254fc9cc00df63f6c8157e31682b1abde3b6e0337f5923970164ab1a52340b1",
            "chain_length": 2,
            "id": "did:example:subject-001",
            "mandateType": "cart",
            "merchant": "shop.example.com",
            "stage": "open"
          },
          "issuer": "did:example:agent-001",
          "proof": {
            "cryptosuite": "eddsa-2022",
            "proofPurpose": "assertionMethod",
            "proofValue": "<ILLUSTRATIVE — sign with the agent key>",
            "type": "DataIntegrityProof",
            "verificationMethod": "did:example:agent-001#key-1"
          },
          "type": [
            "VerifiableCredential",
            "CartMandate"
          ]
        },
        "vdc_type": "CartMandate"
      }
    }
  }
}
