Skip to content

Latest commit

Β 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

VoiceVault

Own Your Voice. Deploy Your Agent. Earn Forever.

VoiceVault is a decentralized Web3 platform for creating, owning, and monetizing AI voice models on the Sui blockchain. Users can train custom AI voice models, mint on-chain ownership NFTs, deploy autonomous voice agents powered by LiveKit, and earn crypto every time someone uses their voice. It bridges the gap between voice creators and consumers through a transparent, decentralized marketplace with cryptographic proof of rights and automated payment distribution.

License Status


🌟 Features

Voice Ownership

  • Voice Registration β€” Train and register custom AI voice models on-chain as NFTs
  • Global Registry β€” On-chain VoiceRegistry shared object makes all voices globally discoverable (no localStorage dependency)
  • Voice Marketplace β€” Browse, search, and license voices from creators worldwide
  • On-chain License Pass β€” Purchasing a voice mints a LicensePass object to your wallet; backend verifies it instead of trusting internal DB logic

Agent Deployment (/deploy)

  • 4-step wizard β€” Voice β†’ Template β†’ Configure β†’ Deploy
  • 5 agent templates β€” Sales Agent, Support Agent, Tutor Agent, Creator Clone, Custom
  • LLM choice β€” GPT-4o, Claude 3.5 Sonnet, Gemini 1.5 Pro, Groq Llama 3
  • Pay-per-call pricing β€” Set a SUI price per call; payment split handled on-chain
  • LiveKit integration β€” Generates a voice room and agent worker start command on deploy
  • Agent dashboard β€” See all deployed agents, live/paused status, call count, earnings

Payments & Access Control

  • Royalty split β€” Every payment automatically splits: 2.5% platform fee, 10% royalty, remainder to creator
  • On-chain access verification β€” Backend queries Sui RPC for LicensePass ownership; no permissive placeholder logic
  • Revenue tracking β€” Creator earnings visible in the dashboard

πŸ—οΈ Tech Stack

Frontend

  • Framework: React 18 + TypeScript
  • Bundler: Vite
  • Styling: Tailwind CSS
  • UI Components: shadcn/ui + Radix UI
  • Web3: @mysten/sui, @mysten/dapp-kit
  • State: React Context + TanStack Query
  • Charts: Recharts

Backend

  • Language: Python 3.8+
  • API Framework: FastAPI + Uvicorn
  • Storage: Walrus (content-addressed blob storage)
  • Voice runtime: LiveKit Agents (livekit-api)
  • Agent store: JSON-backed flat file store (storage/agents.json)

Blockchain

  • Language: Move 2024
  • Network: Sui testnet / mainnet
  • Modules: voice_identity, payment, agent_identity

πŸ“‹ Prerequisites

  • Node.js 18+
  • Python 3.8+
  • Sui CLI (for contract deployment)
  • Sui Wallet browser extension
  • LiveKit account (optional β€” required for live voice rooms)

πŸš€ Installation

1. Frontend

cd frontend
npm install
npm run dev          # http://localhost:5173

2. Backend

cd backend
python -m venv venv
source venv/bin/activate      # Windows: venv\Scripts\activate
pip install -r requirements.txt
python server.py              # http://localhost:8000

3. Smart Contracts

cd voice_vault_sui
sui client publish --gas-budget 50000000

After publishing, copy the Package ID and the VoiceRegistry shared object ID from the output into .env.


βš™οΈ Environment Variables

Copy .env at the project root and fill in your values:

# ── Sui ──────────────────────────────────────────────
SUI_NETWORK=testnet
SUI_RPC_URL=https://fullnode.testnet.sui.io
SUI_PACKAGE_ID=0x<your_package_id>
SUI_VOICE_REGISTRY_ID=0x<registry_shared_object_id>

# ── Frontend (Vite) ───────────────────────────────────
VITE_SUI_PACKAGE_ID=0x<your_package_id>
VITE_SUI_VOICE_REGISTRY_ID=0x<registry_shared_object_id>
VITE_API_URL=http://localhost:8000

# ── Walrus ────────────────────────────────────────────
WALRUS_STORAGE_MODE=local          # or "remote"
WALRUS_PUBLISHER_URL=https://publisher.walrus-testnet.walrus.space

# ── LiveKit (required for live voice agent rooms) ─────
# Get credentials at https://cloud.livekit.io
LIVEKIT_URL=wss://your-project.livekit.cloud
LIVEKIT_API_KEY=your_livekit_api_key
LIVEKIT_API_SECRET=your_livekit_api_secret

# ── LLM providers (used by the agent worker) ──────────
OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_anthropic_api_key

πŸ“ Project Structure

VoiceVaultSui/
β”œβ”€β”€ frontend/
β”‚   └── src/
β”‚       β”œβ”€β”€ pages/
β”‚       β”‚   β”œβ”€β”€ Index.tsx          Landing page
β”‚       β”‚   β”œβ”€β”€ Marketplace.tsx    Voice discovery & purchase
β”‚       β”‚   β”œβ”€β”€ Upload.tsx         Voice model processing & registration
β”‚       β”‚   β”œβ”€β”€ Deploy.tsx         Agent deployment wizard + dashboard
β”‚       β”‚   └── Dashboard.tsx      Creator earnings & analytics
β”‚       β”œβ”€β”€ hooks/
β”‚       β”‚   β”œβ”€β”€ useVoiceMetadata.ts
β”‚       β”‚   β”œβ”€β”€ useGlobalRegistry.ts   On-chain registry query
β”‚       β”‚   β”œβ”€β”€ useVoiceRegister.ts
β”‚       β”‚   β”œβ”€β”€ useVoiceUnregister.ts
β”‚       β”‚   └── usePayForInference.ts  Payment + LicensePass mint
β”‚       └── lib/
β”‚           β”œβ”€β”€ contracts.ts       Package ID, registry ID, fee constants
β”‚           β”œβ”€β”€ agentApi.ts        Agent CRUD + deploy API client
β”‚           β”œβ”€β”€ voiceRegistry.ts   (legacy β€” superseded by on-chain registry)
β”‚           β”œβ”€β”€ purchasedVoices.ts Local cache of purchased voices
β”‚           └── walrus.ts          Walrus manifest fetch helpers
β”‚
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ server.py          FastAPI app + all routes
β”‚   β”œβ”€β”€ agent_store.py     JSON-backed agent store
β”‚   β”œβ”€β”€ livekit_service.py LiveKit token generation
β”‚   β”œβ”€β”€ walrus.py          Walrus storage + verify_license_pass()
β”‚   β”œβ”€β”€ voice_model.py     Voice embedding + bundle generation
β”‚   └── storage/
β”‚       β”œβ”€β”€ walrus/        Local Walrus blob store
β”‚       └── agents.json    Deployed agent configs
β”‚
β”œβ”€β”€ voice_vault_sui/
β”‚   └── sources/
β”‚       β”œβ”€β”€ voice_identity.move   VoiceIdentity NFT + VoiceRegistry
β”‚       β”œβ”€β”€ payment.move          Royalty split + LicensePass mint
β”‚       └── agent_identity.move   AgentIdentity on-chain object
β”‚
└── docs/

🎯 Usage

Running the Application

# Terminal 1 β€” backend
cd backend && python server.py

# Terminal 2 β€” frontend
cd frontend && npm run dev

Creating & Registering a Voice

  1. Connect your Sui wallet
  2. Go to Create Voice (/upload)
  3. Record or upload a voice sample
  4. Process the model β†’ uploads bundle to Walrus
  5. Register on-chain β†’ mints a VoiceIdentity NFT to your wallet
  6. Your voice appears in the global marketplace immediately

Purchasing a Voice

  1. Browse Marketplace (/marketplace)
  2. Click Buy Voice on any listing
  3. Approve the SUI transaction β€” a LicensePass NFT is minted to your wallet
  4. Go to Create Voice β†’ use the purchased voice for TTS generation

Deploying a Voice Agent

  1. Go to Deploy Agent (/deploy)
  2. Step 1 β€” Voice: Confirm your registered on-chain voice
  3. Step 2 β€” Template: Pick Sales Agent, Support Agent, Tutor, Creator Clone, or Custom
  4. Step 3 β€” Configure: Set agent name, system prompt, LLM provider, and price per call (SUI)
  5. Step 4 β€” Deploy: Review summary β†’ click Deploy Agent
  6. Copy the displayed worker start command and run it in a terminal:
LIVEKIT_URL=wss://... LIVEKIT_API_KEY=... LIVEKIT_API_SECRET=... ROOM_NAME=vv-<id> python agent_worker.py dev
  1. Click Talk on your agent card to open the live voice room
  2. Callers pay your configured SUI price per call, split on-chain automatically

πŸ” Smart Contracts

voice_identity.move

  • VoiceRegistry β€” shared object; all registered voice owners appended on every register_voice call
  • VoiceIdentity β€” owned NFT per creator with name, Walrus URI, rights, price
  • register_voice(registry, ...) β€” appends owner to global registry
  • delete_voice(registry, ...) β€” removes owner from registry

payment.move

  • LicensePass β€” owned NFT minted to the buyer on every successful purchase
  • pay_with_royalty_split(payment, voice_id, ...) β€” splits coins and mints LicensePass in a single transaction
  • Fee structure: 2.5% platform fee, 10% royalty, remainder to creator

agent_identity.move

  • AgentIdentity β€” on-chain object linking a voice to a deployed agent config
  • create_agent, pause_agent, resume_agent, delete_agent
  • Emits AgentCreated event on deployment

πŸ“‘ API Reference

Voice

Method Endpoint Description
POST /api/voice/process Process audio β†’ generate embedding bundle β†’ upload to Walrus
POST /api/tts/generate Generate speech (owner or valid LicensePass required)
POST /api/walrus/upload Upload a voice bundle to Walrus
POST /api/walrus/download Download a file from a Walrus bundle
POST /api/walrus/delete Delete a voice bundle (owner only)

Payments

Method Endpoint Description
POST /api/payment/breakdown Calculate platform fee + royalty + creator split

Agent Deploy

Method Endpoint Description
POST /api/agent/create Create a new agent config
GET /api/agent/list?owner= List all agents for an owner address
GET /api/agent/:id Get a single agent
POST /api/agent/deploy/:id Mark agent live, generate LiveKit room + token
POST /api/agent/pause/:id Pause agent
POST /api/agent/resume/:id Resume agent
DELETE /api/agent/:id Delete agent
POST /api/agent/join/:id Get a user token to join the agent's room

πŸƒ Development

# Frontend
npm run dev          # Dev server
npm run build        # Production build
npm run lint         # ESLint
npm run type-check   # TypeScript check

# Backend
python server.py     # Dev server (auto-reloads with uvicorn --reload)

πŸ“¦ Production Deployment

# Frontend
cd frontend && npm run build     # outputs to dist/

# Backend
pip install gunicorn
gunicorn -w 4 -k uvicorn.workers.UvicornWorker server:app

# Or Docker
docker build -t voicevault-backend ./backend
docker run -p 8000:8000 --env-file .env voicevault-backend

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit your changes
  4. Open a Pull Request

Code style: ESLint for frontend, PEP 8 for backend, Move style guide for contracts.


πŸ“„ License

MIT β€” see LICENSE.

πŸ”— Links

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages