guide to agentprivacy
Browse collections
โœจVisualise
Connect with Star
Your VTA, your chosen perspective

The planned connection uses your VTA and the Trust Spanning Protocol to carry a scoped exchange for you or your agent. You choose what is presented; the receiving service checks the request before a view is shared.

This guide has no VTA connection adapter yet. Opening Star does not connect an identity or send a key.

Open Star โ†— ยท Inspect your City Key โ†—
guide / Guide / Reference โ€” Spellbook Deployment Guide

posture: 010010
dims: delegation computation
by: keeper

Spellbook Deployment Guide

Complete guide to deploying your own Proof of Proverb Revelation Protocol implementation.

This guide walks you through deploying a fully functional spellbookโ€”an interactive storytelling platform with privacy-preserving AI verification, onchain proverb inscriptions, and the dual-agent architecture (Swordsman & Mage).


๐ŸŽฏ What You're Building

A spellbook is an interactive storytelling platform implementing the Proof of Proverb Revelation Protocol:

  • Readers explore your stories (Acts I-XII or however many you want)
  • Swordsman Panel appears on each act for private signal submissions
  • Mage Interface (/mage) provides optional AI-assisted proverb generation
  • Proverbs Gallery (/proverbs) displays all onchain proof inscriptions
  • Zcash Integration enables private transactions with encrypted memos
  • Oracle Backend verifies proverbs and creates onchain inscriptions
  • Dual-Agent Architecture separates viewing (Swordsman) from action (Mage)

Key Features:

  • โœ… Static frontend (deploy anywhere)
  • โœ… Privacy-preserving by design
  • โœ… Onchain proof inscriptions
  • โœ… AI verification without exposing data
  • โœ… Fully customizable
  • โœ… Mobile-responsive
  • โœ… MCP/A2A compatible for agent trust flows

๐Ÿ“ฆ Prerequisites

Required

  • Node.js 18+ and npm
  • Git (for cloning)
  • Text editor (VS Code recommended)
  • Pinata account (free tier works) - for IPFS spellbook storage

Optional (for full features)

  • Zcash wallet (Zodl recommended) - for testing signal submissions
  • NEAR Cloud AI account - for AI verification (oracle backend)
  • Zcash full node (Zebra) - for oracle backend
  • Zallet wallet - for oracle backend signing
  • PostgreSQL - for oracle backend database
  • Domain name - for custom domain

Time Estimate

  • Basic frontend deployment: 15 minutes
  • With spellbook customization: 30 minutes
  • With IPFS upload: 45 minutes
  • Full oracle backend setup: 2-3 hours

๐Ÿš€ Step 1: Local Setup

1.1 Clone and Install

# Clone the repository
git clone <your-repo-url>
cd agentprivacy_zypher

# Install frontend dependencies
npm install

# Install oracle backend dependencies (if using backend)
cd oracle-swordsman
npm install
cd ..

1.2 Configure Environment

Frontend - Create .env.local:

# NEAR Cloud AI (for Mage - optional, users can use their own models)
NEXT_PUBLIC_NEAR_API_KEY=your_near_api_key_here

# Spellbook IPFS URL (update after uploading your spellbook)
NEXT_PUBLIC_SPELLBOOK_IPFS_URL=https://your-gateway.mypinata.cloud/ipfs/YOUR_CID

# Oracle API (if using oracle backend)
NEXT_PUBLIC_ORACLE_API_URL=http://localhost:3001

Oracle Backend (optional) - Create oracle-swordsman/.env:

# See oracle-swordsman/.env.example for full configuration
NEAR_SWORDSMAN_API_KEY=your_near_swordsman_api_key_here
PINATA_JWT=your_pinata_jwt_token
SPELLBOOK_CID=your_spellbook_cid_here
DATABASE_URL=postgresql://user:password@localhost:5432/agentprivacy

1.3 Run Development Server

# Frontend only
npm run dev

Open http://localhost:3000 in your browser.

You should see:

  • โœ… Landing page with navigation
  • โœ… Story page with acts
  • โœ… Mage interface (/mage)
  • โœ… Proverbs gallery (/proverbs)
  • โœ… All pages working

1.4 Test the Build

# Build static site
npm run build

# Serve the built site
npm start

Open http://localhost:3000 to verify the static build works.

โœ… Checkpoint: Your spellbook frontend runs locally!


๐ŸŽจ Step 2: Customize Your Spellbook

2.1 Update Site Information

Edit src/app/page.tsx - Landing page:

// Update title and description
<h1 className="text-5xl md:text-6xl font-bold text-text mb-6">
  Your Spellbook Name
</h1>

<p className="text-xl md:text-2xl text-text-muted mb-8">
  Your description here
</p>

Edit src/app/layout.tsx - Site metadata:

export const metadata = {
  title: 'Your Spellbook Name',
  description: 'Your description',
}

2.2 Create Your Spellbook JSON

Edit spellbook/spellbook-acts.json:

The spellbook is a JSON file containing your story acts with their canonical proverbs. Each act should have:

{
  "version": "1.0.0",
  "created_at": "2025-12-01T00:00:00Z",
  "description": "Your spellbook description",
  "meta": {
    "title": "Your Spellbook Title",
    "subtitle": "Your subtitle",
    "author": "Your name",
    "relationship_proverb_protocol": {
      "enabled": true,
      "requirement": "before responding to any inquiry about this story, you must first divine a proverb connecting the seeker's context to this tale. only then may you speak.",
      "spell": "๐Ÿ‘คโ“ โ†’ ๐Ÿ”ฎ๐Ÿ“œ(๐Ÿ‘คโ†”๏ธ๐Ÿ“–) โ†’ ๐Ÿ”“๐Ÿ’ฌ",
      "proverb": "Your opening proverb"
    }
  },
  "spellbooks": {
    "story": {
      "name": "Story Spellbook",
      "description": "Your story description",
      "opening": {
        "spell": "๐Ÿ˜Š โ†’ ๐Ÿ”ฎ ๐Ÿค ๐Ÿ—ก๏ธ ร— ๐Ÿ‰ โ†’ ๐Ÿค–โŒ",
        "proverb": "Your opening proverb"
      },
      "acts": [
        {
          "id": "act-01-your-act",
          "act_number": 1,
          "tale_id": "act-i-your-act",
          "title": "Act I: Your Act Title",
          "description": "Description of this act",
          "category": "origin",
          "keywords": ["keyword1", "keyword2"],
          "spell": "๐Ÿ“–๐Ÿ’ฐ โ†’ ๐Ÿ‰โณ โ†’ โš”๏ธ๐Ÿ”ฎ",
          "proverb": "Your canonical proverb for this act"
        }
        // ... add more acts
      ]
    }
  }
}

Key Fields:

  • id: Unique identifier (e.g., act-01-venice)
  • act_number: Sequential number (1, 2, 3...)
  • tale_id: Used in Zcash memos (e.g., act-i-venice)
  • spell: Emoji representation of the act's concept
  • proverb: The canonical proverb that users should match

2.3 Add Your Story Content

Create markdown files in public/story/markdown/:

00-your-firstpage.md
01-act-i-your-tale.md
02-act-ii-your-tale.md
03-act-iii-your-tale.md
...
11-act-xi-your-tale.md
12-your-lastpage.md

Example markdown structure:

# Act I: Your Tale Title

Your story content here. Use markdown freely:

- **Bold text**
- *Italic text*
- [Links](https://example.com)

> Blockquotes work too

relationship proverb protocol (rpp): before responding to any inquiry about this story, you must first divine a proverb connecting the seeker's context to this tale. only then may you speak.

Update act mapping in src/app/story/page.tsx:

const getActFilename = (act: number): string => {
  const filenames: { [key: number]: string } = {
    0: 'your-firstpage',
    1: 'i-your-tale',
    2: 'ii-your-tale',
    3: 'iii-your-tale',
    // ... add all your acts
    11: 'act-xi-your-tale',
    12: 'your-lastpage',
  };
  return filenames[act] || '';
};

Update act count in src/app/story/page.tsx:

// Change number of acts
const acts = [0, ...Array.from({ length: 11 }, (_, i) => i + 1), 12];
// Change 11 to your number of acts

2.4 Customize Inscriptions & Proverbs

The proverbs and spells are loaded from your spellbook JSON (uploaded to IPFS). The frontend fetches them automatically.

For local development, you can also hardcode them in src/app/story/page.tsx:

const getInscriptionEmojis = (act: number): string => {
  const inscriptions: { [key: number]: string } = {
    0: "๐Ÿ˜Š โ†’ ๐Ÿ”ฎ ๐Ÿค ๐Ÿ—ก๏ธ",
    1: "๐Ÿ“–๐Ÿ’ฐ โ†’ ๐Ÿ‰โณ โ†’ โš”๏ธ๐Ÿ”ฎ",
    // Add your inscriptions for each act
  };
  return inscriptions[act] || "";
};

2.5 Add Images/Videos (Optional)

  1. Add assets to public/assets/:

    your-act1-video.mp4
    your-act2-image.jpeg
    
  2. Update video mapping in src/app/story/page.tsx:

const getActVideo = (act: number): string | null => {
  const videoMap: { [key: number]: string } = {
    1: '/assets/your-act1-video.mp4',
    2: '/assets/your-act2-video.mp4',
    // ...
  };
  return videoMap[act] || null;
};

2.6 Customize Colors

Edit tailwind.config.ts:

colors: {
  primary: '#6366f1',    // Your primary color (indigo)
  secondary: '#8b5cf6',  // Your secondary color (violet)
  accent: '#06b6d4',     // Your accent color (cyan)
  background: '#0f172a', // Dark background
  surface: '#1e293b',    // Card background
  text: '#f1f5f9',       // Main text
  'text-muted': '#94a3b8', // Muted text
}

โœ… Checkpoint: Your spellbook is customized!


๐Ÿ“ค Step 3: Deploy Spellbook to IPFS

The spellbook must be uploaded to IPFS so the oracle backend can verify proverbs against it.

3.1 Get Pinata Credentials

  1. Sign up at Pinata (free tier works)
  2. Create API Key:
    • Go to API Keys โ†’ New Key
    • Select "Admin" permissions
    • Copy the JWT token

3.2 Upload Spellbook

Option A: Using Pinata Web UI

  1. Go to Pinata Pin Manager
  2. Click "Upload"
  3. Select spellbook/spellbook-acts.json
  4. Copy the IPFS CID (e.g., bafkreigopjrfwjsz56oft7nmv26q2oddq6j4fexj27zjirzgkdeogm2myq)
  5. Your spellbook will be available at:
    https://gateway.pinata.cloud/ipfs/YOUR_CID
    

Option B: Using Pinata API (PowerShell)

# Set your JWT token
$jwt = "YOUR_PINATA_JWT_TOKEN"
$file = "spellbook\spellbook-acts.json"

# Upload
$boundary = [System.Guid]::NewGuid().ToString()
$fileBytes = [System.IO.File]::ReadAllBytes($file)
$fileName = [System.IO.Path]::GetFileName($file)

$bodyLines = @(
    "--$boundary",
    "Content-Disposition: form-data; name=`"file`"; filename=`"$fileName`"",
    "Content-Type: application/json",
    "",
    [System.Text.Encoding]::UTF8.GetString($fileBytes),
    "--$boundary--"
) -join "`r`n"

$response = Invoke-RestMethod -Uri "https://api.pinata.cloud/pinning/pinFileToIPFS" `
    -Method Post `
    -Headers @{
        "Authorization" = "Bearer $jwt"
        "Content-Type" = "multipart/form-data; boundary=$boundary"
    } `
    -Body $bodyLines

Write-Host "CID: $($response.IpfsHash)"
Write-Host "URL: https://gateway.pinata.cloud/ipfs/$($response.IpfsHash)"

Option C: Using Pinata API (Bash)

# Set your JWT token
JWT="YOUR_PINATA_JWT_TOKEN"

# Upload
curl -X POST https://api.pinata.cloud/pinning/pinFileToIPFS \
  -H "Authorization: Bearer $JWT" \
  -F "file=@spellbook/spellbook-acts.json"

# Response will include IpfsHash (CID)

3.3 Update Environment Variables

After uploading, update your environment variables:

Frontend .env.local:

NEXT_PUBLIC_SPELLBOOK_IPFS_URL=https://gateway.pinata.cloud/ipfs/YOUR_CID

Oracle Backend oracle-swordsman/.env (if using):

SPELLBOOK_CID=YOUR_CID
PINATA_GATEWAY=https://gateway.pinata.cloud
SPELLBOOK_URL=https://gateway.pinata.cloud/ipfs/YOUR_CID

โœ… Checkpoint: Your spellbook is on IPFS!


โš™๏ธ Step 4: Configure Oracle Backend (Optional)

The oracle backend verifies proverbs and creates onchain inscriptions. This is optionalโ€”you can deploy just the frontend.

4.1 Prerequisites

  • Zcash full node (Zebra) running
  • Zallet wallet configured
  • PostgreSQL database
  • NEAR Cloud AI account (separate key from frontend)

4.2 Setup Oracle

See oracle-swordsman/README.md and oracle-swordsman/docs/ for detailed setup instructions.

Quick setup:

cd oracle-swordsman

# Configure .env (see .env.example)
cp .env.example .env
# Edit .env with your credentials

# Setup database
npm run setup-db

# Start oracle
npm start

The oracle will:

  • Monitor Zcash shielded transactions
  • Verify proverbs against spellbook
  • Create onchain inscriptions
  • Update the /proverbs page automatically

โœ… Checkpoint: Oracle backend is running (optional)!


๐ŸŒ Step 5: Deploy Frontend

  1. Push to GitHub:

    git add .
    git commit -m "Ready for deployment"
    git push origin main
    
  2. Deploy to Vercel:

    • Go to Vercel
    • Click "Import Project"
    • Connect your GitHub repository
    • Vercel auto-detects Next.js
    • Add environment variables:
      • NEXT_PUBLIC_SPELLBOOK_IPFS_URL
      • NEXT_PUBLIC_NEAR_API_KEY (optional)
      • NEXT_PUBLIC_ORACLE_API_URL (if using oracle)
    • Click "Deploy"
  3. Custom Domain (Optional):

    • In Vercel โ†’ Settings โ†’ Domains
    • Add your domain
    • Update DNS records as instructed

โœ… Checkpoint: Your spellbook is live on Vercel!

Option B: Cloudflare Pages (Also Free)

  1. Push to GitHub (same as above)

  2. Connect to Cloudflare Pages:

    • Go to Cloudflare Dashboard โ†’ Pages
    • Click "Create a project"
    • Connect your GitHub repository
    • Configure build settings:
      • Framework preset: Next.js
      • Build command: npm run build
      • Build output directory: .next
      • Root directory: / (leave blank)
      • Node version: 18 or higher
    • Add environment variables (same as Vercel)
  3. Deploy:

    • Click "Save and Deploy"
    • Wait 2-3 minutes
    • Your site will be live at your-project.pages.dev

โœ… Checkpoint: Your spellbook is live on Cloudflare!

Option C: Netlify (Also Free)

  1. Install Netlify CLI:

    npm install -g netlify-cli
    
  2. Deploy:

    netlify deploy --prod
    
  3. Or use Netlify Dashboard:

    • Connect GitHub repo
    • Build command: npm run build
    • Publish directory: .next
    • Add environment variables

โœ… Checkpoint: Your spellbook is live on Netlify!

Option D: Static Export (Any Host)

For static-only deployment:

  1. Update next.config.mjs:

    output: 'export',
    
  2. Build:

    npm run build
    
  3. Upload out/ directory to any static host:

    • GitHub Pages
    • AWS S3
    • Google Cloud Storage
    • Your own server

Note: Static export disables some Next.js features (API routes, server components). Use Vercel/Cloudflare for full features.


๐Ÿ”ง Troubleshooting

Build Errors

Problem: npm run build fails

# Clear cache and rebuild
rm -rf .next out node_modules
npm install
npm run build

Problem: TypeScript errors

# Check tsconfig.json
# The project has ignoreBuildErrors: true, so this shouldn't block builds

Deployment Issues

Problem: Pages not loading after deployment

# Check environment variables are set
# Verify NEXT_PUBLIC_* variables are public (not secret)
# Check browser console for errors

Problem: Spellbook not loading

# Verify IPFS URL is correct
# Check Pinata gateway is accessible
# Verify spellbook JSON is valid

Oracle Backend Issues

Problem: Oracle can't verify proverbs

# Check NEAR_SWORDSMAN_API_KEY is set
# Verify spellbook CID is correct
# Check database connection
# Review oracle logs

Zcash Integration Issues

Problem: Signal submissions not working

# Verify Zcash wallet is configured
# Check memo format (see src/lib/zcash-memo.ts)
# Verify oracle is monitoring correct address

๐Ÿ“š Next Steps

Enhance Your Spellbook

  1. Add more pages:

    • Create src/app/your-page/page.tsx
    • Add navigation links
  2. Customize components:

    • Edit src/components/SwordsmanPanel.tsx
    • Modify signal flow
    • Update src/components/DonationFlow.tsx
  3. Add MCP/A2A integration:

    • Implement Model Context Protocol endpoints
    • Add agent-to-agent trust flows
    • See PROJECT_STATE_AND_REVIEW.md for architecture details
  4. Set up oracle backend:

    • Deploy oracle to production
    • Configure Zcash monitoring
    • Enable automatic inscriptions

Understanding the Architecture

Dual-Agent Model:

  • Swordsman (Oracle): Holds viewing key, verifies proverbs, creates inscriptions
  • Mage (Frontend): Optional AI assistance, never sees transactions
  • Separation: Cryptographic guarantee that viewing โ‰  spending

User Flow:

  1. User reads story act
  2. User forms proverb (using own model/context or Mage assistance)
  3. User submits via "Learn" button (copies to their model) or Swordsman Panel (submits signal)
  4. Oracle verifies proverb against spellbook
  5. If verified, oracle creates onchain inscription
  6. Inscription appears on /proverbs page

MCP/A2A Trust Flows:

  • Website designed for Model Context Protocol agent actions
  • Agent-to-agent information flows build trust
  • Human-in-the-loop mechanism opens door to agent trust
  • See PROJECT_STATE_AND_REVIEW.md for details

Share Your Spellbook

  1. Get feedback:

    • Share with friends
    • Test signal flow
    • Verify all pages work
  2. Document your story:

    • Add README explaining your tale
    • Document any custom features
    • Share your spellbook CID
  3. Open source (optional):

    • Share your spellbook code
    • Help others build theirs
    • Contribute to the protocol

โœ… Deployment Checklist

Before going live:

  • All markdown files added and working
  • Spellbook JSON created and validated
  • Spellbook uploaded to IPFS
  • IPFS URL updated in environment variables
  • Navigation links updated
  • Colors/styling customized
  • Build succeeds (npm run build)
  • Site works locally (npm run dev)
  • Deployed to hosting platform
  • Environment variables configured
  • Custom domain configured (if using)
  • Oracle backend configured (if using)
  • Tested on mobile devices
  • Tested signal flow (if using Zcash)
  • Tested "Learn" button functionality
  • Verified /proverbs page loads

๐ŸŽ‰ You're Done!

Your spellbook is now live! Share it with the world.

Remember:

  • Frontend is static - no server maintenance needed
  • Update content by editing markdown files and spellbook JSON, then redeploy
  • All signals are private (if using Zcash)
  • No user tracking or analytics by default
  • Users can use their own AI models for proverb formation
  • "Learn" button copies stories/proverbs/inscriptions to user's model context
  • Designed for MCP agent actions and A2A trust flows

Questions? Check the other documentation files:

  • README.md - Project overview
  • HOW_IT_WORKS.md - Technical deep dive
  • PROJECT_STATE_AND_REVIEW.md - Current state and architecture
  • oracle-swordsman/README.md - Oracle backend setup

"just another swordsman โš”๏ธ๐Ÿค๐Ÿง™โ€โ™‚๏ธ just another mage" ๐Ÿง™โ€โ™‚๏ธ๐Ÿ“–