Skip to content

Commit 125077c

Browse files
authored
Merge pull request #7 from intelliDean/main
project completed
2 parents 15370ef + c4b0285 commit 125077c

15 files changed

Lines changed: 2965 additions & 747 deletions

File tree

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@
33
data/
44
flashstat.toml
55
.env
6+
.idea
7+
.vscode
8+
.next
9+
.github
10+
11+
simple.md

.idea/FlashStat.iml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PROPOSAL.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Unichain Grant Proposal: FlashStat
2+
3+
## 1. Project Overview
4+
5+
**Project Name:** FlashStat
6+
**Category:** Core Infrastructure & Security / Developer Tooling
7+
**Repository:** [Link to your GitHub repository]
8+
9+
### Executive Summary
10+
FlashStat is the trust layer for Unichain’s soft-finality. It is an independent, real-time cryptographic watchtower and reputation engine designed specifically for Unichain's 200ms Flashblocks. FlashStat ingests pre-confirmations in real-time, validates Intel TDX hardware attestations, and exposes a mathematical "confidence score" via a public JSON-RPC API. In the event of sequencer misbehavior (equivocations or soft reorgs), FlashStat autonomously generates cryptographic fraud proofs and submits them on-chain for active slashing.
11+
12+
By providing quantifiable risk metrics for 200ms blocks, FlashStat enables high-value actors—such as market makers, liquidators, and cross-chain bridges—to trust Unichain's pre-confirmations without waiting for Ethereum L1 finality.
13+
14+
## 2. The Problem: The Fragility of Soft-Finality
15+
16+
Unichain’s primary competitive advantage is its incredible speed, achieved through 200-millisecond Flashblocks. However, this speed introduces a critical trust problem.
17+
18+
Until a block is finalized on Ethereum L1, users and market makers must blindly trust that the sequencer will not reorg the chain, double-spend transactions, or extract malicious MEV. If high-value ecosystem participants cannot mathematically trust these pre-confirmations, they will default to waiting for hard finality.
19+
20+
**If users wait for L1 finality to manage risk, Unichain loses its speed advantage.**
21+
22+
While Unichain mitigates this via Trusted Execution Environments (TEEs like Intel TDX), a TEE is only secure if there is an active, decentralized network of watchtowers validating the attestations and punishing deviations. Without an active watchtower network and an accessible API for developers to verify block confidence, the TEE security model is incomplete.
23+
24+
## 3. The Solution: FlashStat
25+
26+
FlashStat bridges the gap between 200ms pre-confirmations and L1 finality. It operates as a high-performance Rust monorepo with three core functions:
27+
28+
1. **The Cryptographic Watchtower (Detection & Slashing):**
29+
FlashStat sits adjacent to the Unichain sequencer, recording every finalized bid. It validates the ECDSA signatures and Intel TDX Quote V4 attestations appended to the `extra_data` of every block. If a sequencer equivocates (signs two conflicting blocks at the same height), FlashStat instantly detects the conflict, diffs the transactions to identify double-spends, encodes an RLP fraud proof, and autonomously submits it to the SlashingManager contract via its Guardian Wallet.
30+
31+
2. **The Confidence API (Developer Tooling):**
32+
FlashStat provides a JSON-RPC and WebSocket API that assigns a live `0.0` to `100.0` confidence score to every Flashblock. This score is calculated by combining historical persistence depth with TEE attestation validity. Developers can query `flash_getConfidence` to programmatically gate UI updates or smart contract interactions based on quantifiable risk.
33+
34+
3. **The Reputation Engine (Ecosystem Transparency):**
35+
FlashStat maintains a persistent, public leaderboard of sequencer health. It tracks total blocks signed, hardware-attested streaks, soft reorgs, and equivocations. Penalties are weighted mathematically, turning sequencer reliability into a transparent, quantifiable metric.
36+
37+
## 4. Why Unichain Needs FlashStat
38+
39+
* **Unlocks Institutional Adoption:** DeFi protocols, market makers, and bridges require quantifiable risk models. FlashStat provides the API necessary for these actors to safely treat 200ms pre-confirmations as final.
40+
* **Enforces TEE Security:** The Intel TDX hardware lock is only effective if malicious attestations result in economic penalties. FlashStat is the active enforcement mechanism that keeps sequencers honest.
41+
* **Enhances Developer Experience:** Instead of every dApp building complex logic to track soft-reorgs and signature validation, they can simply subscribe to FlashStat's WebSocket stream to receive cleansed, scored block events.
42+
43+
## 5. Current State of the Project
44+
45+
The core FlashStat engine is built, fully functional, and production-ready. The codebase is a high-performance Rust workspace consisting of:
46+
* **100% Test Coverage:** 70/70 passing unit and integration tests.
47+
* **Core Engine (`flashstat-core`):** Real-time block ingestion, TDX/TEE attestation verification, and RLP proof encoding.
48+
* **Embedded Storage (`flashstat-db`):** High-speed `redb` persistence layer.
49+
* **API Server (`flashstat-server`):** Fully documented JSON-RPC 2.0 and WebSocket server.
50+
* **Dashboard (`flashstat-tui`):** A live terminal UI for real-time forensics.
51+
52+
## 6. Grant Ask & Roadmap
53+
54+
We are seeking grant funding to transition FlashStat from a working, open-source core engine into a **highly available public good** for the Unichain ecosystem.
55+
56+
**Funding will be allocated to achieve the following milestones:**
57+
58+
### Milestone 1: Public Infrastructure Deployment (1 Month)
59+
* Deploy globally distributed, highly available FlashStat instances monitoring the Unichain Mainnet and Sepolia testnets.
60+
* Provide free, public JSON-RPC and WebSocket endpoints for Unichain developers to query block confidence and reorg events.
61+
* Set up robust telemetry (Prometheus/Grafana) and alerting for the watchtower nodes.
62+
63+
### Milestone 2: Developer SDKs and Integrations (2 Months)
64+
* Develop and release a `flashstat-sdk` in TypeScript and Rust.
65+
* Build drop-in React hooks (`useFlashblockConfidence`) so dApp frontend developers can easily show users real-time transaction finality (e.g., updating a UI spinner to a green checkmark when confidence hits 99%).
66+
* Create comprehensive integration documentation and tutorials for Unichain developers.
67+
68+
### Milestone 3: Decentralized Guardian Network (3 Months)
69+
* Expand the current single-node Guardian Wallet architecture into a multi-party computation (MPC) or threshold signature scheme (TSS) model.
70+
* Enable community members to run lightweight FlashStat verifier nodes that collectively vote on and submit slashing proofs, eliminating any single point of failure in the watchtower network.
71+
72+
## 7. Team
73+
74+
[Insert brief team bios here, highlighting Rust expertise, blockchain infrastructure experience, and previous contributions.]
75+
76+
## 8. Conclusion
77+
78+
FlashStat ensures that Unichain's 200ms speed is matched by ironclad, cryptographic trust. By funding the public deployment and SDK development of FlashStat, Unichain will provide its developers with the tooling necessary to safely build the next generation of high-frequency DeFi.

0 commit comments

Comments
 (0)