Quasar-Native App Stack
Gateway lane-affinity routing, native Base appchains on Quasar consensus, and MPC/KMS as Quasar certificate lanes
LP-5623: Quasar-Native App Stack
Abstract
This LP extends the Quasar architecture across three production surfaces:
- Gateway — lane-affinity sticky routing pins users to the validator subset that owns their lanes, eliminating cross-node round trips on the read hot path.
- Base — application backends become native Quasar appchains: each
Base instance is a Quasar round preset with its own
chain_id, validator subset, and per-tenant lanes; realtime subscriptions tail Quasar'sCertOutring. - MPC + KMS — the MPC engine (CGGMP21, FROST, Pulsar-general) and
KMS plug in as additional
QuasarCertLanevariants, sharing the same wave-tick scheduler, GPU verifier, and replay-proof subject binding.
The unifying observation: every cryptographic primitive gets a
cert_lane slot. Adding a new primitive — Falcon, SLH-DSA, a novel
threshold scheme — costs one enum value plus one verifier function. The
wire ABI never breaks, because QuasarCertIngress addresses artifacts
by (offset, len) indirection.
Gateway lane-affinity pinning
Routing function
Sticky-session routing extends naturally:
gpu_id = H(user_lane_id) mod num_gpus
gateway_route = gpu_owner_of(gpu_id)
user_lane_id is the dominant lane key for that user — typically:
user_lane_id = H("acct", user_id) // balance + nonce dominates
user_lane_id = H("trader", user_id) // for DEX users
user_lane_id = H("collection", coll_id, owner) // for Base apps
The gateway maintains a route table keyed by lane_id and consults it
on every request. Reads from owned lanes are local; writes that span
lanes degrade to a distributed transaction via fragment roots.
Properties
- Consistency: the same
user_lane_idalways maps to the same node within an epoch. - Smooth rotation: an epoch boundary reshuffles ownership per
pchain_validator_root; the gateway picks up the new map atomically. - Bounded reshuffle: adding or removing a node relocates only
1/nof users — the consistent-hash property. - Cross-lane writes: the gateway issues a distributed transaction via the CertLane mechanism; fragment roots aggregate into one certificate.
Where lane affinity belongs
In the gateway, not in Quasar core. Quasar exposes lane_id → gpu_id as a deterministic function; gateway, Base, MPC, and KMS all
consume it.
gateway/
src/lane_affinity.rs // route table + epoch-rotation hook
src/quasar_client.rs // calls into the QuasarGPU engine
Native Base appchains on Quasar
Base is already lane-shaped, per collection and per record. Wiring it onto Quasar:
| Base concept | Quasar mapping |
|---|---|
| Collection | domain component of the lane key |
| Record id | H("base", chain_id, collection, record_id) lane |
| Read query | local read from the owned lane (gateway routes to the owner) |
| Write / mutation | Quasar tx executed in the QuasarGPU adapter |
| Schema migration | admin-precompile tx (writes a schema lane) |
| Realtime subscription | gateway tails CertOut for the lane keys the user subscribed to |
| Auth (Hanzo IAM) | precompile reads the tenant identity root from QuasarRoundDescriptor.pchain_validator_root |
Appchain as a Quasar round preset
Each Base instance is a Quasar chain preset:
struct BaseAppchainConfig {
uint64_t chain_id; // unique per tenant
Hash validator_subset_root; // P-Chain commitment to its validators
Hash qchain_ceremony_root; // Q-Chain Pulsar DKG root
Hash zchain_vk_root; // Z-Chain Groth16 verifying-key root
QuasarMode mode; // Nova=0 (typical) / Nebula=1 (high fan-out)
uint64_t block_time_ms;
uint64_t gas_limit;
};
Cross-chain messages go through the same per-lane certificate infrastructure. The appchain inherits Quasar finality and GPU execution for free.
Three-layer stack
┌──────────────────────────────────────────────────┐
│ Base │
│ collections, queries, realtime subscriptions │
│ (IAM-native) │
├──────────────────────────────────────────────────┤
│ QuasarGPU adapter │
│ exec + Block-STM + roots │
├──────────────────────────────────────────────────┤
│ Quasar consensus │
│ ordering + cert lanes (BLS / Pulsar / MLDSA-G16)│
└──────────────────────────────────────────────────┘
Realtime subscriptions
Base's realtime subscription system maps to: tail CertOut for the
lanes the user subscribed to, push to the user's WebSocket or SSE
connection. The gateway already owns the lane → user mapping via sticky
routing, so the fan-out is local.
client.subscribe("collection/users", filter)
↓ gateway pins user
gateway.subscribe(lane = H("collection", chain, "users"))
↓ tails QuasarRoundResult / CertOut for that lane
client receives lane events as they finalize
The user gets sub-100 ms latency on local reads and strong Quasar finality on writes — the audit guarantee a regulated venue needs.
MPC and KMS as Quasar certificate lanes
MPC (M-Chain in the chain topology)
The MPC engine runs CGGMP21, FROST, Corona-general, and TFHE ceremonies. Each ceremony round maps to a Quasar round:
| MPC concept | Quasar mapping |
|---|---|
| Ceremony participants | validator subset (per pchain_validator_root) |
| Ceremony round | Quasar wave tick |
| Partial signature share | QuasarCertIngress artifact, cert_lane = MPCShare |
| Aggregate output | QuasarCert emitted on CertOut |
| Round graph (interactive ceremonies) | Nebula DAG mode |
Each ceremony type registers its verifier as a new QuasarCertLane
variant. The enum is open-ended:
enum class QuasarCertLane : uint8_t {
BLS = 0,
Pulsar = 1,
MLDSAGroth16 = 2,
CGGMP21Share = 3,
FROSTShare = 4,
CoronaGeneral = 5,
TFHEKeyShare = 6,
};
The verifier reads the artifact via (artifact_offset, artifact_len)
and runs the ceremony-specific check. Ceremony semantics are defined in
lp-4700 and
lp-7100; this LP
adds the GPU lane-verifier wiring.
KMS
KMS operations — key generation, rotate, derive, sign — become Quasar transactions executed via the QuasarGPU adapter:
| KMS operation | Quasar transaction shape |
|---|---|
kms_keygen | tx that mints a key into a tenant-scoped lane |
kms_rotate | tx that bumps the version on the key lane |
kms_derive | read-only tx (no MVCC version bump) |
kms_sign | tx that calls a precompile and emits a CertLane artifact |
kms_revoke | tx that flips a status bit on the key lane |
Key material lives in lanes scoped by tenant:
key_lane = H("kms", tenant_id, key_id)
Access control runs as a precompile that reads the IAM identity root
from QuasarRoundDescriptor.pchain_validator_root. The KMS gets:
- Quasar finality on every key state change — no race conditions.
- Audit root binding key history to the chain.
- GPU-batched signature verification through
drain_cert_lane. - PQ safety via the Quasar triple certificate when KMS sign requests cross-validate against post-quantum lanes.
Unified API surface
All three layers consume one Quasar API:
namespace quasar::gpu {
// execution
class QuasarGPUEngine { ... };
// lane affinity (gateway)
struct LaneRoute {
Hash lane_id;
uint32_t gpu_id;
NodeId owner_node;
};
LaneRoute lookup_lane_route(Hash lane_id, Hash pchain_validator_root);
// cert lane registration (MPC, KMS, custom primitives)
using LaneVerifier = bool (*)(const QuasarCertIngress&, const uint8_t* artifact);
void register_cert_lane(QuasarCertLane lane, LaneVerifier verifier);
} // namespace quasar::gpu
Performance characteristics
| Surface | Latency target | Throughput target |
|---|---|---|
| Gateway lane-affinity read | < 10 ms (local) | bounded by network I/O |
| Base mutation | < 50 ms commit, < 1.1 s strong finality | Tier 2 (100 M/s) |
| Base realtime subscription | < 100 ms fan-out | Tier 1 (1 B events/s aggregate) |
| MPC ceremony round | < 500 ms per round | per ceremony |
| KMS sign | < 50 ms commit | Tier 3 (1–10 M/s) |
Tiers are the throughput ladder in lp-5622.
Implementation plan
| Version | Scope |
|---|---|
| v0.50 | Gateway lane-affinity routing |
| v0.51 | Base → Quasar adapter |
| v0.52 | MPC cert-lane verifiers (CGGMP21, FROST, Corona-general) |
| v0.53 | KMS as a Quasar precompile + key-material lanes |
| v0.54 | TFHE key-share lane (lattice ceremony output) |
| v0.55 | Cross-chain message routing via per-lane cert artifacts |
References
| Resource | Location |
|---|---|
| Gateway | github.com/hanzoai/gateway |
| Base | github.com/hanzoai/base |
| MPC | github.com/hanzoai/mpc |
| KMS | github.com/hanzoai/kms |
| IAM | github.com/hanzoai/iam |
| lp-0110 | Quasar consensus |
| lp-0130 | Chain topology (M-Chain, F-Chain roles) |
| lp-4700 | Threshold MPC family |
| lp-5622 | QuasarGPU execution adapter |
| lp-7100 | M-Chain MPC ceremonies |
| lp-7325 | KMS / HSM integration |
Copyright
Copyright (C) Lux Industries Inc and Hanzo AI Inc. All rights reserved.