SETTLEMENT_RISK_MODEL_LAYER.md
Purpose
Define a deterministic governance-level risk scoring model for settlement decisions without performing execution-layer operations.
Scope
This layer evaluates settlement risk from governance-visible inputs and returns controls that can be required by policy and authorization. It does not execute transfers, escrow, or KYC workflows.
Definitions
riskScore: integer in[0,100].riskBand: one ofLOW,MED,HIGH.requiredControls[]: governance controls required before or during settlement progression.- Input tuple:
(ledgerHistory, railType, custodyType, providerId, amountValue, assetKind, escrowMode).
Normative Rules
- Risk scoring MUST be deterministic and reproducible from the same inputs.
- Scoring MUST NOT use ML models, randomness, wall-clock entropy, or external network calls.
- Risk outputs MAY guide authorization decisions but MUST NOT mutate ledger state by themselves.
- Controls MUST be enforced through governance actions (for example via
ACCESS_DECISIONgating and policy rules).
Risk Factors
Each factor contributes integer points in [0,20].
- Counterparty Risk (
F_cp)
- INTERNAL trusted provider: 2
- known regulated provider: 6
- unknown/unrated provider: 14
- high-risk counterparty flag in history: 20
- Custody Risk (
F_cu)
PLATFORM: 8PARTNER_ESCROW: 12SELF_CUSTODY: 18
- Rail Finality Risk (
F_rf)
INTERNAL_LEDGER: 4BANK: 10VASP: 14BLOCKCHAIN: 16
- FX/Volatility Risk (
F_fx)` (asset-kind proxy)
- stable fiat-like asset: 3
- tokenized fiat/stable asset: 8
- volatile crypto asset: 16
- Operational Risk (
F_op) Derived from ledger history for samesubjectId/ provider class:
- no recent rail errors: 4
- one recent rail error: 10
- repeated rail errors: 18
- Compliance Risk (
F_co)
- full compliance profile known: 4
- partial profile: 10
- enhanced due diligence required: 18
Deterministic Scoring Formula
Weighted linear score:
raw = 0.18*F_cp + 0.17*F_cu + 0.20*F_rf + 0.17*F_fx + 0.14*F_op + 0.14*F_co
riskScore = round(5 * raw) then clamp to [0,100].
Band mapping:
LOWifriskScore <= 33MEDif34 <= riskScore <= 66HIGHifriskScore >= 67
Required Controls Mapping
Controls set is deterministic by band plus hard triggers.
Baseline by band:
LOW:require milestonesMED:require escrow,require milestones,require 2-person approvalHIGH:require escrow,require milestones,require 2-person approval,require enhanced KYC,require max amount caps,require delayed release
Hard triggers:
SELF_CUSTODY=> addrequire enhanced KYC- volatile crypto asset + high amount => add
require delayed release - repeated rail errors => add
require max amount caps
Policy Binding
- Policy referenced by
policyHashMAY declare minimum controls per risk band. ACCESS_DECISIONfor settlement actions SHOULD validate that required controls are satisfied before ALLOW.- Controls are governance preconditions; they are not execution commands.
Scenarios (Deterministic Examples)
Scenario 1: Low-risk internal settlement
Inputs:
- railType=
INTERNAL_LEDGER, custodyType=PLATFORM, provider known internal, asset stable fiat, no rail errors, full compliance.
Factors:
F_cp=2, F_cu=8, F_rf=4, F_fx=3, F_op=4, F_co=4raw = 0.18*2 + 0.17*8 + 0.20*4 + 0.17*3 + 0.14*4 + 0.14*4 = 4.15riskScore = round(5*4.15)=21,riskBand=LOW
Recommended controls:
require milestones
Scenario 2: Medium-risk bank settlement with partner escrow
Inputs:
- railType=
BANK, custodyType=PARTNER_ESCROW, known regulated provider, tokenized fiat/stable asset, one recent rail error, partial compliance.
Factors:
F_cp=6, F_cu=12, F_rf=10, F_fx=8, F_op=10, F_co=10raw = 9.14riskScore = round(5*9.14)=46,riskBand=MED
Recommended controls:
require escrowrequire milestonesrequire 2-person approval
Scenario 3: High-risk blockchain self-custody flow
Inputs:
- railType=
BLOCKCHAIN, custodyType=SELF_CUSTODY, unknown provider, volatile crypto asset, repeated rail errors, enhanced due diligence required.
Factors:
F_cp=14, F_cu=18, F_rf=16, F_fx=16, F_op=18, F_co=18raw = 16.40riskScore = round(5*16.40)=82,riskBand=HIGH
Recommended controls:
require escrowrequire milestonesrequire 2-person approvalrequire enhanced KYCrequire max amount capsrequire delayed release
Mapping to Code
- Authorization gates conceptually align with settlement authorization verifiers in
packages/core/settlement/verifySettlementAuthorization.tsandverifySettlementEventAuthorization.ts. - Lifecycle-sensitive controls conceptually align with
packages/core/settlement/verifySettlementLifecycle.ts. - Risk model output is governance advisory input; append/build record flows remain in
packages/core/settlement/*.
Non-normative Notes
- This model is intentionally arithmetic and policy-driven to preserve auditability.
- Factor scales can evolve only through explicit policy/document/version updates.
Testability
- Unit tests SHOULD verify identical input tuple yields identical
(riskScore, riskBand, requiredControls[]). - Boundary tests MUST verify exact transitions at scores 33/34 and 66/67.
- Scenario tests MUST reproduce the three worked examples exactly.
- Policy-binding tests SHOULD verify insufficient controls produce authorization denial for settlement actions.