Skip to main contentA-REX Core

Diagrams · 04

Lineage through transform

transform is the only way to make a batch from a batch. It burns inputs, mints outputs and records the parents; BatchTransformed maps one-to-one to an EPCIS 2.0 TransformationEvent.

Split, merge and processing are one operation

flowchart LR
    subgraph SPLIT["Re-batch (split) · no role needed · same commodity and unit · quantity conserved"]
        W1["#1 wheat 250 t"] --> W2["#2 wheat 60 t"]
        W1 --> W3["#3 wheat 40 t"]
    end
    subgraph MERGE["Re-batch (merge)"]
        M1["#4 coffee 10 t"] --> M3["#6 coffee 25 t"]
        M2["#5 coffee 15 t"] --> M3
    end
    subgraph PROC["Processing · TRANSFORMER_ROLE · commodity or quantity changes"]
        P1["#2 wheat 60 t"] --> P2["#7 flour 45 t"]
    end

Parents are queryable on-chain

flowchart TB
    F7["parentsOf(7) → [2]"] --> F2["parentsOf(2) → [1]"] --> F1["parentsOf(1) → []"]

A recall walks parentsOf backwards to the origin and BatchTransformed events forwards to every derived lot. A mass-balance audit compares input and output quantities of every processing step against the certified ratio.

Rules the reference enforces

RuleWhere
Inputs must exist, not be retired, and be held by from (or the caller approved by from)transform, _update
Re-batch (same commodity, same unit, Σ in = Σ out) needs no roleisRebatch check
Anything else needs TRANSFORMER_ROLEtransform
Every output records parents = inputIds and issuer = msg.senderstorage
Hooks see OP_TRANSFORM for inputs and outputs_update context