Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.keystoneos.xyz/llms.txt

Use this file to discover all available pages before exploring further.

KeyStone’s smart contracts enforce settlement rules on-chain and operate autonomously after compliance. Platforms can verify every settlement independently by reading contract events from the blockchain.

Three contracts

ContractPurposeDeployment
SettlementCoordinatorState machine enforcement, transition validation, atomicity gate, auto-dispatch releasesOne instance on the coordinator chain
KeystoneEscrowLock, release, and rollback of deposits per settlement leg. Auto-notifies coordinator when all deposits complete.One instance per supported chain
ComplianceRegistryOn-chain compliance attestations as a gate for state transitionsOne instance on the coordinator chain

Design principles

  • No custody. KeyStone never holds funds. Escrow contracts have no admin keys, no upgrade authority, and no KeyStone-controlled withdrawal.
  • No chain dependency. The SettlementCoordinator can live on any EVM chain. It only needs EVM compatibility and LayerZero support for cross-chain messaging.
  • Assets never bridge. Bonds stay on Ethereum. USDC stays on Avalanche. Escrow contracts lock and release locally. Cross-chain coordination happens via messaging (LayerZero), not bridging.
  • Autonomous post-compliance. After compliance clears, the contracts handle deposits, execution, and finalization without KeyStone in the loop. Parties deposit directly using commitment secrets, escrow auto-notifies coordinator, coordinator calls executeSettlement with recipient addresses (revealed only at execution time).
  • Timeout safety. Anyone can call timeout() after the deadline to recover funds.

What lives on-chain vs off-chain

On-chain (trustless)Off-chain (KeyStone service layer)
Settlement creationInstruction matching
State machine enforcementCompliance screening (LSEG, CipherOwl)
Compliance gateCompliance attestation submission
Deposit gateWebhooks and notifications
Token deposits (lock)Trade reference generation
Auto-notification when all deposits completeDashboards and monitoring
Auto-dispatch releases
Atomic swap execution (release)
Rollback
Timeout
All state change events

Trust model

QuestionAnswer
Can KeyStone skip compliance?No - contract checks areAllPartiesCleared gate
Can KeyStone execute without all deposits?No - contract checks allLegsDeposited gate
Can KeyStone skip states?No - contract enforces registered transitions
Can KeyStone prevent timeout?No - permissionless call, anyone after deadline
Can an auditor verify independently?Yes - read contract events directly from the chain
Can a platform bypass KeyStone’s API?Yes - call contracts directly
If KeyStone goes down?Timeouts work, existing settlements can complete

Cross-chain architecture

Phase 1 (current): Single-chain. SettlementCoordinator and KeystoneEscrow deployed on the same chain. No LayerZero needed. Phase 2: Cross-chain. SettlementCoordinator on one chain, escrow contracts on every chain. LayerZero carries lock confirmations and release/rollback instructions between chains.

SettlementCoordinator

State machine, gates, atomicity, and auto-dispatch.

KeystoneEscrow

Per-chain deposit lock, auto-notification, release, and rollback.

ComplianceRegistry

On-chain compliance attestations.

Testnet Addresses

Deployed contract addresses on Sepolia.