PromptHash Stellar is organized into three main layers.
Path: contracts/prompt-hash
Responsibilities:
- store prompt listing records
- track creator-owned listings
- track buyer purchase rights
- route XLM payments and platform fees
- expose read methods for marketplace views
Core contract methods:
create_promptbuy_prompthas_accessget_promptget_all_promptsget_prompts_by_creatorget_prompts_by_buyerupdate_prompt_priceset_prompt_sale_statusset_fee_percentageset_fee_wallet
Path: src
Responsibilities:
- wallet connection and transaction signing
- client-side encryption before contract submission
- marketplace browsing and filtering
- creator listing management
- buyer unlock initiation
Important modules:
src/pages/sell/CreatePromptForm.tsxsrc/pages/browse/PromptModal.tsxsrc/pages/sell/MyPrompts.tsxsrc/lib/stellar/promptHashClient.tssrc/lib/crypto/promptCrypto.ts
Paths:
api/auth/challenge.tsapi/prompts/unlock.ts
Responsibilities:
- mint challenge tokens
- verify wallet signature on unlock requests
- read contract access state
- unwrap the encrypted AES key
- decrypt the prompt payload
- validate content integrity by hash
- User enters title, preview, category, image URL, price, and full prompt text.
- Browser encrypts prompt plaintext with AES-GCM.
- Browser wraps the AES key using the unlock service public key.
- App submits the encrypted payload and metadata to Soroban.
- Buyer approves native asset spend.
- App submits
buy_prompt. - Contract moves seller and fee amounts in stroops.
- Contract records purchase rights for the buyer.
- Buyer requests a challenge token for a specific prompt.
- Wallet signs the challenge message.
- Unlock endpoint verifies token, signature, and
has_access. - Service decrypts prompt plaintext and returns it to the buyer.
The current design intentionally separates concerns:
- Soroban stores encrypted prompt content and access state
- the browser performs initial prompt encryption
- the server only releases plaintext after both wallet proof and contract proof succeed
Important assumptions:
- the unlock service private key must remain secret
- the challenge secret must be rotated and stored securely
- contract IDs and network settings must be configured correctly per environment
The current frontend reads marketplace data directly from contract methods. This is acceptable for early-stage demos and review environments, but a production deployment will likely need:
- indexing and caching
- pagination
- search infrastructure
- moderation and abuse handling
The current repository supports a lightweight deployment model:
- frontend + serverless unlock endpoints on Vercel
- contract deployed to Stellar testnet or future mainnet target
- optional auxiliary Express server for external chat/proxy services