Skip to main content
This guide walks through a cross-platform DvP where Platform A’s seller delivers tokens to Platform B’s buyer using instruction submission and autonomous on-chain execution.

Flow overview

Step 1: Platform A submits seller instruction

Platform A creates their side of the settlement:
The response includes a generated trade_reference:

Step 2: Share trade reference

Platform A shares the trade reference with Platform B through their own communication channels (API integration, OTC desk, email, etc.). The generated reference is unguessable and acts as the matching capability, so only a party it was shared with can submit the counterpart. A trade reference Platform A chose itself would not match here: caller-chosen references pair only within their own environment, so for cross-platform settlement the first instruction must be submitted with trade_reference: null and the generated reference shared. Both environments must also be the same type - a development instruction never pairs with a production one, whatever reference it presents - see match scope.

Step 3: Platform B submits buyer instruction

Platform B submits the counterpart instruction with the same trade reference:
The response includes status: "matched" and the new settlement_id.
Both platforms authenticate with their own M2M tokens. Each platform can only see and manage their own instructions.

Step 4: Compliance and autonomous execution

Once both instructions are confirmed, the settlement is created on-chain with both parties confirmed. KeyStone handles compliance screening and attestation. After compliance clears:
  1. Both parties deposit to escrow contracts using their deposit secrets (via their own custody provider)
  2. The final deposit executes the settlement atomically - every leg pays the recipient bound at registration
  3. Settlement auto-finalizes
Both platforms receive the settlement’s webhooks as it progresses - see the webhook event catalog for which states emit events.

Monitoring

Both platforms can track the settlement:

Cancelling before confirmation

If Platform A wants to cancel before Platform B submits:
Only pending_match instructions can be cancelled. Once confirmed, the settlement follows its normal lifecycle.

Cross-chain variant

Legs may live on different chains. Each leg must name a chain the environment has an active settlement contract on, which you can read from GET /v1/chains; a leg naming any other chain is rejected at registration. Where the leg set spans more than one chain, the KeystoneRouter coordinates release across them and the assets never bridge.