Overview
Pinata provides IPFS pinning services that zkStorage uses to store encrypted files. Files are encrypted client-side before upload, then pinned to IPFS via Pinata’s API.How It Works
- Encrypt: Files encrypted client-side with AES-256-GCM
- Upload: Encrypted blob uploaded to Pinata API
- Pin: Pinata pins the file to IPFS network
- CID: Returns Content Identifier (CID) for retrieval
- Download: Fetch via Pinata gateway, decrypt client-side
Features
- Fast Uploads - Direct upload to Pinata with retry logic
- Gateway Access - Downloads via gateway.pinata.cloud
- Metadata Storage - Separate CID for file metadata
- Multi-Gateway Fallback - Cloudflare and ipfs.io as backup
Integration with zkStorage
zkStorage uses Pinata for all IPFS operations:Terminal Commands
zkStorage commands that use Pinata:API Details
Upload to Pinata
zkTerm uploads encrypted files using Pinata’s pinFileToIPFS endpoint:Download from Gateway
Downloads use the Pinata gateway with fallbacks:File Structure
Each zkStorage upload creates two IPFS objects:
Metadata JSON:
Error Handling
Retry Logic
Uploads include automatic retry with exponential backoff:Timeouts
Environment Variables
Getting a Pinata API Key
- Create account at pinata.cloud
- Go to API Keys section
- Create new key with
pinFileToIPFSpermission - Copy JWT token to
PINATA_JWTenvironment variable
Pricing
Pinata offers:- Free tier: 1GB storage, 100 pins
- Starter: $20/month, 25GB storage
- Professional: Custom pricing
Migration Notes
zkStorage previously used NFT.Storage (deprecated June 2024). Migration to Pinata provides:- Better upload reliability
- Faster gateway access
- Active maintenance and support