-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Replies: 2 comments · 1 reply
|
Hey! Going to move this to a discussion since I don't want to consider this an actual bug right now, but more like a feature we could look at in the future. Tailwind CSS will load Lightning CSS but also Not sure how realistic it would be to actually make this work with permissions in mind without allowing addons / child processes. |
All reactions
**zk Ecosystem Blueprint: Production-Grade, Regulator-Aware, Solana-Native with ZK Primitives**
This document serves as a comprehensive, investor-ready and regulator-aware technical specification for a **multi-department zk-powered ecosystem** on Solana. It comprises three distinct products with fully separated signups, wallets, risk profiles, and disclosures, while enabling optional private cross-department linking via zk proofs.
### 0. GLOBAL PRINCIPLES
- **Non-custodial**: Users retain full control of private keys across all wallets. No platform custody of funds or signing authority.
- **Solana-native**: All core programs, token mints, PDAs, and state live on Solana (using Anchor framework for development). Leverage Solana's high TPS, low fees, and emerging on-chain ZK verifiers (e.g., Light Protocol-style or native ZK ElGamal-inspired primitives, with careful handling of any program deprecations).
- **zk-powered**: Zero-knowledge proofs (zk-SNARKs or compatible, generated client-side or via Aurora runtime, verified on-chain where possible or off-chain with on-chain settlement) for privacy-preserving verification of identity, work, rewards, and rules compliance.
- **Department-separated**: Each product maintains independent ToS, risk disclosures, signup flows, zk-Identity, and wallet. Cross-department perks (e.g., loyalty boosts) require explicit user-consented zk linkage proofs.
- **Regulator-aware**: Strict separation of loyalty/utility rewards, compute-based mining economics, and high-risk trading. All marketing and disclosures emphasize **no guaranteed returns**, market/volatility risks, and user responsibility.
- **Hybrid execution** (trading only): Platform handles UX, education, risk configuration, zk rule proofs; position execution routes to non-custodial DEXs/aggregators (e.g., Jupiter, Orca) or partner venues via user-signed transactions or intents.
**Defined Vocabulary**:
- **zk-Identity**: Private credential (e.g., hash of user-controlled secret + nullifier) proving attributes (age, tier, uniqueness) without revealing PII or linking addresses publicly.
- **zk-Value**: Proof of a computed value (e.g., XP, mining power, PnL) matching published formulas without exposing inputs.
- **zk-Work**:
- **zk-PoW** (Proof of Work): Computational effort performed (e.g., mining session hashes/compute units).
- **zk-CoW** (Cost of Work): Resources/time/difficulty expended matching reward tiers.
- **zk-SoW** (Stake of Work): Legitimate staking of tokens/credits for boosts, bounded by rules.
- **zk-Access**: Tiered permissions (e.g., basic/verified/pro) proven privately, unlocking features without public linkage.
All zk proofs use standardized circuits (e.g., Circom or Halo2-style, verifiable via Solana-compatible verifiers). Proof generation: primarily client (browser/WebAssembly) or Aurora runtime for heavy compute; verification: Solana programs (on-chain where CU allows) + off-chain indexers for scalability.
### 1. HIGH-LEVEL SYSTEM OVERVIEW
#### 1.1 Three Departments
**A) zk Rewarding App**
- **Purpose**: Drive engagement via surveys, mini-games (Mines, High-Low, Diamonds, Spin, Scratch, Trivia, competitions), offers, streaks, milestones, loyalty tiers, and Tarabox-style time-locked vaults for utility rewards.
- **Output**: Loyalty/utility tokens or XP-based perks (fee discounts, access). Explicitly **not** an investment product.
**B) zk Mining System (Aurora-powered)**
- **Purpose**: Users "rent" virtual mining machines powered by the Aurora Framework (EVM-compatible compute layer, potentially bridged or integrated for off-chain heavy lifting before Solana settlement). Performs verifiable compute work across supported chains.
- **Economics**: Mining credits/power, staking boosts via zk-SoW. Rewards in utility/mining tokens based on proven work.
**C) zk Trading Platform (Crypto + RWA)**
- **Purpose**: Education-first long/short trading on crypto and tokenized Real World Assets (RWAs). Strict risk controls via "trading machines."
- **PnL**: Denominated/displayed in stable asset (USDT-equivalent via oracle feeds) for clarity.
- **Features**: Pre-configured trading machines with kill switches, capital protection; education gating; hybrid execution.
#### 1.2 Per-Department Definitions
**zk Rewarding App**
- **Primary persona**: Casual users seeking fun, streaks, and utility perks (gamers, survey takers, offer hunters).
- **Core value prop**: Engaging experiences that earn loyalty rewards and XP while building habits.
- **Risk profile**: Low (entertainment/utility; no capital at risk beyond optional vault locks).
- **Promised**: Verifiable completion of actions leading to rule-based rewards/XP. **Not promised**: Financial returns, guaranteed value, or investment yields.
**zk Mining System**
- **Primary persona**: Tech-savvy users interested in compute contribution, staking, and variable rewards.
- **Core value prop**: Rent compute power (Aurora machines) for verifiable work yielding mining credits/power with optional staking boosts.
- **Risk profile**: Medium (technical risks, variable rewards tied to difficulty/market, opportunity cost of rental/staking).
- **Promised**: Fair, rule-based rewards proportional to proven zk-Work. **Not promised**: Fixed profits, guaranteed uptime, or risk-free yields—users bear compute/market risks.
**zk Trading Platform**
- **Primary persona**: Educated traders seeking structured long/short exposure with risk guardrails.
- **Core value prop**: Progressive education → simulation → live trading with pre-configured machines enforcing limits.
- **Risk profile**: High (market volatility, leverage; capital loss possible despite protections).
- **Promised**: Education-gated access, enforced risk rules (via zk proofs), transparent PnL in stable terms. **Not promised**: Profits, break-even in all scenarios, or protection against all losses—kill switches aim for ~$0 net in extreme spikes but markets can gap.
### 2. IDENTITY, WALLETS, AND SEPARATE SIGNUPS
#### 2.1 Separate Signup Flows
Each flow is a isolated React/Next.js wizard with department-specific branding:
- **Rewarding App**: Email/phone + wallet connect (new keypair or import) → Accept Rewarding ToS + low-risk disclosures (utility only) → Generate zk-Identity-R (client-side circuit proving uniqueness) → Onboard with tutorial actions.
- **Mining System**: Wallet connect → Accept Mining ToS + medium-risk disclosures (variable compute rewards) → zk-Identity-M generation → Machine rental preview.
- **Trading Platform**: Stricter: Wallet + basic KYC-lite (zk-age/ residency proofs) → Accept Trading ToS + high-risk disclosures (leverage, loss potential) → Education module start → zk-Identity-T.
All use separate consent checkboxes and record hashed consents on-chain via PDAs.
#### 2.2 Separate Wallet/Identity Layers
- **Reward Wallet + zk-Identity-R**: Dedicated Solana keypair for rewards/XP/vaults.
- **Mining Wallet + zk-Identity-M**: For mining credits, staking, rentals.
- **Trading Wallet + zk-Identity-T**: For trading margins/fees (non-custodial; positions executed via signed txs).
**Private linking**: Users can generate zk-LinkProof (proves "same human controls Identity-R/M/T" via shared nullifier/secret, without revealing addresses). Verified optionally for cross-perks (e.g., loyalty boost in mining from reward XP). Use zk-SNARK circuits; nullifiers prevent replay.
Data flow: User → Wallet (Phantom/Backpack/etc.) → Client generates proof → Submit to department program with PDA.
### 3. ZK LAYER: PoW, CoW, SoW, REWARDS, TRADING
#### 3.1 zk Primitives
**zk-PoW**: Proves computational work (e.g., hashes/compute units in Aurora session) performed. Hidden: raw inputs/machine details. Generated: Aurora runtime or client. Verified: Solana zk-verifier program or off-chain + settlement.
**zk-CoW**: Proves cost/resources match published schedule (time × difficulty). Hidden: exact resource breakdown. Generated: Backend/Aurora. Verified: On-chain.
**zk-SoW**: Proves stake amount and legitimacy for boosts (bounded multipliers). Hidden: full balance. Generated: Client (with wallet proof). Verified: Solana staking vault program.
**zk-Rewards**: Proves action completion (survey hash, game score) per rules and correct mint. Hidden: individual answers. Generated: Client. Verified: Reward program.
**zk-Trading Rules**: Proves machine followed configs (leverage bounds, max loss, kill switch triggers, PnL calc). Hidden: exact position details if private. Generated: Hybrid (client + execution venue oracle). Verified: Trading verification program.
All proofs include public inputs (e.g., session ID, tier) for indexing/audit.
### 4. SOLANA LAYER AND PROGRAMS
Use **Anchor** for all programs. PDAs derived with seeds like `["department", "type", user_pubkey, nonce]`.
#### 4.1 Rewarding App
- **RewardTokenMint**: SPL token (or Token-2022).
- **XPLevelProgram**: PDA `["xp", user]` stores XP, level, tier.
- **TaraboxVaultProgram**: Time-locked PDA vaults `["vault", user, id]`.
- **ActionLogPDA**: `["action", user, action_type, timestamp]`.
- **ZkRewardVerifierProgram**: Instruction `verify_reward_proof(proof, public_inputs)` → mints if valid.
Main instructions: `log_action`, `claim_xp`, `unlock_vault`. Events: `RewardMinted {amount, action_type}`.
#### 4.2 Mining System
- **MiningMachineRegistryPDA**: Global `["machines"]` + per-machine `["machine", id]`.
- **MiningSessionPDA**: `["session", user, machine_id]`.
- **MiningCreditsToken** & **MiningPowerToken**.
- **StakingVaultProgram**: `["stake", user]` for zk-SoW.
- **ZkWorkVerifierProgram**: `verify_pow_cow_sow(proofs...)`.
- **RewardDistributionProgram**: Distributes based on verified work.
Instructions: `rent_machine`, `start_session`, `submit_work_proofs`, `claim_mining_rewards`. Events for audit.
#### 4.3 Trading Platform
- **TradingProfilePDA**: `["profile", user]` (education progress, risk tier).
- **RiskConfigPDA**: Per-machine/user `["risk", user, machine_id]` (leverage, loss limits, kill params).
- **FeeAccountingPDA**.
- **ZkTradingVerifierProgram**: `verify_trade_rules(proof, config_hash)`.
- **RwaRegistry**: Access-controlled tokenized assets.
Instructions: `update_risk_config`, `execute_trade_intent` (routes signed tx), `trigger_kill_switch` (enforced). Events: `PositionClosed {pnl_stable, reason}`.
zk proofs passed as bytes; verified in program (or CPI to verifier).
Text diagram (Rewarding example):
User Wallet → Client (action) → Generate zk-Rewards proof → Submit tx to RewardProgram PDA → Verify on-chain → Mint & emit event → UI update via indexer.
### 5. AURORA FRAMEWORK: MINING RUNTIME
**Mining Machines** (Aurora-M1 to M4): Virtual configs with hash/compute power, supported chains, difficulty tiers, rental pricing in credits/tokens. Parameters stored in registry PDA.
**Rental Logic**: User approves rental from Mining Wallet → Backend/Aurora starts session (monitor via WebSocket) → Session ends → Generate zk-PoW/CoW → Submit to Solana for verification/credit.
**Staking and Boosts**: Stake in vault → zk-SoW proof shows amount → Multiplier (e.g., 1.1x–2x, capped transparently) applied in reward formula.
**Leaderboards/Anti-Fraud**: Aggregate zk-verified stats (e.g., total proven power) on-chain or via indexer. Fraud detection: statistical anomalies on proof patterns + rate limits; privacy preserved via zk.
### 6. ZK REWARDING APP: SURVEYS, GAMES, OFFERS, LOYALTY
#### 6.1 Reward Actions
- **Surveys**: Multi-question form → Hash answers → zk proof of completion/validity → Log to ActionPDA → XP + small reward.
- **Offerwall**: Partner tasks (external) → Callback with zk-verified completion.
- **Games**: Client-side (Mines = grid logic, High-Low = card comparison, etc.) → Server-seeded randomness where needed → zk proof of score/rules adherence → Rewards curve based on difficulty.
- **Streaks/Check-ins/Dailies**: Timestamped PDAs with zk proof of consecutive days.
- **Milestones/Tiers**: Cumulative XP → Level-up instruction.
- **Tarabox Vaults**: Lock rewards for time → Unlock after delay (or early with penalty).
#### 6.2 Flows and Verification
User flow: Select action → Complete → Client generates proof → Tx to program → Verified → Reward.
Pseudocode (reward calc):
```rust
if verify_zk_rewards(proof, action_type, score) {
let xp = base_xp * difficulty_multiplier * streak_bonus;
mint_xp_or_token(user_pda, xp);
}6.3 Game EconomyProgressive reward curves (diminishing returns to prevent farming). Anti-abuse: Cooldowns, zk-uniqueness, statistical monitoring. Rewards framed as "loyalty points for platform perks" — no yield promises. 7. TRADING PLATFORM: EDUCATION-FIRST, LONG/SHORT, KILL SWITCHES7.1 Education-FirstProgression: 1. Modules/quizzes (on-chain completion proofs) 2. Paper trading (simulated PnL) 3. Live. Higher leverage/unlocks require milestone zk proofs. Rewards for education: XP/tokens for completion. 7.2 Stable-Denominated PnLOracle feeds convert all positions to USDT-equivalent for display/calculations → Simplifies risk communication ("you could lose up to X USDT-equivalent"). 7.3 Trading MachinesPre-sets (e.g., "Conservative Crypto Long", "Aggressive RWA Short"): Asset list, long/short toggle, max leverage (tier-gated), max daily loss (%), drawdown limit, kill rules, capital protection. 7.4 Long vs ShortUX: Toggle "Long (bullish)" or "Short (bearish)". Long: exposure to price increase; Short: profits from decrease. Risks clearly visualized (leverage amplifies both). 7.5 Kill Switches and Capital ProtectionDefault: Machines auto-close on breach (volatility spike, loss threshold) targeting ~$0 net PnL (slippage/market gaps possible). Users adjust sensitivity within safe bounds only; cannot disable. Enforcement: Config in RiskPDA. Execution venue monitors or platform oracle triggers signed close tx. zk-Trading proof attests compliance. Pseudocode (kill logic): if (current_drawdown > config.max_drawdown || volatility > threshold) {
close_positions(target_pnl = 0); // route to DEX
log_event("kill_switch", reason);
// zk proof generated post-close
}7.6 Hybrid ExecutionPlatform: Configures machine, generates intents/proofs. User wallet signs execution txs to external venues. Risk rules enforced pre-execution (simulation) and post (zk audit). Non-custodial: No platform keys move user funds. 8. ECONOMIC SYSTEM: TOKENS, STAKING, SINKS, SOURCESReward Token ($REW): Utility token. Capped or low-inflation supply. Sinks: Vault locks, boosts, fee discounts. Sources: Engagement rewards. Utility: Perks, not yield vehicle. Mining Economy: Credits (rental currency), Power (boost metric). Priced dynamically. Sinks: Rentals, session fees. Sources: Verified work distributions. zk-Work determines allocation. Trading Economy: Fees (maker/taker, machine subscription). Discounts via staking/levels (zk-SoW + zk-Access). RWA: Additional compliance constraints (e.g., accredited access proofs). No token marketed as investment; all economics transparent via on-chain rules. 9. AFFILIATE, CREATOR, AND ADMIN SYSTEMSAffiliate: Multi-tier referrals with zk-verified unique signups (prevent sybil). Rewards in loyalty tokens only; clear "not investment returns." Creator System: Community challenges, custom games/offers. Earn share of engagement rewards or platform fees (zk-attested). Admin Dashboards: Per-department views for offer/machine/risk management, fraud flags (anomaly detection on proofs), compliance exports. 10. REGULATOR VIEW AND DISCLOSURESRewarding App: "Loyalty/utility rewards for engagement. zk-proofs + on-chain logs prove adherence to published rules. No capital risk or guaranteed value." Mining System: "Rewards based on proven zk-PoW/CoW/SoW compute contribution. Variable; users bear technical/market risks. Staking provides bounded boosts, not yield products. Audit via proof verification and events." Trading Platform: "Education-gated access with simulations required. Long/short positions carry market risk. Kill switches and capital protection aim to limit losses in extremes (target ~$0 net PnL) but cannot eliminate gaps/volatility. PnL variable and never guaranteed. zk-Trading proofs + events enable full audit of rule enforcement, fees, and configs. All execution non-custodial." Full audit trails: Immutable on-chain events + zk proof logs exportable. 11. (UI Architecture Dashboard Follows)The ecosystem is designed for a senior engineering team to implement using Anchor (Solana), Circom/Halo2 (zk circuits), Next.js/React (frontend), and Aurora for mining runtime. Compliance team can map disclosures directly to zk/on-chain artifacts. React Architecture Dashboard UI Scaffold (Next.js-Based) Chosen Stack Justification: Next.js 15+ (App Router) for server-side rendering, built-in API routes, React Server Components (RSC) for performance on data-heavy dashboards, excellent Solana/Web3 integration via libraries like 1. Proposed File/Folder Structure2. Main Layout and Routing ApproachTop-level Example 'use client';
import { useState, useEffect } from 'react';
import ModeToggle from '@/components/layout/ModeToggle';
import SidebarNav from '@/components/layout/SidebarNav';
export default function RootLayout({ children }: { children: React.ReactNode }) {
const [mode, setMode] = useState<'USER' | 'ADMIN'>('USER');
// Load from storage, etc.
return (
<html lang="en">
<body className="flex h-screen bg-zinc-950 text-white">
<SidebarNav mode={mode} />
<main className="flex-1 overflow-auto p-8">
<div className="flex justify-between mb-8">
<h1 className="text-3xl font-bold">zk Ecosystem Cockpit</h1>
<ModeToggle mode={mode} onToggle={setMode} />
</div>
{children}
</main>
</body>
</html>
);
}Routing uses Next.js file-based with parallel routes if needed for modals. 4. TypeScript Interfaces (Core Entities in
|
All reactions
This discussion was converted from issue #20396 on August 07, 2026 20:37.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Note that I suspect that this issue is most likely very hard/impossible to fix, but I thought I'd create this issue for people coming after me pondering with the same issue.
Node's permission based permissions is enforced by adding the
--permissionflag when running Node.To get TailwindCSS up and running you also need to add:
The most problematic security issue in the above is (I think)
--allow-child-processwhich gives Tailwind's config/plugins more or less full OS access. Given the error message I get, I suspect this is due to how you loadlightningcss.All reactions