Skip to main content

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

  1. Encrypt: Files encrypted client-side with AES-256-GCM
  2. Upload: Encrypted blob uploaded to Pinata API
  3. Pin: Pinata pins the file to IPFS network
  4. CID: Returns Content Identifier (CID) for retrieval
  5. Download: Fetch via Pinata gateway, decrypt client-side

Features

  1. Fast Uploads - Direct upload to Pinata with retry logic
  2. Gateway Access - Downloads via gateway.pinata.cloud
  3. Metadata Storage - Separate CID for file metadata
  4. 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

  1. Create account at pinata.cloud
  2. Go to API Keys section
  3. Create new key with pinFileToIPFS permission
  4. Copy JWT token to PINATA_JWT environment variable

Pricing

Pinata offers:
  • Free tier: 1GB storage, 100 pins
  • Starter: $20/month, 25GB storage
  • Professional: Custom pricing
zkStorage uses minimal storage since only encrypted blobs are stored.

Migration Notes

zkStorage previously used NFT.Storage (deprecated June 2024). Migration to Pinata provides:
  1. Better upload reliability
  2. Faster gateway access
  3. Active maintenance and support