When to use chains
Use chains when a workflow involves multiple governed steps that together prove an outcome:- AML/KYC workflows — screening, analyst review, final disposition
- Trade approval pipelines — pre-trade check, compliance review, execution authorisation
- Document verification — automated scan, human review, approval
- Multi-stage approvals — request, review, escalation, sign-off
How it works
1. Start a chain
Generate achain_id (UUID) in your orchestrating system and include it when recording the first decision:
chain_step: 1 (auto-assigned).
2. Add steps
Subsequent steps use the samechain_id. Optionally reference the previous step as parent_decision_id:
chain_step is auto-assigned (2, 3, …) unless you provide one explicitly.
3. Query the chain
chain_step order (ascending), not recorded_at order.
4. Verify the chain
Chain rules
Step auto-assignment
Whenchain_step is omitted, MeshQu auto-assigns the next number (MAX(chain_step) + 1). This is serialised per chain using an advisory lock to prevent race conditions.
If you need explicit control over step ordering — for example, to match an external workflow definition — provide chain_step in the request.
Parent linkage
parent_decision_id is optional and records why a step was created (causal lineage), not structural branching. Multiple steps can reference the same parent:
Verification scope
Each decision in a chain produces the same cryptographic receipt as standalone decisions (integrity hash + Ed25519 signature + optional Rekor anchor). The chain verification endpoint checks:- Individual receipt integrity — recomputes SHA-256 hash and compares (cryptographic proof)
- Step continuity — detects gaps in the step sequence (warning, not error)
- Parent linkage — confirms parents exist in the chain with lower step numbers
Chain structure (grouping, ordering, parent linkage) relies on database constraints and immutability triggers. Cryptographic proof of the chain as a unit (provable completeness and ordering without trusting the database) is planned for Phase 2.
Multi-actor chains
In AML and compliance workflows, different actors are responsible for different steps. Include anactor object on each POST /v1/decisions/record call to record who performed each step:
Step 1 — Automated screening:
actor.id is cryptographically bound to its step’s integrity hash. Auditors querying the chain can see exactly who acted at each step.
See the Actor Attribution guide for schema details and trust model considerations.
Mixed automated and manual steps
MeshQu treats form-submitted (manual) decisions identically to API-submitted (automated) decisions — same evaluation engine, same signed receipt. A chain can contain both:
The orchestrating system manages chain membership. After a form submission creates a decision, the orchestrating system records the next chain step referencing the form decision as parent.