CTRES v1.1 - published · Free to implement · 97 jurisdictions · Profiles reviewed with regulators

validator-lite · Apache License 2.0

Check a package before you submit it

validator-lite is the open validator for CTRES packages. It checks that a package is well formed and that it holds together - the Structural and Referential classes of validation defined in §11.

Scope · §11

Validation is defined by class, not by rule

validator-lite implements the two classes that depend only on the package itself and the published JSON Schema for records R1-R15 and the manifest.

What it checks

  • StructuralIs the package well formed?Required fields present; types and enumerations valid; manifest hashes match the files; the record types of the declared conformance level present (§10); R13 and R14 conform to their schemas, one statement per currency
  • ReferentialDoes the package hold together?Every payment references an instrument in R2 and a provider in R10, and every check reference resolves, once the module that defines them is in the package (§10); each transfer is booked once; statement totals agree with the records behind them; a revenue statement’s period lies within the manifest period, its product code is in the profile’s taxonomy, a correction references an existing statement, a venue count references a venue in R1, and authority_figure_ref resolves to a report reference in R12

A package that passes both classes is well formed and holds together at the level it declares (§10). That is not a claim of conformance: “CTRES Conformant” describes an implementation tested against a named conformance suite version (§13).

What it does not check

  • Profile conformanceDoes the evidence show the control operated under this jurisdiction’s rules?
  • StreamIs the stream complete, ordered and intact, and does the period package agree with it?
  • CompletenessIs anything missing that should be there?
  • Reconciliation against independent sourcesBank and provider statements, the chain for virtual assets, or an authority’s own central system.

These depend on the jurisdiction profile and on rules each authority sets: the catalogue of individual checks, their severities, the tolerances that separate a rounding difference from a discrepancy, and the materiality thresholds that make an exception reportable. They are maintained separately as a versioned conformance suite.

Conformance levels

A manifest may declare the level of §10 - level_1 Return,level_2 Evidence, level_3 Custody, level_4 Supervision - and validator-lite checks it (STR-09): every record type the declared level requires is listed in the manifest and present; atlevel_2 and above, R14 where any R13 line has channel = venue. References are resolved by level: a reference to a record type the declared level does not require, and that is not in the package, is reported as advisory rather than blocking. Without a declared level, STR-09 is skipped and nothing else changes.

Streams and reconciliation

The same records may be delivered as a stream of events with sequence numbers and daily checkpoints (§8.4). validator-lite checks the stream, and checks that the period package - the signed close of the period - agrees with it:

  • ctres-validate --stream events.ndjsonSTM-01 to STM-07: every line a valid event envelope; sequence numbers strictly increasing per stream, gaps and duplicates reported; each record against the schema of its record type; checkpoints that match the events seen and whose chain hash recomputes; updates and voids against an identifier seen earlier; and, with --max-latency, the latency of each event.
  • ctres-validate <package_dir> --reconcile events.ndjsonREC-01 to REC-04: every streamed record is in the package in its final state, every package record of a streamed type was streamed, the two agree field by field, and the manifest’s stream_checkpoints match the stream’s checkpoints.

Get started

Install, run, automate

validator-lite is a Python package. Install a tagged release directly from the repository and point it at a package directory.

1 Install

Install a tagged release
pip install "git+https://github.com/ctres-standard/[email protected]"

2 Validate a package

Readable list of findings
ctres-validate <package_dir>

3 Automate

The same findings as JSON, for pipelines
ctres-validate <package_dir> --json

What a package is

A directory holding one JSON Lines file per record type and a manifest.json with a SHA-256 hash per file (§8.2).

Package layout
<package_dir>/
├── manifest.json
│     licence · profile and version
│     period · record counts
│     SHA-256 per file
└── one .jsonl file per record type
      UTF-8 · one record per line

Demonstration package

The repository includes a synthetic demonstration package. Its values are illustrative, like the examples in Annex C, and are not drawn from any operator. Run the validator on it to see the output before preparing your own package; the repository README gives its location.

Conformance suite

Request access to the conformance suite

The Profile conformance and Completeness classes are tested against a named suite version and a named profile version, so that the result can be reproduced later.

  • For authorities: available for evaluation.
  • For operators: available for self-checking before submission.
  • Never a condition: an implementation validated by any other means is equally conformant.

Tell us who you are and what you intend to test. Requests are answered by the editor. You can also write to [email protected].

Fields marked with an asterisk are required.

Your message is sent by email to [email protected] and is used only to reply to you.