Skip to content

jackoske/0ktopus

Repository files navigation

0KTOPUS

NFT-based access control protocol on Solana

Buy access once as an NFT. Use it. Resell it when you're done.


What is 0KTOPUS?

0KTOPUS transforms API subscriptions and digital access into tradeable NFTs on Solana. Instead of recurring subscriptions, users purchase access NFTs that:

  • Track usage - Metered (100 uses), unlimited, or single-use
  • Are transferable - Sell unused access on secondary markets
  • Split revenue - Automatic payments to multiple recipients
  • Work anywhere - Integrate with any API or service

Project Structure

0ktopus2/
├── capability-protocol/      COMPLETE - Solana smart contract
├── capability-frontend/       COMPLETE - MVP web interface
├── access-backend/            PLANNED - Access verification API
├── integration-sdk/           PLANNED - NPM SDK for developers
├── demo-app/                  PLANNED - AI image generation demo
└── docs/                      COMPLETE - Architecture & specs

Legend:

  • COMPLETE - Fully implemented and working
  • PLANNED - Specification complete, implementation pending
  • IN PROGRESS - Currently being developed

Component Status

capability-protocol/ - Solana Smart Contract

Status: COMPLETE

The core Solana program written in Rust/Anchor.

Features:

  • Product registration with customizable access types
  • NFT minting with automatic revenue splitting
  • Usage tracking (metered/unlimited/single-use)
  • Transfer functionality
  • Replay attack protection
  • TypeScript SDK for blockchain interactions

Tech Stack: Rust, Anchor Framework, Solana

Quick Start:

cd capability-protocol
anchor build
anchor test

Docs: See capability-protocol/README.md


capability-frontend/ - Web Interface

Status: COMPLETE

Next.js 14 web application for creating products, minting NFTs, and transferring access.

Features:

  • 3-tab interface: Create Products, Mint NFTs, Transfer NFTs
  • Wallet integration (Phantom, Solflare, etc.)
  • Real-time balance tracking
  • Product cards with pricing and access info
  • NFT cards with usage bars and status
  • 0KTOPUS branding and logo component
  • Responsive grid layouts

Tech Stack: Next.js 14, TypeScript, Tailwind CSS, Solana Wallet Adapter

Quick Start:

cd capability-frontend
npm install
npm run dev

Live at: http://localhost:3000

Docs: See capability-frontend/README.md


access-backend/ - Access Verification API

Status: PLANNED (Specs complete, implementation pending)

REST/WebSocket API server that allows external applications to verify NFT ownership and consume access uses without directly interacting with the blockchain.

Planned Features:

  • POST /api/v1/verify-access - Verify NFT and consume use
  • GET /api/v1/check-access/:nftMint - Check access without consuming
  • Group management for organizing NFT holders
  • Analytics for usage tracking and revenue metrics
  • WebSocket support for real-time events
  • NFT freezing/unfreezing for moderation
  • Rate limiting and caching (Redis)
  • PostgreSQL for persistent analytics

Tech Stack: Fastify, PostgreSQL, Redis, Prisma, WebSocket

Current State:

  • Complete API specification in access-backend/docs/BACKEND_SPEC.md
  • Folder structure created
  • package.json with dependencies defined
  • Placeholder code with TODO comments
  • Implementation pending (Phase 1 - Week 1)

Quick Start (when implemented):

cd access-backend
npm install
cp .env.example .env
npm run dev

Docs: See access-backend/docs/BACKEND_SPEC.md


integration-sdk/ - Developer SDK

Status: PLANNED (Specs complete, implementation pending)

NPM package (@0ktopus/sdk) that allows developers to easily integrate NFT-based access control into their applications.

Planned Features:

  • OktopusClient class for REST API calls
  • React hooks: useAccess, useGroup, useAnalytics
  • Express middleware for protecting API routes
  • WebSocket client for real-time events
  • TypeScript types and full documentation
  • Browser CDN distribution
  • Example integrations (Express, Next.js, vanilla JS)

Tech Stack: TypeScript, React, Axios, Rollup

Current State:

  • Complete SDK specification in integration-sdk/docs/INTEGRATION_SPEC.md
  • NPM package structure created
  • Placeholder code with TODO comments
  • Examples folder structure
  • Implementation pending (Phase 3 - Week 3)

Usage (when published):

npm install @0ktopus/sdk
import { OktopusClient } from '@0ktopus/sdk';

const client = new OktopusClient({
  apiKey: 'your-api-key',
  endpoint: 'https://api.0ktopus.dev'
});

const result = await client.verifyAccess({
  nftMint: 'ABC123...',
  requestData: { action: 'api-call' }
});

Docs: See integration-sdk/docs/INTEGRATION_SPEC.md


demo-app/ - AI Image Generation Demo

Status: PLANNED (Specs complete, implementation pending)

Live demonstration of 0KTOPUS integration showing an AI image generation API protected by NFT-based access.

Planned Features:

  • Next.js frontend for buying NFTs and generating images
  • Express backend with NFT-protected endpoints
  • Real-time usage tracking
  • Integration with @0ktopus/sdk middleware
  • Docker Compose setup for full stack
  • Example of NFT transfer and resale flow

Tech Stack: Next.js 14, Express, @0ktopus/sdk, Docker

Current State:

  • Complete demo specification in demo-app/docs/DEMO_APP_SPEC.md
  • Backend folder structure with middleware placeholders
  • package.json files defined
  • Environment templates created
  • Implementation pending (Phase 4 - Week 4)

Quick Start (when implemented):

cd demo-app
docker-compose up

Live at (planned): https://demo.0ktopus.dev

Docs: See demo-app/docs/DEMO_APP_SPEC.md


docs/ - Architecture & Specifications

Status: COMPLETE

Files:

  • ARCHITECTURE_PLAN.md - Overall system architecture and roadmap
  • Individual component specs in their respective folders:
    • access-backend/docs/BACKEND_SPEC.md
    • integration-sdk/docs/INTEGRATION_SPEC.md
    • demo-app/docs/DEMO_APP_SPEC.md

Quick Start

For complete deployment instructions (localnet/devnet), see DEPLOYMENT_GUIDE.md

Prerequisites

  • Node.js 20+
  • Rust 1.70+
  • Solana CLI 1.18+
  • Anchor CLI 0.31+
  • A Solana wallet with test SOL

Basic Flow

  1. Deploy Smart Contract - See DEPLOYMENT_GUIDE.md for detailed steps
  2. Run Frontend - cd capability-frontend && npm install && npm run dev
  3. Visit http://localhost:3000

Using the App

  1. Create a Product → "Create Products" tab → Fill form → Create
  2. Mint NFT → "Mint NFTs" tab → Select product → Mint
  3. Transfer NFT → "Transfer NFTs" tab → Enter recipient → Transfer

Note: Make sure you have SOL in your wallet. Use solana airdrop 2 for test networks.


Development Roadmap

Phase 1: Access Backend Core (Week 1) - NEXT

  • Set up Fastify server
  • Implement /verify-access endpoint
  • Implement /check-access endpoint
  • Connect to Solana RPC
  • Basic error handling
  • Rate limiting

Phase 2: Group Management (Week 2)

  • Database setup (PostgreSQL/Redis)
  • Group CRUD operations
  • Assign NFTs to groups
  • Role-based permissions
  • Admin dashboard

Phase 3: Integration SDK (Week 3)

  • Create npm package structure
  • REST client
  • React hooks
  • TypeScript types
  • Documentation
  • Publish to npm

Phase 4: Demo Application (Week 4)

  • Build AI API service example
  • Integrate with access backend
  • Show usage tracking
  • Show NFT transfer flow
  • Deploy live demo

Phase 5: NFT Freezing (Week 5)

  • Add freeze authority to smart contract
  • Frontend freeze/unfreeze UI
  • Backend freeze state checking
  • Emergency freeze functionality

What Works Today

Smart Contract

  • Create products with customizable access
  • Mint NFTs with revenue splitting
  • Track usage on-chain
  • Transfer NFTs between wallets

Frontend

  • Create products via UI
  • Purchase access NFTs
  • View NFT details and remaining uses
  • Transfer NFTs to other wallets
  • Real-time SOL balance updates

What's Coming

Access Backend (API for external apps)

  • Verify NFT ownership without blockchain calls
  • Consume uses via REST API
  • Real-time WebSocket events
  • Group management and analytics

Integration SDK (Easy developer integration)

  • npm install @0ktopus/sdk
  • React hooks for access verification
  • Express middleware for API protection
  • Complete TypeScript support

Demo App (Reference implementation)

  • AI image generation API
  • NFT-gated access
  • Usage tracking dashboard
  • Live demo deployment

Tech Stack

Blockchain

  • Smart Contract: Rust, Anchor Framework
  • Network: Solana (localhost/devnet/mainnet-beta)

Frontend

  • Framework: Next.js 14
  • Language: TypeScript
  • Styling: Tailwind CSS
  • Wallet: Solana Wallet Adapter

Backend (Planned)

  • API: Fastify
  • Database: PostgreSQL (Prisma ORM)
  • Cache: Redis
  • WebSocket: ws / Socket.io

SDK (Planned)

  • Language: TypeScript
  • Build: tsup
  • Testing: Vitest
  • Docs: TypeDoc

Documentation

  • Deployment Guide: DEPLOYMENT_GUIDE.md - Complete deployment instructions for localnet and devnet
  • Architecture: ARCHITECTURE_PLAN.md - System overview and roadmap
  • Smart Contract: capability-protocol/README.md
  • Frontend: capability-frontend/README.md
  • Access Backend: access-backend/docs/BACKEND_SPEC.md
  • Integration SDK: integration-sdk/docs/INTEGRATION_SPEC.md
  • Demo App: demo-app/docs/DEMO_APP_SPEC.md

Testing

Smart Contract

cd capability-protocol
anchor test

Frontend

cd capability-frontend
npm run build

Backend (when implemented)

cd access-backend
npm test

Environment Setup

Prerequisites

For complete installation instructions and deployment steps, see DEPLOYMENT_GUIDE.md

Required Software:

  • Node.js 20+
  • Rust 1.70+
  • Solana CLI 1.18+
  • Anchor CLI 0.31+
  • PostgreSQL 15+ (for access backend)
  • Redis 7+ (for access backend)

Environment Variables

Each component has its own .env.example file:

  • capability-protocol/.env - Solana RPC endpoints
  • access-backend/.env - Database URLs, API keys
  • demo-app/backend/.env - 0KTOPUS integration keys

Contributing

This is currently a private project. Contribution guidelines will be added when open-sourced.


License

MIT (to be determined)


Links

  • Website: (Coming soon)
  • Documentation: See docs/ folder
  • Demo: (Coming soon)
  • NPM Package: @0ktopus/sdk (Coming soon)

Support

For issues or questions:

  • Check the relevant component's README
  • See documentation in docs/
  • Review the architecture plan: ARCHITECTURE_PLAN.md

Built with ❤️ by the 0KTOPUS Team

Transforming subscriptions into tradeable assets on Solana

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors