File size: 9,095 Bytes
d086025 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | # Guts - Product Requirements Document
> **Version:** 1.0.0
> **Last Updated:** 2025-12-20
> **Status:** Draft
## Executive Summary
Guts is a decentralized, censorship-resistant code collaboration platform built on [commonware](https://github.com/commonwarexyz/monorepo) primitives. It provides Git-compatible repository hosting, pull request workflows, and issue tracking without centralized control, enabling developers to own their code infrastructure.
## Vision
*"Code collaboration infrastructure that can't be taken down, censored, or controlled by any single entity."*
## Problem Statement
Current code hosting platforms (GitHub, GitLab, Bitbucket) are:
1. **Centralized Points of Failure**: Single company decisions affect millions of developers
2. **Subject to Censorship**: Repositories can be removed due to government pressure or ToS disputes
3. **Vendor Lock-in**: Migration is painful; developers lose issues, PRs, and community
4. **Privacy Concerns**: All code, issues, and activities are visible to the platform operator
5. **Access Restrictions**: Geographic blocks and sanctions limit global collaboration
## Solution
Guts leverages commonware's modular primitives to build a fully decentralized alternative:
- **Byzantine Fault Tolerant Consensus** for repository state agreement
- **Content-Addressed Storage** for immutable, deduplicated data
- **Peer-to-Peer Networking** for censorship-resistant communication
- **Cryptographic Identity** for verifiable authorship
## Target Users
### Primary
- **Open Source Maintainers**: Need censorship-resistant hosting
- **Privacy-Conscious Developers**: Want control over their data
- **Decentralized Projects**: Align infrastructure with project values
- **Enterprise Teams**: Require self-sovereign code infrastructure
### Secondary
- **Protocol Developers**: Building on decentralized infrastructure
- **Security Researchers**: Publishing sensitive findings
- **Distributed Teams**: Global collaboration without restrictions
## Core Features
### Phase 1: Foundation (MVP)
| Feature | Description | Priority |
|---------|-------------|----------|
| Repository Hosting | Git-compatible repos with push/pull | P0 |
| Identity System | Ed25519-based cryptographic identities | P0 |
| P2P Network | Node discovery and communication | P0 |
| Content Storage | Content-addressed blob storage | P0 |
| CLI Client | Command-line interface for all operations | P0 |
### Phase 2: Collaboration
| Feature | Description | Priority |
|---------|-------------|----------|
| Pull Requests | Decentralized code review workflow | P1 |
| Issue Tracking | Distributed issue management | P1 |
| Comments & Discussions | Threaded conversations on code | P1 |
| Notifications | Real-time activity notifications | P1 |
### Phase 3: Governance
| Feature | Description | Priority |
|---------|-------------|----------|
| Repository Permissions | Granular access control | P2 |
| Organizations | Multi-user repository ownership | P2 |
| Voting Mechanisms | Consensus-based decision making | P2 |
| Reputation System | Contribution-based trust scores | P2 |
### Phase 4: Ecosystem
| Feature | Description | Priority |
|---------|-------------|----------|
| Web Gateway | Browser access to repositories | P3 |
| CI/CD Integration | Decentralized build pipelines | P3 |
| Package Registry | Decentralized package hosting | P3 |
| Federation | Inter-network repository bridging | P3 |
### System Overview
### Technology Stack
| Layer | Technology | Rationale |
|-------|------------|-----------|
| Language | Rust | Memory safety, performance, ecosystem |
| Async Runtime | Tokio | Industry standard, commonware compatible |
| Consensus | commonware::consensus | BFT, battle-tested |
| Networking | commonware::p2p | Encrypted, authenticated P2P |
| Storage | RocksDB + Content-Addressed | Performance + deduplication |
| Serialization | commonware::codec | Efficient, stable encoding |
| Cryptography | commonware::cryptography | Ed25519, BLS signatures |
| API | tonic (gRPC) + axum (HTTP) | Performance + ergonomics |
### Data Model
#### Repository
#### Identity
#### Commit (Extended)
## Non-Functional Requirements
### Performance
| Metric | Target | Measurement |
|--------|--------|-------------|
| Git push latency | < 2s for 1MB | p95 under normal load |
| Git clone throughput | > 10 MB/s | Concurrent users |
| API response time | < 100ms | p99 for reads |
| Time to consensus | < 5s | For repository updates |
### Scalability
- Support 10,000+ repositories per node
- Handle 1,000+ concurrent connections
- Store petabytes of data across network
- Horizontal scaling through additional nodes
### Security
- All data signed with Ed25519
- TLS 1.3 for all connections
- No plaintext secrets in storage
- Audit logging for all operations
- Regular security audits
### Reliability
- 99.9% uptime for individual nodes
- Network resilience: tolerate 33% Byzantine nodes
- Automatic failover and recovery
- Data redundancy across nodes
## Success Metrics
### Phase 1 (MVP) - COMPLETE
- [x] Successfully push/pull Git repositories
- [x] Create and verify cryptographic identities
- [x] Connect 3+ nodes in test network
- [x] < 5s end-to-end git push latency
- [x] Complete PR and issue workflows
- [x] Web interface operational
- [x] Real-time updates working
- [x] CI/CD integration complete
- [x] GitHub-compatible API
### Phase 2 (Production Readiness)
- [ ] Pass third-party security audit
- [ ] 10,000 concurrent connections supported
- [ ] < 2s p95 git push latency at scale
- [ ] 20+ independent validator operators
- [ ] Public testnet stable for 30+ days
### Phase 3 (Adoption)
- [ ] 100+ repositories migrated from GitHub
- [ ] 1,000+ active users
- [ ] SDKs for 4+ programming languages
- [ ] IDE integrations published
### Long-term
- [ ] 10,000+ repositories hosted
- [ ] 100+ validator nodes globally distributed
- [ ] Self-sustaining validator economics
- [ ] Community governance established
## Risks & Mitigations
| Risk | Probability | Impact | Mitigation |
|------|-------------|--------|------------|
| Low adoption | Medium | High | Focus on UX, GitHub migration tools |
| Performance issues | Medium | Medium | Extensive benchmarking, optimization |
| Security vulnerabilities | Low | Critical | Audits, bug bounty, formal verification |
| Network fragmentation | Low | High | Strong governance, incentive alignment |
| Regulatory pressure | Medium | Medium | Decentralization, no central operator |
## Dependencies
### External
- [commonware](https://github.com/commonwarexyz/monorepo) - Core primitives
- [gitoxide](https://github.com/Byron/gitoxide) - Git operations
- [tokio](https://tokio.rs) - Async runtime
- [RocksDB](https://rocksdb.org) - Storage engine
- Infrastructure deployment automation
- CI/CD pipeline
## Timeline
### Completed Milestones
#### Milestone 1-9: MVP Complete
All core MVP milestones have been completed:
- Foundation (Git storage, protocol, node API)
- P2P replication with commonware
- Collaboration (PRs, Issues, Comments, Reviews)
- Governance (Organizations, Teams, Permissions)
- Web Gateway (UI, Search, API Documentation)
- Real-time Updates (WebSocket, Notifications)
- CI/CD Integration (Workflows, Runs, Artifacts)
- Git/GitHub Compatibility (Users, Tokens, Releases)
- Production Quality (Observability, Testing, Resilience)
### Upcoming Milestones (Path to Production)
#### Milestone 10: Security Hardening
- Third-party security audit preparation
- Comprehensive threat modeling
- Extended fuzzing (15+ targets)
- Supply chain security (SBOM, reproducible builds)
#### Milestone 11: Performance & Scalability
- Load testing at 1000+ concurrent users
- RocksDB persistent storage integration
- Consensus throughput optimization
- Multi-level caching strategy
#### Milestone 12: True Decentralization
- DHT-based peer discovery (no bootstrap required)
- Stake-based validator governance
- Sybil resistance mechanisms
- Public testnet with 20+ operators
#### Milestone 13: Operator Experience
- Comprehensive operational documentation
- 15+ operational runbooks
- Monitoring dashboards and alerting
- Disaster recovery procedures
- Multi-cloud deployment guides
#### Milestone 14: User Adoption
- GitHub/GitLab migration tools
- SDKs (TypeScript, Python, Go, Rust)
- IDE integrations (VS Code, JetBrains)
- SSH protocol support
- Community platform
## Open Questions
1. **Incentive Model**: How do we incentivize node operators?
2. **Spam Prevention**: How do we prevent repository spam without central moderation?
3. **Large File Storage**: How do we handle Git LFS equivalents?
4. **Search**: How do we implement decentralized code search?
## References
- [Commonware Documentation](https://github.com/commonwarexyz/monorepo)
- [Git Protocol Specification](https://git-scm.com/docs/protocol-v2)
- [IPFS Whitepaper](https://ipfs.tech/whitepaper/)
- [Byzantine Fault Tolerance](https://pmg.csail.mit.edu/papers/osdi99.pdf)
---
*This document is a living specification and will be updated as the project evolves.*
|