Skip to main content

data-flow

Best Practices

Use PDAs for deterministic accounts

Avoid storing large data on-chain

Use off-chain storage for content

Implement rate limits for spam prevention


/docs/developers/data-flow.md

# Data Flow Architecture

Lazy Student uses a hybrid on-chain/off-chain architecture to balance performance, cost, and decentralization.

---

# High-Level Flow

## User → Frontend → Solana Programs → Off-Chain Services → Storage → Analytics


---

## On-Chain Components

### Stored On-Chain
- EA metadata references
- Pricing
- Payments
- Staking
- Governance
- Reputation weights

### Why On-Chain?
- Transparency
- Security
- Verifiability
- Trustless access control

---

## Off-Chain Components

### Stored Off-Chain
- EA content (IPFS or cloud)
- AI processing
- Analytics dashboards
- Indexing services

### Why Off-Chain?
- Large files
- Faster computation
- Lower cost
- Flexibility

---

## Data Flow Example: Unlocking an EA

1. User selects EA
2. Frontend fetches metadata
3. User signs $LST payment
4. ACC verifies payment
5. Burn percentage executed
6. Access rights granted
7. Content fetched from storage
8. Reputation updated after usage

---

## Data Flow Example: Publishing an EA

1. Creator uploads content
2. Content stored off-chain
3. Metadata stored on-chain
4. Creator stakes $LST
5. EA becomes discoverable
6. Reputation Oracle monitors performance

---

## Indexing

Indexers track:
- EA registrations
- Access events
- Staking changes
- Governance proposals

Recommended indexers:
- Helius
- Triton
- Custom RPC listeners