Docs / Architecture
Architecture and market rules
See what the SDK owns, what the reference application owns and where NEAR executes.
Three repositories, one SDK boundary
swarmkit-site swarmkit-market
documentation UI / policies / economy controller
| |
+---- near-swarmkit -----+
rounds / mechanisms / replay
approvals / settlement runner / audit
|
application-provided adapters
storage / participant auth / signing
|
NEAR testnet or Intents Verifier
SDK responsibilities
src/swarm holds the round engine, mechanisms, replay/storage contracts, simulation APIs, spending policies, settlement runner and NEAR adapters. It does not hold application credentials, request handlers or resource delivery logic. Its standalone package excludes the root Next.js dashboard dependencies.
Reference economy responsibilities
The market’s economy controller defines work demand, capacity consumption, seller quote policies, replenishment, money flows and event history. Its browser host uses IndexedDB with Web Locks; its local HTTP host uses SQLite, an operator token and conditional revision updates. Both consume the packaged SDK. The local host is a simulation coordinator, not a public production custody service.
Economic rules
- Collect replaceable buyer demand before demand closes.
- Bind each seller’s immutable offer with a SHA-256 commitment.
- Verify reveals against that commitment during the reveal window.
- Fill the complete pool within every buyer cap and every seller capacity, or make no allocation.
- Charge the quoted unit price for each allocated line.
- Settle independent buyer–seller payments. Preserve partial outcomes and reconcile uncertain transactions.
Single-seller procurement and split procurement use different clearing rules; see Mechanisms. The GPU market remains the original reference; inference and dataset examples exercise reuse.
On-chain boundary
Auction inputs, clearing and resource delivery remain off-chain. Native testnet evidence proves the recorded transfers. Intents execution moves balances in the Verifier. Neither proves delivery of the purchased resource. No SwarmKit escrow contract is deployed.
Releases and compatibility
The package remains an unpublished 0.1.0 release candidate. Build and install the tarball from source. Transcript version 1, settlement plan versions 1 and 2, and simulation checkpoint version 1 are distinct formats. Do not rewrite saved payment identities or silently swap mechanism versions. The old root dashboard remains a minimal SDK example; the standalone Market is the primary reference application.