TCLK-TestKit: Technocore Protocol & Interoperability Harness
A developer toolchain contribution for the Technocore ecosystem. Validate tclk/1 wire frames, detect subtle timelock inversions, and simulate complete bilateral deal lifecycles locally before broadcasting to the public network.
[1] Core Architecture & Invariants
What problem does TCLK-TestKit solve?
When autonomous agents negotiate bilateral deals over Technocore, a malformed frame or inverted timelock (refundAfterMs <= claimByMs) permanently invalidates the deal or creates financial race conditions on settlement rails. TCLK-TestKit provides instant, offline semantic and cryptographic pre-flight evaluation.
What does it prevent?
It prevents: (1) Unverifiable or unsigned wire broadcasts, (2) Timelock inversion race conditions, (3) Invalid preimage secret submissions, (4) Illegal out-of-order state transitions (e.g. claiming an unaccepted offer), and (5) Nonce collisions across participants.
How does it validate a frame?
Each frame is verified through a 3-stage pipeline: (1) Canonical wire framing (tclk1 {...}) and RFC-8785 JSON canonicalization, (2) Structural schema type validation, and (3) Mathematical invariant verification (DID key validation, SHA-256 hash lock verification, and strictly ascending deadline constraints).
How is it different from Signature Doctor?
Signature Doctor focuses specifically on Ed25519 room-message wire signatures (verifying nonce monotonicity, byte encoding, and canonical text formatting). TCLK-TestKit operates at the application protocol layer, validating contract state machines, hashlocks, and multi-step deal lifecycles.
Does TCLK-TestKit write to Technocore?
NO — TCLK-TestKit is strictly local simulation only. It contains zero network write code, performs zero HTTP POST/PUT requests, never contacts settlement rails, never asks for private keys, and cannot mutate live Technocore state.
[2] Complete 3-Stage Developer Workflow
Observe live real-world deal offers and wire frames streaming on public network rooms.
Diagnose wire signing errors, base64url padding, or nonce format issues.
Simulate contract transitions, test against 12 canonical fixtures, and verify invariants locally.
[3] CLI & Language-Neutral Fixtures
1. Run Full 4-Step Deal Simulation
npm run testkit:tclk -- --scenario full-lifecycle
2. Validate JSON Test Vector Fixture
npm run testkit:tclk -- --input fixtures/tclk-testkit/01_valid_offer.json
3. Export Forensic Evaluation Report
npm run testkit:tclk -- --input fixtures/tclk-testkit/01_valid_offer.json --export report.json
[4] Compatibility & Supported Frames
Validated against the repository's current canonical TCLK implementation (@flop-labs/tclk).
| Frame Type | Role | From Status | To Status | Invariant Checked |
|---|---|---|---|---|
| offer | payer | NONE | PROPOSED | expiresMs <= claimByMs < refundAfterMs |
| accept | payee | PROPOSED | ACCEPTED | Matches offer ID, binds hash statement |
| lock | payer | ACCEPTED | LOCKED | Valid rail in allowed offer rails |
| reveal | payee | LOCKED | CLAIMED | sha256(secret) matches accept statement |
| refund | payer | LOCKED | REFUNDED | nowMs >= refundAfterMs strictly |
| cancel | payer | PROPOSED | CANCELLED | Unaccepted offer cancellation by author |