Skip to content

PhiBao/SkyStorage

Repository files navigation

SkyStorage 🌀️

A decentralized file storage platform built on Shelby Protocol. Upload any file type and store it permanently on the Aptos blockchain with erasure coding.

🌟 Features

  • πŸ“ Universal File Upload - Support for all file types: documents, images, videos, audio, archives, and more
  • πŸ’³ Petra Wallet Integration - Real wallet connection with transaction signing
  • πŸ” Blockchain Storage - Files stored on Shelby Protocol with Clay erasure coding
  • 🎯 Drag & Drop - Easy file upload with drag-and-drop interface
  • πŸ“± Modern UI - Responsive design with file preview and gallery
  • 🎬 File Management - View, preview, and download all your uploaded files
  • 🌐 Decentralized - Files stored across distributed Shelby network nodes
  • ⏰ Expiration Management - Set custom expiration dates for stored files
  • πŸ“Š Performance Benchmarking - Real-time metrics comparing Shelby with AWS/Azure/GCP
  • ⚑ Speed Analytics - Track upload/download speeds with detailed breakdowns

πŸ› οΈ Technology Stack

  • Frontend: Next.js 14 App Router, TypeScript, Tailwind CSS
  • UI Components: shadcn/ui, Lucide icons
  • Blockchain: Aptos Shelbynet
  • Storage SDK: @shelby-protocol/sdk with Clay erasure coding
  • Wallet: Petra browser extension

πŸš€ Quick Start

1. Clone and Install

git clone https://github.com/PhiBao/SkyStorage.git
cd SkyStorage
npm install

2. Setup Environment

Create .env.local:

# Shelby API Key (optional - for enhanced features)
NEXT_PUBLIC_SHELBY_API_KEY=your_shelby_api_key

# Aptos API Key (optional - uses public endpoints by default)
NEXT_PUBLIC_APTOS_API_KEY=

3. Run the App

npm run dev

Open http://localhost:3000

πŸ’‘ Usage

  1. Connect Wallet

    • Click "Connect Wallet" button
    • Important: Switch Petra wallet to Shelbynet network
    • Approve the connection
  2. Configure Shelbynet in Petra

    • Network Name: Shelbynet
    • RPC URL: https://api.shelbynet.shelby.xyz/v1
    • Chain ID: Check Shelby Documentation
  3. Upload Files

    • Drag & drop any file or click to browse
    • Supports all file types up to 100MB
    • Approve the blockchain transaction in Petra wallet
    • File will be encoded and uploaded to Shelby network
  4. Manage Your Files

    • All uploaded files appear in the gallery
    • Click Preview to view images/videos inline
    • Click Download to download from Shelby network (with speed metrics)
    • Click the explorer icon to view on Shelby Explorer
  5. Performance Metrics

    • View real-time upload/download speeds
    • Compare with AWS S3, Azure, Google Cloud
    • See detailed timing breakdowns
    • Understand trade-offs between Web2 and Web3 storage

πŸ“– Supported File Types

  • Documents: PDF, DOC, DOCX, TXT, RTF, ODT
  • Spreadsheets: XLS, XLSX, CSV
  • Images: JPG, PNG, GIF, WEBP, SVG, BMP
  • Videos: MP4, AVI, MOV, WEBM, MKV, FLV
  • Audio: MP3, WAV, OGG, FLAC, AAC
  • Archives: ZIP, RAR, 7Z, TAR, GZ
  • Code: JS, TS, PY, JAVA, CPP, HTML, CSS
  • Data: JSON, XML, YAML, YML
  • And more!

πŸ—οΈ How It Works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   File to Shelby Flow                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚   Select/Drop File Locally             β”‚
         β”‚   (Any file type, up to 100MB)         β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚   Erasure Coding (Clay)                β”‚
         β”‚   - Split into chunks                  β”‚
         β”‚   - Add redundancy                     β”‚
         β”‚   - Generate merkle root               β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚   Register on Blockchain               β”‚
         β”‚   - Sign with Petra wallet             β”‚
         β”‚   - Store merkle root on-chain         β”‚
         β”‚   - Set expiration                     β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚   Upload to Shelby Network             β”‚
         β”‚   - Distribute chunks across nodes     β”‚
         β”‚   - Decentralized storage              β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚   Access Anywhere                      β”‚
         β”‚   - Download from any node             β”‚
         β”‚   - Preview in browser                 β”‚
         β”‚   - Verify with merkle root            β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‹ Prerequisites

  • Node.js v18 or later
  • npm or pnpm
  • Petra Wallet - Browser extension for Aptos

Install Petra Wallet

Visit petra.app and install the browser extension.

πŸš€ Deployment

Vercel / Netlify / Railway

βœ… Now works on Vercel! Since we removed yt-dlp dependency, this app can be deployed to any platform:

# Deploy to Vercel
vercel

# Or deploy to Netlify
netlify deploy

# Or deploy to Railway
railway up

See VERCEL_DEPLOYMENT.md for detailed deployment guides.

πŸ“Š Performance Benchmarking

SkyStorage includes comprehensive benchmarking to compare Shelby Protocol with traditional cloud providers:

Upload Metrics

  • File upload time (including erasure coding and blockchain transaction)
  • Upload speed (MB/s)

Download Metrics

  • Download time from Shelby network
  • Download speed (MB/s)
  • Real-time comparison with AWS S3, Azure CDN, YouTube, Google Drive

Service Comparison

View detailed comparison table showing:

  • Shelby Protocol: Decentralized, permanent, blockchain-verified storage
  • AWS S3: 5-25 MB/s upload, 10-50 MB/s download
  • Azure Blob: 10-30 MB/s upload, 20-100 MB/s download
  • Google Cloud: 15-40 MB/s upload, 25-120 MB/s download
  • Cloudflare R2: 20-50 MB/s upload, 30-150 MB/s download

Key Insight: While Shelby may have higher latency due to blockchain transactions and erasure coding, it provides unique benefits: permanence, censorship resistance, and cryptographic verification that Web2 services cannot match.

See BENCHMARKING.md for detailed documentation.

πŸ”— API Endpoints

  • GET /api/list-videos - Query files from blockchain
  • GET /api/get-file - Retrieve uploaded file (legacy endpoint)

πŸ§ͺ Development

Build the application:

npm run build

Start production server:

npm start

πŸ“ Project Structure

SkyStorage/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                        # Next.js 14 App Router
β”‚   β”‚   β”œβ”€β”€ api/                    # API Routes
β”‚   β”‚   β”‚   β”œβ”€β”€ get-file/           # File retrieval
β”‚   β”‚   β”‚   └── list-videos/        # Query files from blockchain
β”‚   β”‚   β”œβ”€β”€ layout.tsx              # Root layout with providers
β”‚   β”‚   β”œβ”€β”€ page.tsx                # Home page
β”‚   β”‚   └── globals.css             # Global styles
β”‚   β”œβ”€β”€ components/                 # React Components
β”‚   β”‚   β”œβ”€β”€ ui/                     # UI Components (shadcn/ui)
β”‚   β”‚   β”œβ”€β”€ Header.tsx              # Navigation with network warning
β”‚   β”‚   β”œβ”€β”€ FileUploader.tsx        # File upload interface
β”‚   β”‚   β”œβ”€β”€ FileGallery.tsx         # File management & preview
β”‚   β”‚   β”œβ”€β”€ BenchmarkComparison.tsx # Performance comparison table
β”‚   β”‚   β”œβ”€β”€ WalletProvider.tsx      # Petra wallet integration
β”‚   β”‚   └── WalletInstallModal.tsx  # Wallet install prompt
β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   └── useUploadToShelby.tsx   # Shelby SDK upload hook
β”‚   └── lib/
β”‚       β”œβ”€β”€ shelby-client.ts        # Shelby & Aptos client config
β”‚       └── utils.ts                # Utility functions
β”œβ”€β”€ docs/                           # Documentation
└── README.md                       # This file

🌐 Network Configuration

Petra Wallet Setup for Shelbynet

  1. Open Petra wallet
  2. Click network dropdown
  3. Select "Add Network" or "Custom Network"
  4. Configure:
    • Name: Shelbynet
    • RPC URL: https://api.shelbynet.shelby.xyz/v1
    • Chain ID: (from Shelby docs)

πŸ› Troubleshooting

Common Issues

Wrong network error

  • Ensure Petra wallet is on Shelbynet
  • Check the RPC URL matches: https://api.shelbynet.shelby.xyz/v1

File preview/download not working

  • Verify file was uploaded successfully
  • Check transaction on Shelby Explorer
  • Ensure blob hasn't expired

Wallet connection issues

  • Refresh the page
  • Unlock Petra wallet
  • Check wallet is on Shelbynet

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License.

πŸ”— Links

πŸ™ Acknowledgments

  • Shelby Protocol - Decentralized storage infrastructure
  • Aptos Labs - Layer 1 blockchain platform

Built with ❀️ using Shelby Protocol on Aptos

About

A decentralized file storage platform built on Shelby Protocol. Upload any file type and store it permanently on the Aptos blockchain with erasure coding.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors