Sub Rosa
Build or review an integration against Sub Rosa Core v2. Prefer the public
@sub-rosa/sdk templates over custom contract calls. Keep the current network,
deployment, and audit boundary explicit.
Integration workflow
-
Inspect the application before changing it:
- Identify its package manager, TypeScript/runtime version, Stellar wallet adapter, RPC configuration, asset contracts, and transaction-signing path.
- Check the installed or current npm version of
@sub-rosa/sdk; do not invent exports from an older version. - Read references/integration.md for the concrete SDK flow and references/security-and-lifecycle.md before implementing value-moving code.
-
Choose exactly one reviewed mode:
Requirement Mode Template Exchange a Stellar payment asset for a Stellar lot asset AuctioncreateAssetAuctionRoundCollect confidential proposals without asset custody ReceiptOnlycreateSealedProposalRoundUse
Auctiononly when atomic settlement is economically necessary. UseReceiptOnlyfor procurement, RFP, judging, or design-partner flows where the organizer chooses off-chain. Do not add a custom settlement callback for a new vertical; express it as typed metadata over one of these modes. -
Install the single partner-facing package:
npm install @sub-rosa/sdkImport templates, Drand helpers, tlock helpers, receipt verification, and generated contract bindings from
@sub-rosa/sdk. Install@sub-rosa/tlockor@sub-rosa/round-bindingsdirectly only for low-level protocol work. -
Pin the deployment tuple together:
- RPC URL
- network passphrase
- round contract ID
- expected WASM hash in deployment policy or configuration
Never combine a contract ID from one network with another network's RPC or passphrase. Let
SubRosaClientperform its network and contract precheck before the first operation. -
Plan the reveal window before creating the round:
now < commitDeadline < time(drandRound) < revealDeadlineDerive the Drand round with
roundInSeconds(quicknet(), delaySeconds). Leave enough time after Drand publication for retry-safe, per-participant reveal transactions. Treat deadlines as Unix timestamps, not ledger numbers. -
Create and submit through a high-level template:
- Auction: custody the lot at creation, use one public
fixedEscrowfor all bidders, callsealAssetBid, thensubmitV2with escrow exactly equal tofixedEscrow. - ReceiptOnly: call
sealProposal, thensubmitV2withescrow: 0n. - Add
eligibleParticipantsonly when the partner needs a public allowlist. - Use integer base units for all Stellar asset amounts.
- Auction: custody the lot at creation, use one public
-
Preflight every wallet mutation before requesting a signature. Use the matching
preflight*V2method, surface typed errors and fee/resource estimates, and stop on failure. Do not ask the user to sign a transaction that failed simulation. -
Run the permissionless lifecycle in order:
Open -> openRevealV2 -> Revealing -> revealV2(each participant) -> clearV2 -> Cleared -> settleV2(Auction) -> SettledReceiptOnlycompletes duringclearV2. Reveal participants independently and skip already-revealed entries so retries are safe. Run at least one keeper and monitor incomplete reveal counts; permissionless does not mean automatic. -
Export the Core v2 receipt with
exportReceiptV2, verify it withverifyReceiptV2, and persist the canonicalserializeReceiptV2output plus transaction hashes. Explain that offline verification checks internal consistency, while ledger provenance still requires querying the pinned contract and network. -
Verify the integration at the appropriate depth:
- Unit-test mode selection, base-unit conversion, payload encoding, and preflight failures.
- Test an end-to-end testnet round with multiple independent participants.
- Exercise duplicate lifecycle calls and the grace-period
voidV2recovery path. - For auctions, reconcile seller payment, winner lot transfer, surplus, and losing-bidder refunds.
Required safety language
Sub Rosa Core v2 has settled testnet proofs and an official capped-mainnet deployment, but no independent funds-handling audit yet. Do not claim that the SDK, the hosted UI, or the legacy v1 mainnet smoke proves Core v2 is production-safe. Use participant and value caps until the deployment is independently reviewed.
Sources
- SDK and protocol source: https://github.com/karagozemin/Sub-Rosa/tree/main
- Integration docs: https://www.sub-rosa.online/#/docs
- Published package: https://www.npmjs.com/package/@sub-rosa/sdk
- Stellar smart contract docs: https://developers.stellar.org/docs/build/smart-contracts
- Drand quicknet: https://docs.drand.love/blog/2023/10/16/quicknet-is-live