Архитектура
Capkin State Machine Principle
Why Capkin is a controlled state-machine notation.
Capkin State Machine Principle
Capkin is not generic prose and not just a test notation. It is a Gherkin-compatible protocol DSL where every accepted phrase maps into CAP primitives.
Machine
Principal
Capability
State
Input
Guard
Transition
Output
Commitment
TraceThe core shape:
State + Input + Capability + GuardSet -> State' + OutputCapkin adds readable declarations:
Background:
Given machine ComplianceGatedSwap
And principal DEX
And principal Compliance
And capability DEX may commit SwapInput
And capability Compliance may evaluate SwapInput
Scenario: CAPKIN-PROTOCOL-001
Given DEX commits SwapInput
When Compliance evaluates guard KycAndRiskPolicy
Then the machine transitions from Requested to ApprovedCompiler validation is the boundary between documentation and executable contract. If a line cannot be validated, it is not Capkin.
The principle:
Gherkin gives the scenario shell.
Capkin gives typed protocol meaning.
CAP gives deterministic execution and proof.This lets non-crypto teams describe behavior without knowing protobuf, Rust, chains, commitments or verifier internals. Domain extensions can add DEX, compliance, DAO, payment or VASP vocabulary without changing the CAP core.