RaidzATTENTION, WITH PROOF.

Database reference

PostgreSQL is the operational system of record. The base schema is initialized from database/schema.sql; the API also performs additive identity migrations at startup.

Identity and profile

TablePurpose
usersRoot user identity, type, display name, locale, jurisdiction, soft deletion
creator_profilesBio, languages, regions, narratives, availability, visibility
social_accountsX/Telegram pseudonymous subject, handle, normalized profile, encrypted token, consent version
wallet_linksChain/address ownership evidence, signature hash, verification/revocation
auth_sessionsOpaque browser sessions with expiry/revocation
auth_challengesSingle-use wallet/X challenges, nonce hash, encrypted PKCE secret, payload, expiry
score_snapshotsVersioned score, tier, components, explanations, confidence, timestamp

Provider subjects are unique across a provider. A user has at most one row for each social provider. A wallet address is unique per chain. Revocation preserves wallet history while removing it from active profile output.

Marketplace

TablePurpose
projectsProject identity and ownership-verification facts
campaignsTerms, state, economics, verification/retention/refund policy, escrow pointer
mission_claimsOne creator reservation per campaign
deliverablesCanonical URL and content hash per claim
verificationsOutcome, rule results, fraud signals, attestation hash, quorum
settlementsGross/immediate/retained/fee amounts and transaction receipts
service_listingsDirect creator service, price, lead time, jurisdictions, activation
reviewsCampaign-bound creator or project rating

Token amounts use numeric(78,0) to preserve uint256-scale integers without floating point. Addresses and transaction hashes are binary values. Application code must format units only at the presentation boundary.

Measurement and external state

TablePurpose
attribution_eventsCampaign/creator event with pseudonymous subject, source, time, metadata
pons_eventsIdempotent chain event keyed by chain, transaction hash, and log index
policy_versionsVersioned rules, sources, effective and expiry timestamps

The current SQL attribution table is more generic than the typed domain envelope. Production ingestion must persist consent, dedupe key, expiry, and typed properties explicitly or prove their durable representation.

Lifecycle consistency

The SQL campaign_state enum, domain campaign state machine, and onchain claim states use different names and levels of abstraction. Do not write direct string translations. Introduce an explicit mapping and tests before persistent campaign orchestration.

Migration and recovery

Startup DDL is acceptable for the current foundation but should be replaced by ordered, immutable migrations before production data evolves. Production operations require encrypted backups, point-in-time recovery where available, restore drills, schema-version recording, and a deletion/retention worker.

Never restore a database over current production state without validating target, timestamp, expected data loss, application compatibility, and a recovery copy.