Provable media #

What is new: a rendered video comes with a proof anyone can re-check, not a label. The proof says which scene it was made from, what was measured about it (here: every object's mask against the scene's exact geometry), and who signed it. A licence decides who may use a character before any work starts. When a likeness or a licence is withdrawn, the revocation follows the lineage to every frame that came from it, and the public status flips.

Why it matters: media provenance today is mostly metadata that can be stripped or forged, and takedowns are manual. Here the claims are recomputed from evidence on every check, licences are enforced at the gate, and a revocation reaches exactly the works derived from what was revoked: no more, no less.

A signed attestation of a scene render #

import base64, hashlib, json
from pathlib import Path
from tensorchain import issuers, provenance, site
from tensorchain.workspace import Workspace

reg = issuers.Registry("issuers")                  # issuer keys: Ed25519, mode-600 files, hash-linked key logs
reg.create("engine:media")
reg.create("owner:studio")
ws = Workspace("media.sqlite", actor="agent:docs")

# The evidence a scene render produces (meta per frame, the render job's checks, the prompts), in miniature: one
# object whose mask box is 1/1000 off its exact projected box and whose depth equals the ray cast.
frames = [{"frame": f, "objects": [{"id": 1, "name": "ball", "prompt": "a glossy red ball", "visible_px": 900}]}
          for f in (1, 2)]
checks = [{"frame": f, "id": 1, "box_e3": [100, 300, 300, 600], "mask_box_e3": [101, 300, 300, 600],
           "pass_mm": 5700, "ray_axis_mm": 5700, "hit": "ball"} for f in (1, 2)]
evidence = {"meta": "".join(json.dumps(m) + "\n" for m in frames).encode(),
            "report": json.dumps({"frames": 2, "checks": checks,
                                  "repeat": {"index_depth_identical": True, "meta_identical": True}}).encode(),
            "prompts": json.dumps({"shot": "s", "frames": ["a glossy red ball", "a glossy red ball"]}).encode()}
video = b"the rendered video bytes"
video_sha = hashlib.sha256(video).hexdigest()
att = provenance.attest(ws, reg, "engine:media", {"beauty": video_sha}, "media.scene-render.v1", evidence)
v = provenance.verify_attestation(ws, reg, att, resolve={video_sha: video}.get)
print("attestation ->", v["status"], "| max mask error", v["claims"]["agreement"]["box_max_e3"], "/1000")
assert v["status"] == "valid"
tampered = provenance.verify_attestation(ws, reg, att, resolve={video_sha: video + b"!"}.get)
print("one byte changed in the video ->", tampered["status"], tampered["reasons"])
assert tampered["status"] == "invalid" and "subject:beauty" in tampered["reasons"]
Output (captured at build)
attestation -> valid | max mask error 1 /1000
one byte changed in the video -> invalid ['subject:beauty']

A licence, checked before any work #

face = hashlib.sha256(b"the character's reference face").hexdigest()
provenance.register_asset(ws, reg, "owner:studio", face, "character/pilot")
provenance.license(ws, reg, "owner:studio", face, "engine:media", ["render", "animate"], 1_900_000_000_000)
for licensee, use in (("engine:media", "render"), ("engine:media", "train"), ("studio:other", "render")):
    g = provenance.gate(ws, reg, face, use, licensee, now_ms=1_800_000_000_000)
    print("%-13s %-7s -> %s" % (licensee, use, g["code"]))
assert provenance.gate(ws, reg, face, "render", "engine:media", now_ms=1_800_000_000_000)["allowed"]
assert provenance.gate(ws, reg, face, "train", "engine:media", now_ms=1_800_000_000_000)["code"] == "use_not_licensed"
Output (captured at build)
engine:media  render  -> licensed
engine:media  train   -> use_not_licensed
studio:other  render  -> licence_required

The likeness is withdrawn: the revocation reaches what was made from it #

# The frames made from the face (in an Engine run these edges come from the media ledger: input -> output per step)
frame_a, frame_b = (hashlib.sha256(t).hexdigest() for t in (b"frame a", b"frame b"))
shot = hashlib.sha256(b"the animated shot").hexdigest()
edges = [(face, frame_a), (face, frame_b), (frame_a, shot), (frame_b, shot)]
lock = ('pipeline = "roto.v1"\nspec_sha256 = "%s"\nshot_sha256 = "%s"\n\n[outputs]\nshot = "%s"\n'
        % ("1" * 64, "2" * 64, shot)).encode()
render = {"pipeline_id": "roto.v1", "spec_sha256": "1" * 64, "shot_sha256": "2" * 64, "status": "ok", "steps": 3,
          "steps_total": 3, "outputs": [{"name": "shot", "sha256": shot}]}
anim = provenance.attest(ws, reg, "engine:media", {"shot": shot}, "media.pipeline-run.v1",
                         {"lock": lock, "render": json.dumps(render).encode()})
provenance.revoke(ws, reg, "owner:studio", face, "asset", "the actor withdrew consent for this likeness")
imp = provenance.impact(ws, reg, face, edges)
print("affected:", len(imp["affected"]), "digests | attestations reached:", len(imp["attestations"]),
      "| the animation's:", imp["attestations"] == [anim])
print("the animation  ->", provenance.verify_attestation(ws, reg, anim, affected=imp["affected"])["status"])
print("the scene still ->", provenance.verify_attestation(ws, reg, att, affected=imp["affected"])["status"])
print("the gate now   ->", provenance.gate(ws, reg, face, "render", "engine:media")["code"])
assert set(imp["affected"]) == {face, frame_a, frame_b, shot}
assert provenance.verify_attestation(ws, reg, anim, affected=imp["affected"])["status"] == "revoked"
assert provenance.verify_attestation(ws, reg, att, affected=imp["affected"])["status"] == "valid"
assert ws.verify()["ok"]                            # nothing was deleted: revocation is a new, signed record
Output (captured at build)
affected: 4 digests | attestations reached: 1 | the animation's: True
the animation  -> revoked
the scene still -> valid
the gate now   -> asset_revoked

The public status #

site.publish(ws, att)
site.publish(ws, anim)
res = site.build_site(ws, reg, "public", affected=imp["affected"], now_ms=1)
print("published:", res["published"], "| statuses:", sorted(res["statuses"].values()))
entry = json.loads(Path("public/verify/%s.json" % anim).read_text())
print("public entry:", entry["status"], "| revoked by", entry["revoked_by"])
assert res["statuses"] == {att: "valid", anim: "revoked"}
assert all(p.suffix != ".key" for p in Path("public").rglob("*"))
Output (captured at build)
published: 2 | statuses: ['revoked', 'valid']
public entry: revoked | revoked by ['subject:shot']

The same files are what https://tensorchain.io/verify/ serves: the page re-checks every signature in the visitor's browser (WebCrypto Ed25519 over DSSE's PAE), so the status is not taken on the server's word. The Engine runs this chain for real renders (ll/Engine/scripts/media-receipt): the scene render attested, pilot licensed and gated before any GPU work, revoked in a copy with an impact equal to the media ledger's own closure, and a revocation shown live on tensorchain.io (docs/PROVENANCE-V1.md, T2-T6).