Expand description
§nucleus-substrate-sdk
Demand-side SDK for the Nucleus substrate. Composes:
nucleus_substrate_core— Session, Receipt, Projectionnucleus_identity_projection— JWT-SVID lifternucleus_flow_projection— Denning-lattice lifternucleus_mechanism_vcg— Pigouvian-VCG lifter
Two top-level affordances:
Client— async HTTP wrapper over the hub’s REST surface (agent card, JWKS, list auctions, post auction, submit bid, match, receipts, counters).verify_receipt_fully— the “did this happen and is it consistent?” entry point. Verifies the receipt’s top-level Ed25519 signature AND walks each projection through its lifter’s structural verifier.
§Example: full verify against a live hub
use nucleus_substrate_sdk::{Client, verify_receipt_fully};
let client = Client::new("https://nucleus-auction-hub.fly.dev")?;
let receipt = client.fetch_receipt("auction-id").await?;
let jwks = client.jwks().await?;
let report = verify_receipt_fully(&receipt, &jwks)?;
println!("✓ verified {} projections", report.projection_kinds.len());Re-exports§
Modules§
- client
- Async HTTP client over the auction hub. One method per public
route. Returns
anyhow::Result<T>for caller ergonomics.
Structs§
- Agent
Bid - Externality
Profile - One agent’s claims about the externalities they would impose if awarded a given auction. Each claim is signed by a trusted oracle; the hub verifies signatures before the VCG path consumes them.
- Flow
Body - Wire-stable shape for the Flow projection body.
- Identity
Body - Wire-stable shape for the Identity projection body.
- JwtSvid
Claims - Minimum required JWT-SVID claims per the spec. Extra claims are
allowed (and ignored here);
serde_json::Valuecapture is left for callers that need provider-specific extensions. - Match
Result - Opaque
Signed Claim - A signed externality claim, opaque from the SDK’s perspective.
The hub deserializes the inner
signed_bytesagainst the oracle’s verifying key; SDK consumers pass through whatever bytes they received from their oracle. - Posted
Auction - Receipt
- The colimit envelope. Holds a session + any subset of its projections, signed with the issuer’s Ed25519 key.
- Session
- The unit of authorship. Every projection projects from this.
- VcgKnapsack
Body - Body of a knapsack-VCG-cleared auction’s Economic projection.
- VcgKnapsack
Outcome - VcgMatch
Result - Verify
Report - Result of
verify_receipt_fully. Holds the list of projection kinds that successfully verified — clients can sanity-check this against the set they expected to be present. - Vickrey
Body - Body of a single-good Vickrey-cleared auction’s Economic projection.
- Vickrey
Outcome
Enums§
- Economic
Body - Discriminated union of the two body shapes — what
verify_economic_projection_shapeparses out of aProjection::Economic’s body Value. - Economic
Verify Error - Flow
Verify Error - Identity
Verify Error - Projection
- One projection of a session into a verifiable record.
- Receipt
Error - Resource
Dim - One axis of externality the auction internalizes. Each variant captures a measurable externality and an oracle that signs claims about it.
- Substrate
Verify Error
Functions§
- flow_
projection - Build a
Projection::Flowcarrying the supplied snapshot. - identity_
projection - Build a
Projection::Identitycarrying the supplied JWT-SVID. Callers will typically place this into theprojectionsfield of anucleus_substrate_core::Receipt. - vcg_
knapsack_ projection - Pack a cleared knapsack-VCG auction into a
Projection::Economicbody. - verify_
economic_ projection_ shape - Verify structural well-formedness of an Economic projection body.
Returns the parsed typed body on success. Cryptographic signature
verification happens on the parent
Receipt. - verify_
flow_ projection_ shape - Verify that a
FlowBodyis well-formed: version matches the lifter’s, lattice-level strings are in their stable vocabularies, the “any-X” flags are consistent with the ceiling levels. - verify_
identity_ projection - Verify an Identity projection offline against the issuer’s JWKS.
- verify_
receipt_ fully - The composite verifier. Runs:
- vickrey_
projection - Pack a cleared single-good Vickrey auction into a
Projection::Economicbody.