Shardy x Stellar Technical Architecture
Shardy combines a browser-native compute plane (WebGPU/WASM workers with local Groth16 proof generation), an orchestration plane (Bun + libp2p dispatch, telemetry, redundancy, and result reconciliation), and a Stellar settlement plane (Soroban contracts for task escrow, staking, slashing, epoch settlement, and payout routing). Heavy compute and proof generation remain off-chain for latency and cost efficiency; economically critical state transitions are finalized on Stellar. Submitters pre-fund jobs in XLM or Stellar-issued assets, workers and orchestrators lock collateral, and verified task batches are settled through auditable onchain events and payouts. In this design, Stellar is not an add-on - it is the mechanism that makes Shardy’s verifiable compute market production-usable.
This document defines the planned grant scope for the Stellar-native economic layer. It is intentionally technical and self-contained so the integration boundary, contract responsibilities, and delivery targets can be evaluated without reference to token or sovereign-L1 narratives elsewhere in the public material.
1. System Overview
Shardy is organized around four cooperating planes:
- Compute plane: Browser-native workers execute WebGPU and WASM workloads, persist local scratch state in OPFS, and generate Groth16 proofs tied to result digests.
- Control plane: The Bun-based orchestrator accepts jobs, benchmarks workers, dispatches tasks, verifies outputs, handles redundancy, and advances the task lifecycle.
- Gossip plane: libp2p networking propagates worker presence, verification certificates, and peer coordination signals across the mesh.
- Settlement plane: Soroban contracts finalize the economically critical state transitions for job funding, collateral custody, slashability, payout routing, and public receipts.
Existing Shardy architecture mapped to the grant
| Plane | Current role in Shardy | Grant-era role with Stellar |
|---|---|---|
| Compute plane | Executes jobs inside browser workers using WebGPU/WASM and local proof generation. | Continues to run off-chain for performance, but emits results that become settlement inputs. |
| Control plane | Dispatches tasks, verifies results, handles telemetry, and manages redundancy. | Produces the verified batch data that the settlement plane finalizes on Stellar. |
| Gossip plane | Propagates presence and coordination across the mesh. | Continues peer coordination while exposing settlement-relevant state to public observers. |
| Settlement plane | Not yet productionized on Stellar. | Adds escrow, stake custody, slash execution, epoch settlement, and payout routing. |
2. Soroban Contract Suite
The grant scope centers on five contracts. The names below are canonical and should remain consistent across docs, dashboards, SDKs, and milestone reporting.
| Contract | Primary responsibility | Notes |
|---|---|---|
| TaskEscrow | Holds pre-funded job value in XLM or a Stellar-issued asset until verified settlement. | The job cannot move to economic finality without this contract. |
| WorkerRegistry | Registers workers and orchestrators, stores role metadata, and exposes the contract-level identity surface for settlement flows. | Keeps the settlement layer aligned with the runtime roles already present off-chain. |
| StakeVault | Custodies collateral for workers and orchestrators and manages lock, unlock, and slash availability state. | Supplies the economic penalty path required for dishonest behavior. |
| SettlementEpoch | Batches verified task outcomes into a compact settlement record for payout and dispute processing. | Keeps the chain-facing footprint manageable while preserving auditability. |
| FeeRouter | Routes worker payouts, orchestrator fees, treasury allocations, and slash outcomes. | Emits contract events that downstream indexing can consume. |
3. Off-chain vs On-chain Boundary
The integration is designed around a strict boundary: compute remains off-chain, while economic finality moves on-chain.
| Responsibility | Off-chain in Shardy | On-chain on Stellar |
|---|---|---|
| Worker execution | WebGPU kernels, WASM preprocessing, OPFS state, local proof generation | Not executed on-chain |
| Result verification | Digest verification, redundancy checks, Groth16 validation, reconciliation | Not executed on-chain |
| Job funding | Submitter intent originates in the app and SDK | Escrowed value is locked in TaskEscrow |
| Identity and role mapping | Runtime worker sessions and orchestrator state | Registered identities and settlement-facing roles live in WorkerRegistry |
| Collateral management | Off-chain services can read status and enforce eligibility | Stake lock, unlock, and slash execution happen in StakeVault |
| Settlement batching | Orchestrator prepares verified batch payloads | Final settlement record is committed in SettlementEpoch |
| Payout distribution | Dashboard and SDK read payout state | Funds route through FeeRouter with contract events as receipts |
| Monitoring and public verification | Indexer, dashboards, and observability services consume chain state and events | Events are emitted by the Soroban contract suite |
4. End-to-End Lifecycle
The lifecycle below is the canonical planned flow for the grant build.
Lifecycle stages
- Fund job
The submitter pre-funds a job in XLM or a Stellar-issued asset.
TaskEscrowlocks value before dispatch begins. - Register and lock stake
Workers and orchestrators register through
WorkerRegistryand maintain slashable collateral inStakeVault. - Dispatch and execute The orchestrator assigns work to browser-native workers using Shardy’s existing control and gossip planes.
- Verify result Workers return result digests and Groth16 proofs. The orchestrator verifies correctness and redundancy off-chain.
- Commit settlement epoch
Verified task outcomes are grouped into an epoch record and finalized in
SettlementEpoch. - Pay or slash
FeeRouterdistributes payouts, fees, or slash outcomes, while events expose the final public settlement trail.
5. Asset Model
The planned economic layer supports:
- XLM for straightforward job funding, stake custody, and payout routing.
- Stellar-issued assets via the Stellar Asset Contract (SAC) interface when ecosystem partners or applications need a specific settlement asset.
Asset handling rules for the grant scope:
- Funding and payout flows should use the same contract suite and event model regardless of whether the job is funded in XLM or a SAC-compatible asset.
- The SDK should expose asset selection explicitly rather than hiding the settlement asset behind runtime-specific logic.
- The first production launch can begin with a narrower asset set if needed, but the architecture and contract interfaces should remain SAC-compatible from the start.
6. Browser UX Model
The browser UX must preserve Shardy’s browser-native character rather than shifting complexity to users.
Auth-entry signing
- Browser users authorize contract actions using Soroban auth-entry signing.
- Authorization covers the user-approved action, while a separate relayer can handle transaction submission.
Relayed fee payer
- A fee-paying service submits the signed contract call and pays Stellar fees on behalf of the browser user.
- This keeps the UX aligned with browser onboarding, where users should not need deep wallet or fee-management expertise before trying the product.
UX implications
- Job funding can feel like an application action rather than a low-level contract interaction.
- Worker and orchestrator operators can keep one browser-first workflow for runtime participation and settlement authorization.
- The SDK can expose a clean
authorize -> relay -> confirmpattern instead of forcing each app integrator to invent its own transaction flow.
7. Events, Indexing, and Public Verification
Public verifiability is a core reason to use Stellar here. The grant scope therefore includes both contract events and the supporting read layer.
Contract events
Each contract should emit structured events for the state changes external observers need to track:
TaskEscrow: job funded, job released, job refundedStakeVault: stake locked, stake unlocked, slash executedSettlementEpoch: epoch opened, epoch committed, epoch disputed if a dispute path is addedFeeRouter: payout routed, fee split routed, slash routed
Indexing and monitoring
- An indexer or event-consumption service will ingest Soroban events and expose them to the dashboard, explorer pages, and SDK readers.
- Monitoring should tie together off-chain verification status and on-chain settlement state so operators can identify stalled epochs, missing payouts, or failed relays.
- Public dashboards should display enough information to verify that a funded job reached settlement and what the final payout or slash outcome was.
Public verification trail
The intended audit path for any reviewer or user is:
- Confirm that a job was funded in
TaskEscrow. - Confirm that the relevant operator stake existed in
StakeVault. - Confirm that the verified batch was committed in
SettlementEpoch. - Confirm that funds were routed through
FeeRouter. - Confirm the resulting Soroban events and transaction history through public RPC and indexer reads.
8. Open-source Plan
All Soroban contracts delivered under this grant should be open-sourced in the public Shardy repository.
The minimum public delivery set is:
- Source for
TaskEscrow,WorkerRegistry,StakeVault,SettlementEpoch, andFeeRouter - Unit and integration tests for the contract suite
- Deployment notes and published contract IDs for testnet and mainnet milestones
- SDK examples showing job funding and settlement reads
- Documentation for event formats and indexer expectations
This open-source plan matters because the contract suite is part of the product’s trust model, not a private implementation detail.
9. Milestone Mapping
This document supports a three-stage build narrative:
| Milestone | Contract and product outcome | Public proof of completion |
|---|---|---|
| Milestone 1 | Deliver TaskEscrow, WorkerRegistry, and StakeVault on Stellar testnet with browser authorization and relayed fee payment. | Contract IDs, source code, tests, walkthrough, and funding demo. |
| Milestone 2 | Deliver SettlementEpoch, FeeRouter, indexer-readable events, and first SDK methods for funded-job and settlement reads. | Testnet transactions, event feed, docs, and load-test evidence. |
| Milestone 3 | Launch the open-source contract suite on mainnet and expose settlement history in the product surface. | Mainnet contract IDs, public transactions, dashboard views, and production runbooks. |
10. Relationship to Existing Shardy Docs
This document is the grant-specific architecture for the planned Stellar integration. It complements, but does not replace, the existing technical docs for the current runtime:
For reviewers, this page should be treated as the canonical explanation of how Shardy’s browser-native compute plane connects to its planned economic finality layer on Stellar.