FidMarket Documentation
A GitBook-style guide to FidMarket’s marketplace model, Buy Now flow, funded WETH offers, Optimism settlement, account tools, notifications, admin safety controls, and production-readiness checklist.
Overview
FidMarket is a Farcaster FID marketplace for buying, selling, making offers, and managing FID ownership flows.
It is designed around wallet-native transactions, Farcaster authorization signatures, Optimism settlement, funded WETH offers, Telegram notifications, audit logs, and admin safety controls.
FidMarket’s default marketplace model is live-first listing. Sellers can list their FID while still keeping custody of the Farcaster account. Custody is not taken at listing creation. The FID is transferred only during settlement, after checkout/payment and the required signatures are ready.
What FidMarket Is
- A marketplace for Farcaster FIDs
- A transaction coordination layer for FID ownership transfers
- A wallet-native checkout and offer system
- A settlement system for Farcaster registry transfers on Optimism
- An operational dashboard for monitoring and recovery
FidMarket is not a social app, wallet, exchange, or custodial account provider. It is a marketplace and transaction coordination layer for Farcaster FID ownership flows.
Core Product Direction
FidMarket does not take custody by default when a seller creates a listing.
status = ACTIVE
executionMode = LEGACY_V1
custodyStatus = NONE- Sellers keep using their Farcaster account while listed
- Listings are immediately live and purchasable
- Custody is not taken at listing creation
- A listing becomes reserved only when checkout starts
- Settlement transfers the FID at the end of the trade
Custodial execution paths may still exist for supported or fallback scenarios, but they are not the default marketplace path.
Getting Started
For Buyers
- Browse listed Farcaster FIDs
- Buy a listing instantly
- Make a funded WETH offer
- Set a recovery address for the acquired FID
- Track checkout, payment, signatures, and settlement
- Receive web and Telegram notification updates
A buyer needs:
- An Ethereum wallet
- ETH or WETH on Optimism depending on the flow
- A recovery address for the FID transfer
For Sellers
- List their Farcaster FID
- Set price and fee mode
- Keep using the account while listed
- Accept funded WETH offers
- Sign settlement authorization after payment
- Track sales, offers, and settlement status
A seller needs:
- A wallet that controls the FID
- A valid seller authorization signature
- A listing price
- A valid recovery/custody state
For Admins
- View listings
- View orders
- View linked funded offers
- View audit trails
- Retry settlement
- Retry release
- Emergency refund
- Mark orders as needs review
- Mark reviewed after investigation
- Cancel stuck orders safely
- Cancel stuck listings safely
- Handle legacy/manual fname recovery paths where needed
Core Concepts
Farcaster FID
A Farcaster FID is the permanent numeric identity of a Farcaster account. On FidMarket, the FID is the core asset being listed and transferred.
Example: FID #1430092Fname / Username
An fname is the readable Farcaster username associated with an FID. A listing may include the current fname, and FidMarket tracks fname state during marketplace flows.
- FID transfer happens through Farcaster IdRegistry on Optimism
- fname handling may involve registry-side logic and hub/client propagation
- Farcaster clients may not update instantly after registry-side changes
- Registry state and visible client username state may not always update at the same time
Live-First Listing
Live-first listing means sellers do not hand over custody before listing. The seller keeps control of the FID until checkout or settlement requires action.
This reduces friction for sellers and lets listings go live faster, while signatures, custody checks, escrow, settlement status, audit logs, and admin review protect the final transaction path.
Funded WETH Offer
A funded WETH offer is an offer backed by WETH escrow on Optimism. The buyer signs a Farcaster transfer authorization and funds the offer escrow before the seller accepts.
When accepted, the funded offer becomes an order and settlement proceeds through the normal transfer path.
Marketplace Listings
Listing Creation
When a seller creates a listing, FidMarket stores:
- FID number
- Current fname
- Current recovery address
- Seller address
- Price
- Fee mode
- Seller authorization
- Execution mode
- Custody status
- Lifecycle timestamps
By default, a listing is created as:
ACTIVE
LEGACY_V1
custodyStatus = NONEListing Statuses
Seller-Held Listings
For normal live-first listings, the seller keeps custody while listed.
A listing becomes reserved when:
- A buyer starts checkout
- A funded offer is accepted
Buy Now Flow
The Buy Now flow lets a buyer purchase an active listing directly. This is the fastest path for buyers who want to start checkout immediately instead of making an offer.
Flow
- 1Buyer opens a listing
- 2Buyer enters recovery address
- 3Buyer signs Farcaster transfer authorization
- 4Order is created
- 5Buyer deposits payment into escrow
- 6Backend confirms payment
- 7Seller signs final settlement authorization if required
- 8Settlement queue submits transfer
- 9Backend verifies custody moved to buyer
- 10Escrow release is executed
- 11Order becomes SUCCEEDED
- 12Listing becomes SOLD
Data Collected
- Buyer wallet address
- Buyer recovery address
- Buyer transfer authorization
- Payment confirmation
- Seller authorization
- Escrow reference
- Settlement transaction hash
- Release transaction hash
Escrow Deposit
For Buy Now ETH checkout, the buyer deposits payment into the marketplace escrow contract. The backend confirms the escrow deposit before settlement proceeds.
- Order ID
- Buyer address
- Seller address
- Seller net amount
- Platform fee amount
- Fee recipient
- Chain ID
- Escrow contract address
Funded WETH Offers
Funded WETH offers let buyers make offers backed by WETH escrow on Optimism. This gives sellers confidence that the buyer has already funded the offer before acceptance.
Offer Flow
- 1Buyer opens offer modal
- 2Buyer enters WETH amount
- 3Buyer enters recovery address
- 4Frontend reads Farcaster nonce from IdRegistry
- 5Buyer signs transfer-and-change-recovery typed data
- 6Backend prepares the funded offer
- 7Buyer approves WETH allowance if needed
- 8Buyer funds offer escrow
- 9Backend verifies funding transaction
- 10Offer becomes FUNDED
- 11Seller may accept the offer
- 12Accepted offer becomes an order
- 13Settlement continues normally
Offer Statuses
Offer Funding Statuses
Important Offer Rules
- Buyer cannot fund without valid typed-data authorization
- Backend verifies buyer signature against Farcaster typed data
- Escrow funding must match expected offer slot values
- Seller can only accept valid funded offers
- Accepted funded offers transition into order settlement
- Funded offers should not be treated as normal unpaid orders
- Funded offer release is separate from normal ETH escrow release
Orders
An order represents an active purchase flow created from either Buy Now checkout or an accepted funded WETH offer.
Order Data
- Listing relation
- Buyer and seller snapshots
- Promised FID
- Promised fname
- Payment status
- Settlement status
- Fname status
- Escrow references
- Transfer signatures
- Transfer deadlines
- Transaction hashes
Order Lifecycle
Created
→ Payment confirmed
→ Signatures collected
→ Settlement ready
→ Settlement processing
→ SucceededIf something goes wrong, an order may move to FAILED or NEEDS_REVIEW.
Settlement
Settlement coordinates payment, signatures, Farcaster registry interaction, custody verification, escrow release, audit logs, and notifications.
Settlement Stages
- 1Payment confirmed
- 2Buyer authorization collected
- 3Seller authorization collected
- 4Settlement job starts
- 5FID transfer submitted on-chain
- 6Transfer confirmation checked
- 7Custody verified on-chain
- 8Escrow or funded-offer release executed
- 9Order finalized
- 10Listing marked SOLD
Settlement Statuses
Settlement Safety Checks
- Seller still controls the expected FID
- Buyer does not already own an FID where that would block transfer
- Buyer authorization is present and valid
- Seller authorization is present and valid
- Payment is confirmed
- Escrow state matches expected order values
- FID custody changes to the expected buyer
- Release transaction succeeds
Needs Review
Orders may enter NEEDS_REVIEW when something is unsafe or inconsistent.
- FID custody did not move to expected buyer
- Escrow release reverted
- Funded-offer release reverted
- Chain state does not match expected state
- Transaction succeeded but final state needs manual verification
- Admin intentionally marks an order for review
Account Management
Self-Service FID Transfer
Users can transfer their own FID outside the marketplace sale flow. This uses a two-signature process.
- 1Owner starts transfer session
- 2Backend generates owner typed data
- 3Backend generates recipient typed data
- 4Owner signs
- 5Recipient signs
- 6Owner submits transfer
- 7Backend re-checks nonce consistency
- 8Relayer submits transferAndChangeRecoveryFor
- 9Transfer completes on-chain
When Self-Service Transfer Is Blocked
- Wallet does not own an FID
- Wallet is not the direct custody owner
- FID is attached to an active listing
- FID is in reserved checkout
- FID is in settlement
- Recipient wallet already owns a Farcaster FID
- Owner or recipient nonce changes after signing
Username / Fname Management
Users who directly own an FID can manage username/fname actions from:
Account → UsernameCurrent Behavior
- Account username page
- Signed username-change submission path
- Direct fname registry transfer request logic
- Audit trail for username actions
- Optional Farcaster hub service scaffolding
Important Limitation
Registry-side fname logic and active Farcaster client propagation are not always the same thing.
- Registry transfer can update ownership/assignment state
- Hub message publishing helps propagate active username state to Farcaster clients
- Without hub configuration, full client-side propagation may remain unavailable
- External Farcaster clients may cache or delay username display updates
When Username Actions Are Blocked
- Wallet does not directly own an FID
- FID is part of an active listing
- FID is in reserved checkout
- FID is in settlement flow
Notifications
FidMarket stores notifications server-side and surfaces them in the web UI. Telegram is currently the active external delivery channel.
Notification Events
- Order creation
- Checkout activity
- Signature requested
- Payment confirmation
- Settlement success
- Settlement failure
- Needs review cases
- Offer received
- Funded offer accepted
Notification Center
- Notification bell
- Unread count
- Notification dropdown
- Notifications page
- Mark as read
- Mark all as read
Telegram Linking
Users can link Telegram from the notifications page. Telegram is used for operational alerts and transaction updates.
Telegram notifications are convenience alerts. Users should still rely on the web app and on-chain state for final transaction status.
Admin Operations
Admin tools are designed for safety, review, and recovery. Admins can inspect marketplace state, review audit logs, retry safe operations, refund when needed, and cancel stuck flows under guarded rules.
Admin Capabilities
- Inspect listings
- Inspect orders
- Inspect linked funded offers
- Inspect audit logs
- Retry settlement
- Retry escrow release
- Emergency refund
- Mark order as needs review
- Mark reviewed
- Cancel stuck order safely
- Cancel stuck listing safely
- Handle legacy/manual fname recovery actions
Retry Settlement
Retry Release
Emergency Refund
Mark Needs Review
Mark Reviewed
Cancel Stuck Order
Cancel Stuck Listing
Technical Architecture
Backend Stack
- NestJS
- Prisma
- PostgreSQL
- Redis
- BullMQ
- viem
- Optimism mainnet
- Telegram bot integration
Frontend Stack
- Next.js
- React
- TypeScript
- wagmi
- viem
- RainbowKit
Chain / Registry
- Optimism mainnet
- Farcaster IdRegistry
- WETH
- Marketplace escrow contracts
- Funded-offer escrow contracts
- Farcaster EIP-712 typed data
Authentication
FidMarket uses wallet-based authentication. Users connect their wallet and sign a SIWE message to authenticate.
SIWE Flow
- 1User requests nonce
- 2User signs SIWE message
- 3Backend verifies signature
- 4Backend returns JWT
- 5Frontend uses bearer token for authenticated requests
Auth Requirements
- Connected wallet
- Valid SIWE session
- JWT bearer token
- Wallet ownership checks where applicable
Wallet Ownership
- Listing requires control of the FID
- Self-service transfer requires direct custody ownership
- Username actions require direct ownership and no active marketplace block
- Seller settlement actions require the seller wallet
Data Model Overview
Listings
- FID
- Current fname
- Seller address
- Price
- Fee mode
- Current recovery address
- Seller authorization data
- Execution mode
- Custody status
- Lifecycle status
- Timestamps
Orders
- Listing relation
- Buyer and seller snapshots
- Promised FID
- Promised fname
- Payment status
- Settlement status
- Fname status
- Escrow references
- Transfer signatures
- Transfer deadlines
- Transaction hashes
Offers
- Listing relation
- Offerer relation
- Buyer recovery address
- Amount
- Currency
- Expiry
- Funding state
- Escrow contract references
- Funding transaction hash
- Release transaction hash
- Authorization metadata
Audit Logs
- Listing actions
- Offer creation
- Funding preparation
- Funding confirmation
- Order creation
- Signature collection
- Settlement start
- Settlement submission
- Settlement success
- Settlement failure
- Admin actions
- Username actions
- Fname actions
Environment Configuration
Backend Environment
# Core
NODE_ENV=
PORT=
FRONTEND_URL=
APP_BASE_URL=
# Database / Queue
DATABASE_URL=
REDIS_URL=
# Auth
JWT_SECRET=
JWT_EXPIRES_IN=
SIWE_DOMAIN=
SIWE_NONCE_TTL_SECONDS=
SIWE_URI=
# Chain
CHAIN_ID=
OPTIMISM_RPC_URL=
RELAYER_PRIVATE_KEY=
FARCASTER_ID_REGISTRY_ADDRESS=
FARCASTER_ID_GATEWAY_ADDRESS=
MARKETPLACE_CUSTODY_ADDRESS=
# Escrow / Offers
OFFER_ESCROW_CHAIN_ID=
OFFER_ESCROW_CONTRACT_ADDRESS=
WETH_TOKEN_ADDRESS=
ESCROW_CHAIN_ID=
ESCROW_CONTRACT_ADDRESS=
PLATFORM_FEE_RECIPIENT=
# Business Rules
DEFAULT_FEE_BPS=
RESERVATION_TTL_SECONDS=
INTENT_DEFAULT_DEADLINE_SECONDS=
ESCROW_REFUND_DELAY_SECONDS=
# Telegram
TELEGRAM_BOT_TOKEN=
TELEGRAM_BOT_USERNAME=
TELEGRAM_WEBHOOK_SECRET=
# Hub / Username
HUB_HTTP_URL=
HUB_API_KEY=If hub values are empty, hub-backed username publish/read behavior remains unavailable.
Frontend Environment
NEXT_PUBLIC_API_URL=
NEXT_PUBLIC_SITE_URL=
NEXT_PUBLIC_FARCASTER_CHAIN_ID=
NEXT_PUBLIC_ID_REGISTRY_ADDRESS=
NEXT_PUBLIC_MARKETPLACE_CUSTODY_ADDRESS=
NEXT_PUBLIC_ESCROW_CHAIN_ID=
NEXT_PUBLIC_ESCROW_CONTRACT_ADDRESS=
NEXT_PUBLIC_ID_REGISTRY_VERSION=
NEXT_PUBLIC_LISTING_AUTH_WINDOW_SECONDS=
NEXT_PUBLIC_BUY_AUTH_WINDOW_SECONDS=
NEXT_PUBLIC_WETH_TOKEN_ADDRESS=
NEXT_PUBLIC_OFFER_ESCROW_CONTRACT_ADDRESS=
NEXT_PUBLIC_FARCASTER_ID_REGISTRY_ADDRESS=Domain Notes
Recommended production frontend domain:
https://www.fidmarket.comBackend CORS and generated frontend links should account for the www domain if that is the canonical public URL.
Chain Notes
FidMarket operates primarily on Optimism mainnet.
- Farcaster IdRegistry reads happen on Optimism
- FID settlement writes happen on Optimism
- Funded WETH offers use Optimism WETH
- Buyer and seller authorizations use Farcaster EIP-712 typed data
- Settlement uses transferAndChangeRecoveryFor
- Self-service FID transfer also uses transferAndChangeRecoveryFor
Mainnet Readiness
- IdRegistry address is correct
- Escrow contract addresses are correct
- Offer escrow contract addresses are correct
- WETH token address is correct
- Relayer private key is configured
- Relayer wallet is funded for gas
- Frontend chain IDs match backend chain IDs
- No Sepolia references remain in production environment
Status Reference
Listing Status
Payment Status
PENDING
CONFIRMED
FAILED
REFUNDEDSettlement Status
NOT_STARTED
READY
SUBMITTING
SUBMITTED
CONFIRMING
SUCCEEDED
FAILED
NEEDS_REVIEWFname Status
NOT_APPLICABLE
PENDING
IN_PROGRESS
COMPLETED
FAILEDOffer Status
OPEN
ACCEPTED
REJECTED
CANCELLED
EXPIREDOffer Funding Status
UNFUNDED
PREPARED
FUNDED
CANCELLED
REFUNDED
RELEASED
FAILEDSecurity Model
Security Layers
- Wallet-based authentication
- JWT session protection
- On-chain custody verification
- Buyer authorization deadlines
- Seller authorization deadlines
- Nonce verification
- Signature verification
- Escrow funding verification
- Escrow release verification
- Settlement state machine
- Needs-review safety state
- Audit logging
- Admin safety controls
- Telegram operational visibility
Risk Controls
- Custody state does not match expectations
- Buyer already owns an FID
- Seller no longer controls the FID
- Payment or escrow state is invalid
- Signatures are expired or invalid
- Settlement transaction reverts
- Escrow release fails
- Funded-offer release fails
Why Admin Review Exists
FID marketplace transactions touch multiple systems: wallet signatures, Farcaster registry state, Optimism transactions, escrow contracts, backend order state, and external Farcaster username/client behavior.
Because of this, FidMarket uses NEEDS_REVIEW when a flow should stop for manual inspection instead of continuing automatically.
API Surface Summary
Account
GET /account/fid
POST /account/fid/prepare
POST /account/fid/submit
POST /account/fid/start
GET /account/fid/session/:token
POST /account/fid/sign-owner
POST /account/fid/sign-recipient
POST /account/fid/submit-by-token
GET /account/username
POST /account/username/changeListings
GET /listings
GET /listings/:id
POST /listings
PATCH /listings/:id
POST /listings/:id/cancel
POST /listings/:id/authorization/refreshOrders
POST /orders
GET /orders
GET /orders/:id
POST /orders/:id/payment/confirm-escrow
POST /orders/:id/signatures/seller
POST /orders/:id/signatures/buyer
POST /orders/:id/intents/refreshOffers
POST /listings/:listingId/offers
POST /listings/:listingId/offers/prepare
GET /listings/:listingId/offers
GET /offers/public
GET /offers/summary
GET /offers/mine
POST /offers/:id/funding/confirm
POST /offers/:id/cancel
POST /offers/:id/acceptNotifications
GET /notifications
GET /notifications/unread-count
POST /notifications/:id/read
POST /notifications/read-allTelegram
GET /telegram/link/status
POST /telegram/link/start
DELETE /telegram/linkAdmin
GET /admin/orders
GET /admin/orders/:id
POST /admin/orders/:id/retry-settlement
POST /admin/orders/:id/retry-release
POST /admin/orders/:id/emergency-refund
POST /admin/orders/:id/mark-needs-review
POST /admin/orders/:id/mark-reviewed
POST /admin/orders/:id/cancel
GET /admin/listings
GET /admin/listings/:id
POST /admin/listings/:id/cancelKnown Limitations
Username / Hub
- Hub-backed username publish/read operations remain unavailable if no hub is configured
- Registry-side changes may not fully propagate to clients
- HUB_HTTP_URL and HUB_API_KEY may remain empty
Offer Flow
- Correct FID must be passed into offer modal
- Typed-data construction must be correct
- Nonce and deadline must be correct
- Escrow verification must match expected values
- WETH allowance must be sufficient
- Funding transaction must be confirmed
- Backend confirmation must succeed
Custodial V2
Custodial V2 remains supported but is not the default production marketplace path.
The default marketplace path is live-first LEGACY_V1.
Production Readiness Checklist
- Backend test suite green
- Frontend build green
- Buy Now ETH flow manually tested
- Funded WETH offer flow manually tested
- Offer cancel/refund manually tested
- Offer accept → settlement success manually tested
- Admin retry settlement manually tested
- Admin retry release manually tested
- Emergency refund manually tested
- Telegram notifications tested
- Self-service FID transfer tested
- Username/fname path reviewed
- Production environment variables reviewed
- Mainnet escrow contracts verified
- Relayer wallet funded
- CORS and frontend links aligned to www.fidmarket.com
- No localhost/ngrok/Sepolia references in production config
- OG image/Twitter card added
- Terms, Privacy, FAQ, and Docs linked in footer/navbar where appropriate
Troubleshooting
Buyer sees “Connect wallet” even when connected
This can happen if the deposit component is checking wallet state too strictly.
Expected deposit requirements:
- Wallet connected
- Buyer address available
- Connected as buyer
- Correct chain selected
- Escrow contract configured
- Payment not already confirmed
Settlement goes to NEEDS_REVIEW
This means the processor detected something that should not continue automatically.
- Custody mismatch
- Release transaction reverted
- Funded-offer release reverted
- Escrow state does not match expected state
Funded offer cannot be accepted
- Offer status should be OPEN
- Funding status should be FUNDED
- Listing should not be sold or cancelled
- Buyer authorization should not be expired
- Offer escrow slot should exist and match expected values
Username update does not appear in Farcaster client
- Check registry-side request status
- Check hub configuration
- Check Farcaster client cache/propagation delay
- Check whether the FID is blocked by active marketplace state
Final Summary
FidMarket is a Farcaster-native marketplace for FID trading and account-level FID management.
- Live-first seller-held listings
- Buy Now checkout
- Funded WETH offers
- Optimism settlement
- On-chain FID transfer
- Escrow release
- Telegram notifications
- Self-service FID transfer
- Username/fname management
- Admin safety controls
- Audit logs
The platform is built around safer marketplace execution: signatures, custody checks, escrow verification, settlement review states, and admin recovery tools.