DETERMINISTIC ENGINEERING PRINCIPLES
Reference implementation modeled with immutable domain contracts (Pydantic v2 with frozen=True and extra='forbid'), strict fixed-point monetary precision in Decimal(18, 4) (zero floating-point rounding risk), append-only relational audit logging (SQLite WAL), and deterministic test coverage.
1. Transactional Gateway Topology (Reference DAG)
graph TD
subgraph Ingesta [Real-Time Payment Instruction]
TX_IN[Payment Instruction] --> ESCLUSA[Pre-Settlement Quarantine Window 60s]
end
subgraph Aduana [Deterministic Edge Evaluation < 150ms]
ESCLUSA --> ZKP[ZKP Module: Blind Verification Art. 142 LIC]
ESCLUSA --> NOM151[Structured Evidentiary Record NOM-151]
end
subgraph Operativa [Preventive Kinetic Containment Rules]
ZKP --> COND{Unfamiliar / Cold Account?}
COND -- YES --> T01[Rule T-01: Fan-Out Dispersion Blocked]
COND -- YES --> ATM[Dynamic ATM Cash Cap: $2,500 MXN/h]
COND -- NO --> BANXICO[Standard Rail Settlement]
EMERGENCIA[Verified Medical Emergency] --> T02[Rule T-02: Vital Bypass Attestation]
T02 --> BANXICO
end
2. Immutable Domain Contracts (Python / Pydantic v2)
class PaymentInstructionDTO(BaseModel):
model_config = ConfigDict(frozen=True, extra='forbid', str_strip_whitespace=True)
tx_id: str = Field(..., pattern=r'^TX-[A-Z0-9_-]+$')
sender_clabe: str = Field(..., min_length=18, max_length=18)
receiver_clabe: str = Field(..., min_length=18, max_length=18)
amount: Decimal = Field(..., gt=Decimal('0.0000'), decimal_places=4)
cep_hash: str = Field(..., min_length=64, max_length=64)
has_prior_history: bool = Field(default=False)
is_medical_emergency: bool = Field(default=False)
class KineticThrottleDecisionDTO(BaseModel):
model_config = ConfigDict(frozen=True, extra='forbid', str_strip_whitespace=True)
tx_id: str
verdict: TransactionVerdict
allowed_atm_hourly_limit: Decimal = Field(default=Decimal('2500.0000'), decimal_places=4)
fan_out_blocked: bool = Field(default=True)
quarantine_seconds: int = Field(default=60)
nom151_record_sha256: str
reason: str
3. Forensic Relational Audit Schema (SQLite WAL)
CREATE TABLE IF NOT EXISTS audit_events (
event_id VARCHAR(64) PRIMARY KEY NOT NULL,
tx_id VARCHAR(64) NOT NULL,
sender_clabe VARCHAR(18) NOT NULL,
receiver_clabe VARCHAR(18) NOT NULL,
amount NUMERIC(18, 4) NOT NULL,
verdict VARCHAR(32) NOT NULL,
fan_out_blocked BOOLEAN NOT NULL DEFAULT 1,
atm_limit NUMERIC(18, 4) NOT NULL DEFAULT 2500.0000,
nom151_hash VARCHAR(64) NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_audit_tx ON audit_events (tx_id);
CREATE INDEX IF NOT EXISTS idx_audit_receiver ON audit_events (receiver_clabe);