PromptHash Stellar is a Soroban-based marketplace for selling reusable AI prompt licenses with XLM payments and wallet-verified unlocks.
PromptHash Stellar is an in-development creator marketplace built on Stellar. It lets creators publish encrypted prompt assets, expose only public preview metadata on-chain, and sell access rights to buyers without transferring ownership of the underlying content.
This repository includes:
- a Soroban smart contract for prompt listing, pricing, purchase tracking, and fee routing
- a Vite + React frontend for browsing, buying, listing, and managing prompt licenses
- serverless unlock endpoints that verify wallet ownership and on-chain access before returning plaintext
The product is intentionally designed around prompt licensing rather than NFT transfer. That matches the actual use case: creators want repeated sales, buyers want reliable access, and the platform needs transparent settlement on Stellar.
AI prompt creators increasingly monetize high-value workflows, but the current tooling is weak:
- prompt files are sold off-platform with poor proof of purchase
- content is either fully exposed before payment or hidden behind opaque centralized paywalls
- NFT-style ownership transfer does not match reusable prompt licensing
- buyers and ecosystem partners cannot easily verify payment logic, fees, or access rules
This creates a trust and distribution gap for creator economy products on-chain.
PromptHash Stellar turns prompt packs into encrypted, contract-backed digital goods:
- creators submit a preview, price, and encrypted prompt payload
- the Soroban contract stores listing metadata, tracks purchase rights, and enforces XLM fee splits
- buyers purchase access in XLM
- buyers sign a short-lived wallet challenge
- the unlock service checks
has_accesson-chain, verifies the wallet signature, decrypts the ciphertext, and returns plaintext only to authorized wallets
PromptHash Stellar addresses a concrete gap between AI workflows and blockchain commerce. It gives creators a way to sell digital knowledge products with transparent payment rails while keeping delivery gated by verifiable wallet-based access. For Stellar, it expands utility beyond transfers into creator payments, programmable commerce, and application-layer access control.
- Encrypted prompt listings with public preview metadata
- Soroban contract for listing creation, purchase rights, creator catalog, buyer catalog, and fee management
- XLM-denominated purchases with contract-enforced seller/platform splits
- Wallet-based access verification using signed challenge messages
- Unlock flow with integrity checking against a stored content hash
- Creator dashboard for price updates and sale activation/deactivation
- Buyer profile for reopening previously purchased prompt licenses
- A creator connects a Stellar wallet.
- The browser encrypts the full prompt with AES-GCM.
- The AES key is wrapped against the unlock service public key.
- The app submits
create_promptto Soroban with the encrypted payload, wrapped key, preview metadata, content hash, and XLM-denominated price.
- A buyer browses public listings from contract state.
- The app approves native asset spend and calls
buy_prompt. - The contract transfers XLM from buyer to seller and fee wallet.
- The contract records purchase rights and increments sales count.
- The buyer requests a challenge token for a prompt.
- The wallet signs the challenge message.
- The unlock endpoint verifies token validity, wallet signature, and on-chain
has_access. - The service unwraps the encrypted key, decrypts the ciphertext, recomputes the hash, and returns plaintext only if the integrity check matches.
PromptHash Stellar is strongly aligned with Stellar and Soroban:
- it uses Soroban contracts for stateful commerce rather than treating Stellar as a passive payment rail
- it settles purchases in XLM, increasing native asset utility
- it benefits from Stellar's low transaction costs and fast settlement for digital goods
- it fits Stellar's focus on practical financial utility by turning digital licensing into a transparent marketplace flow
- Adds a new digital goods and creator economy use case for XLM
- Uses Soroban for programmable access control and revenue splitting
- Encourages wallet activity beyond simple transfers
- Creates demand for contract interactions tied to real content purchases
- Gives creators a straightforward on-ramp to monetize AI assets on Stellar
- Gives buyers a simple XLM purchase flow for digital work products
- Provides a pattern that can extend to templates, datasets, reports, and other encrypted digital goods
- Low fees make smaller digital content purchases viable
- Fast settlement improves checkout UX for access-controlled content
- Soroban supports the contract logic needed for licensing and fee routing
- Stellar is well suited to globally accessible creator payments and micro-commerce
PromptHash Stellar can serve as a reusable reference implementation for:
- creator economy applications on Soroban
- encrypted digital goods marketplaces
- wallet-authenticated unlock flows
- XLM-based application monetization patterns
- Demonstrates a complete Soroban application with frontend, contract, and gated delivery flow
- Provides a practical reference for wallet auth, contract reads/writes, and server-assisted decryption
- Establishes a reusable design pattern for access rights instead of token transfer semantics
- Creators can monetize reusable prompt IP while retaining ownership
- Buyers get verifiable purchase rights with a cleaner flow than off-platform prompt sales
- Access is controlled by wallet ownership instead of an opaque centralized account system
- Broadens the category of applications being built on Stellar
- Showcases practical XLM commerce
- Creates a template for future applications in education, research content, consulting assets, and workflow automation packs
PromptHash Stellar uses a three-part architecture where the Soroban smart contract is the absolute, single source of truth for prompt ownership, purchase records, and access rights.
Located in contracts/prompt-hash.
The contract governs all stateful operations. Off-chain systems must never override or duplicate these responsibilities:
| Operation | On-chain method | Off-chain role |
|---|---|---|
| Prompt creation | create_prompt |
Index & cache (read-only) |
| Price updates | update_prompt_price |
None |
| Listing state | set_prompt_sale_status |
Index & cache (read-only) |
| Purchase & access | buy_prompt / has_access |
Verify via RPC simulation |
| Fee config | set_fee_percentage / set_fee_wallet |
None |
| License transfer | transfer_license |
Index & cache (read-only) |
| Disputes | open_dispute / resolve_dispute |
Off-chain moderation data only |
Key invariant: No off-chain route may grant, revoke, or modify access rights. The api/prompts/unlock.ts endpoint calls has_access via Soroban RPC simulation β it trusts the contract, not the database.
Located in src.
The frontend handles wallet connection, client-side encryption before listing, marketplace browsing, contract-backed purchases, creator dashboard actions, and buyer unlock requests. All state-affirming operations (create, purchase, transfer) go through the smart contract; the frontend never writes directly to the off-chain index.
Two authoritative serverless endpoints:
| Endpoint | Responsibility |
|---|---|
api/auth/challenge.ts |
Issue HMAC-signed, time-bound challenge tokens |
api/prompts/unlock.ts |
Verify signature + on-chain has_access β decrypt β integrity check |
A secondary Express workspace (server/) provides read-only indexing, preview analytics, review storage, and webhook dispatch. It is explicitly forbidden from originating prompt state changes. Write routes that duplicated create_prompt/set_prompt_sale_status have been removed β see server/src/routes/promptRoutes.ts for the deprecation ledger.
The unlock service is hardened for production use with the following features:
- Rate Limiting: Request-level limits keyed by IP and wallet to prevent brute-force and DDoS attacks.
- Structured Logging: JSON-formatted logs with request ID tracking and sensitive data redaction.
- Operational Metrics: Real-time tracking of unlock success/failure rates, invalid signatures, and rate limit hits.
- Health Monitoring: Dedicated
/api/healthendpoint for uptime and configuration verification. - Incident Response: Documented runbooks and debugging procedures located in
docs/operations/.
- Soroban smart contracts in Rust
- Stellar SDK and Stellar Base for blockchain interaction
- React 19 + TypeScript + Vite for frontend
- Tailwind CSS and Radix UI primitives for interface components
- React Query for client-side data fetching
- libsodium + Web Crypto for encryption and key wrapping
- Vercel serverless functions for unlock/auth endpoints
- Optional Express service workspace for external chat/proxy integrations
The Soroban contract stores encrypted prompt data and commercial metadata directly on-chain. The full plaintext is never stored in readable form. Purchases are settled in Stellar's native asset contract, and access control is determined by contract state rather than a centralized database.
The current contract data model includes:
- prompt ID
- creator address
- image URL
- title
- category
- preview text
- encrypted prompt payload
- encryption IV
- wrapped AES key
- content hash
- price in stroops
- active status
- sales count
- Node.js 22+
- Yarn 4+ (Corepack enabled)
- Rust toolchain
- Stellar CLI with Soroban support
yarn install
cd server && npm install && cd ..If you have Docker installed, you can start the full local stack β frontend, auxiliary API server, and MongoDB β without installing Node, Yarn, or Mongo on your host:
docker compose up- Frontend (Vite): http://localhost:5173
- API server: http://localhost:5000
- MongoDB: mongodb://localhost:27017
The frontend and API source directories are bind-mounted, so edits on your host hot-reload inside the containers automatically (file-watch polling is enabled so this works on Windows, macOS, and Linux).
Need a local Stellar network with Soroban RPC (via
Stellar Quickstart)? Start it with the
optional stellar profile:
docker compose --profile stellar upThis exposes Horizon, Soroban RPC, and Friendbot on http://localhost:8000.
Default environment values target Stellar testnet. To override them, create a
.env file (see .env.example); docker compose picks it up automatically.
A .devcontainer configuration is included. Opening the repo
in VS Code with the Dev Containers extension (or in GitHub Codespaces) gives you
a ready-to-use environment with Node 22, the Rust toolchain, and the Stellar
CLI (Soroban) already installed, plus the MongoDB and Stellar Quickstart
services from the compose stack.
The Dockerfiles install dependencies in a dedicated, cached layer (manifest and
lockfile are copied before the source). Rebuilds only re-run yarn install /
npm ci when a lockfile changes, and BuildKit cache mounts keep the package
caches warm between builds.
For the complete contributor workflow, including required tools, environment variables, frontend startup, Soroban contract tests, unlock endpoint testing, and troubleshooting, see CONTRIBUTING.md.
Need to get the project running locally? See the full contributor setup guide:
π CONTRIBUTING / SETUP
It covers prerequisites (Node.js, Rust, Soroban CLI), step-by-step setup (install dependencies, build contracts, run dev server), environment variables, testing, and contributor conventions.
Quick start:
- Copy the environment file:
cp .env.example .env- Fill in the required Stellar and unlock-service variables.
- Install dependencies:
yarn install- Start the frontend:
yarn dev- Optional: run the auxiliary Node server:
cd server
npm install
npm run dev- Run contract tests:
cargo test -p prompt-hash- Run frontend checks before opening a PR:
yarn lint
yarn test:frontend --run api/prompts/unlock.test.ts src/lib/auth/challenge.test.ts src/lib/crypto/promptCrypto.test.ts
yarn buildRun the one-command setup check to verify all prerequisites and environment variables before starting development:
yarn check:setupThis checks Node/Yarn versions, Rust toolchain, Stellar CLI, contract tooling, dependencies, and required environment variables without printing secret values.
See docs/environments.md for local, testnet, and preview setup examples.
See .env.example for the full template. Main variables:
PUBLIC_STELLAR_NETWORKPUBLIC_STELLAR_NETWORK_PASSPHRASEPUBLIC_STELLAR_RPC_URLPUBLIC_STELLAR_HORIZON_URLPUBLIC_PROMPT_HASH_CONTRACT_IDPUBLIC_STELLAR_NATIVE_ASSET_CONTRACT_IDPUBLIC_STELLAR_SIMULATION_ACCOUNTPUBLIC_UNLOCK_PUBLIC_KEYCHALLENGE_TOKEN_SECRETUNLOCK_PUBLIC_KEYUNLOCK_PRIVATE_KEY
- Connect a Stellar wallet
- Create a prompt listing from
/sell - Set preview metadata and price
- Let the app encrypt and publish the listing on Soroban
- Manage price and sale status from the creator dashboard
- Browse listings from
/browse - Buy prompt access in XLM
- Unlock the purchased prompt with wallet signature verification
- Reopen purchased prompts from
/profile
The frontend suite uses Vitest + jsdom + React Testing Library to cover the main marketplace journeys without a live wallet extension or live Soroban environment.
Run it with:
yarn test:frontendCoverage currently includes:
- disconnected wallet and wrong-network UI handling
- create-listing validation and mocked contract submission
- purchase and unlock behavior with mocked wallet and unlock boundaries
- unlock failure recovery with retry
- creator dashboard refresh after React Query invalidation
Contributor notes:
- Use
src/test/render.tsxto render components with router, wallet, and React Query providers. - Reuse fixtures from
src/test/fixtures/prompts.tsfor realistic prompt records. - Mock wallet, contract, and unlock boundaries instead of relying on live chain dependencies.
- Prefer integration coverage around real flow components such as
CreatePromptForm,FetchAllPrompts,PromptModal, andMyPrompts.
See docs/frontend-testing.md for the recommended pattern when adding new frontend coverage.
- Mainnet-ready deployment configuration
- Better indexing and search beyond direct contract reads
- Prompt analytics for creators
- Support for stable asset pricing in addition to XLM
- Moderation and abuse-reporting flows
- Stronger seller reputation and verification signals
- SEP-compatible identity and creator profiles
- Prompt bundles and subscription-style access passes
- Revenue-sharing splits for co-creators
- Encrypted off-chain blob support for larger content assets
- Better caching and pagination for high-volume marketplaces
- Additional developer docs and deployment automation
Contributions are welcome, especially in the following areas:
- Soroban contract hardening and testing
- frontend UX for wallet and purchase flows
- indexing/search strategy
- unlock-service security review
- creator onboarding and marketplace moderation
See CONTRIBUTING.md for workflow details.
See docs/product-journeys.md for a beginner-friendly walkthrough of the creator and buyer flows, including which components handle each step.
This repository is licensed under the Apache License 2.0. See LICENSE.
Maintained by the PromptHash Stellar team for Drip Wave submission and ongoing open-source development.
βββ api/ # Vercel serverless functions
β βββ auth/ # Challenge token issuance & secret rotation
β βββ prompts/ # Unlock, versioning, and listing endpoints
β βββ reviews/ # Review submission endpoints
β βββ webhooks/ # Webhook integration endpoints
β βββ health.ts # Service health check
β βββ status.ts # Multi-service status dashboard
βββ contracts/ # Soroban smart contracts (Rust)
βββ server/ # Express backend (read-only indexing, analytics)
β βββ src/
β βββ controllers/ # Route handlers
β βββ db/ # Database connection
β βββ models/ # Mongoose schemas
β βββ routes/ # Express route definitions
β βββ services/ # Cache, backup, listing validation
β βββ tests/ # Server integration tests
βββ src/ # React frontend (Vite + TypeScript)
β βββ components/ # Reusable UI components
β βββ hooks/ # Custom React hooks (useTheme, wallet, etc.)
β βββ lib/ # Core logic (crypto, stellar, auth, validation)
β βββ pages/ # Route pages (browse, sell, profile, etc.)
β βββ providers/ # React context providers
β βββ test/ # Frontend test utilities & fixtures
βββ docs/ # Additional documentation
βββ scripts/ # Build & setup scripts
βββ eslint.config.js # ESLint configuration
βββ tailwind.config.js # Tailwind CSS configuration
βββ vite.config.ts # Vite build configuration
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/health |
Service health check with indexer state |
| GET | /api/status |
Multi-service status (RPC, Horizon, unlock) |
| POST | /api/auth/challenge |
Issue time-bound challenge token for wallet verification |
| POST | /api/auth/rotate-secret |
Rotate challenge token secrets with grace period |
| GET | /api/prompts |
List published prompts (optional category & walletAddress filters) |
| POST | /api/prompts/unlock |
Verify wallet access and return decrypted prompt |
| GET | /api/prompts/version |
Get versioned prompt content for a buyer |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/prompts |
List published prompts (cached, filtered) |
| GET | /api/prompts/buyer/:wallet/owned |
Get prompts owned by wallet |
| GET | /api/prompts/buyer/:wallet/saved |
Get prompts saved by wallet |
| GET | /api/prompts/creator/:wallet/drafts |
Get creator draft prompts |
| POST | /api/prompts/preview |
Record prompt preview |
| GET | /api/prompts/preview/stats |
Get preview analytics for creator |
| POST | /api/prompts/reports |
Submit prompt report |
| GET | /api/prompts/reports |
Get prompt reports (admin) |
| GET | /api/search |
Search prompts and users |
| POST | /api/webhooks |
Register webhook subscriptions |
The application supports light, dark, and system-preference themes:
- Theme persistence: Your selection is stored in
localStorageastheme-preference - System-aware: When set to "System", the UI follows your OS color scheme preference
- Toggle: Use the theme switch icon in the top navigation bar
- CSS variables: Theme colors are defined as CSS custom properties in
src/index.csswith.darkclass overrides - Tailwind integration: Dark mode uses Tailwind's
classstrategy β add thedark:prefix for theme-specific styles
Toggle between Light, Dark, and System modes from the dropdown in the navigation bar. The setting persists across sessions.
The project uses ESLint with TypeScript support for code quality:
# Run the linter
npm run lint
# Auto-fix fixable issues
npm run lint -- --fixKey linting rules:
- Unused variables are flagged as warnings
- Underscore-prefixed parameters (
_param) are exempt from unused-variable checks - TypeScript strict mode is enabled for type safety
- Prettier handles code formatting (
npm run format)
Run both checks before opening a pull request:
npm run lint && npm run typecheck- Recommended repository name:
prompt-hash-stellar - Suggested short description:
Soroban-based prompt licensing marketplace with XLM payments and wallet-verified unlocks - Suggested topics:
stellar,soroban,xlm,creator-economy,ai-prompts,marketplace,blockchain,rust,react,vercel - Suggested release title for
v0.1.0:Prompt licensing marketplace foundation on Stellar
docs: rewrite repository for Drip Wave submissiondocs: add architecture and ecosystem overviewchore: align package metadata with PromptHash Stellar
Dependencies are managed automatically via Dependabot (see .github/dependabot.yml).
Dependabot opens pull requests every Monday for:
- npm (
/) β frontend packages (Vite, React, Tailwind, etc.) - Cargo (
/contracts/prompt-hash) β Soroban / Rust crates, grouped into a single PR
- Check the Dependabot PR description for the changelog and any breaking-change notes.
- Run
npm ci && npm run buildlocally (or let CI run) to confirm the frontend still compiles. - For Cargo updates, run
cargo testinsidecontracts/prompt-hash/before merging. - Merge the PR; Dependabot will rebase any remaining open PRs automatically.
If a Dependabot PR introduces a breaking change, close it and pin the old version in package.json or Cargo.toml until the issue is resolved upstream.