How it works
- First party submits: Platform A sends an instruction without a
trade_reference. KeyStone generates one (format:KS-{uuid}). - Share the reference: Platform A shares the trade reference with Platform B through their own channels (email, chat, API, etc.).
- Second party submits: Platform B sends an instruction with the same
trade_reference. KeyStone finds the matching pending instruction. - Automatic matching: KeyStone validates that both instructions are compatible and creates a settlement with both parties confirmed.
Step 1: Submit the first instruction
The first party submits their side of the trade. Leavetrade_reference null to have KeyStone generate one.
Step 2: Share the trade reference
The trade reference (KS-abc123...) is shared between counterparties through their own communication channels. KeyStone does not handle this exchange - it is an out-of-band coordination step.
Common methods:
- Platform-to-platform API integration
- Pre-agreed trade reference via OTC desk
- Shared trade confirmation system
Step 3: Submit the matching instruction
The second party submits their instruction with the trade reference from Step 1.What matching validates
Both instructions must agree on:| Field | Validation |
|---|---|
template_slug | Must be identical |
role | Must be different (one seller, one buyer) |
| Instruments | Same set of instrument_id values |
| Quantities | Must match per instrument |
| Directions | Must be complementary (seller delivers what buyer receives) |
pending_match. It will not be automatically paired with the first instruction. The submitting platform can cancel it and resubmit with corrected details.
Cancellation
Cancel a pending instruction if it was submitted in error or the trade is no longer needed:status: pending_match can be cancelled. Matched or expired instructions cannot be cancelled.
Expiry
Instructions have a default 24-hour time-to-live. After expiry, they are no longer eligible for matching. This prevents stale instructions from accidentally matching with new ones submitted days later.Listing instructions
View your platform’s instructions:Single-platform use
Bilateral instructions work for single-platform settlements too. When both instructions come from the same platform, the settlement is created assingle_platform type. This is useful when your platform intermediates trades between its own users.
Cross-Chain Settlement
How bilateral instructions enable cross-chain DvP.
Direct Contract Integration
Bypass the API and call contracts directly.