YAM

YAM: A fair marketplace for direct buys or raffles, powered by verified identities.

YAM

Created At

ETHGlobal New Delhi

Project Description

YAM (Yet Another Marketplace) is a decentralized marketplace built on Flow where users can list, buy, and sell products in two modes: Direct Purchase or Raffle-based Sale. The project integrates Self.xyz for identity proofs (uniqueness, nationality, age) so every buyer and seller is a verified human. This ensures trust, prevents bots, and allows sellers to restrict their listings to certain countries if required. Sellers create listings through a simple form capturing item name, description, price, quantity, sale type, deadline (for raffles), and allowed countries. Listings are managed on-chain via Flow smart contracts, ensuring transparency and fairness.

The raffle system contract is central to YAM. Sellers can open raffles where users enter by paying a fee, with funds held in escrow. The contract enforces one entry per verified identity, tracks participants, checks nationality eligibility, and after the deadline, executes pickWinners to determine winners through a transparent randomness mechanism. Winners gain rights to claim or purchase the product, while non-winners are refunded automatically. Events such as RaffleCreated, RaffleEntered, WinnersSelected, and FundsReleased keep the process auditable and UI-friendly.

This design not only supports physical or digital product sales but extends naturally to scarce, high-demand items like concert tickets, sports events, or product launches. Instead of tickets being snapped up by scalpers and bots, organizers can create raffle-based ticket sales restricted to verified fans, ensuring fair distribution. Nationality or age restrictions can also enforce local laws (e.g., alcohol event tickets, regional promotions). The same framework could apply to sneaker drops, limited edition merchandise, or even high-demand subscription slots. By combining identity verification, escrow, randomness, and country-aware access, YAM is not just another marketplace.

How it's Made

I built YAM solo, handling both the frontend and smart contract development end-to-end. The project stack is Next.js + TypeScript + TailwindCSS for the frontend, Flow Cadence contracts for escrow and raffles, and Self.xyz SDK for privacy-preserving identity verification.

The entry point is a Self.xyz login flow, which I integrated using the Self SDK. On login, a user’s DID and proofs (such as nationality, uniqueness, or age) are fetched and stored in React context. This allows me to enforce fairness rules directly in the app like one verified entry per raffle per human, or restricting certain listings to buyers from specific countries.

For the blockchain side, I wrote a Flow smart contract to manage Listings, which support both direct purchase and raffle modes. The raffle contract handles:

creating raffles with escrow,

allowing verified users to enter (one entry per DID),

checking nationality against the seller’s allowed list, and

distributing funds to winners when the raffle ends.

To connect this with the UI, I used @onflow/fcl for transactions. A Flow wallet prompt only appears when the user takes a blockchain action (create listing, buy, or enter raffle), instead of forcing wallet connect at login. This makes the UX smoother and puts Self.xyz identity first, with Flow as the transaction layer.

On the frontend, I built a seller form with Tailwind to capture product details: item name, description, price, quantity, sale type (direct/raffle), deadline (for raffles), and allowed countries. Once submitted, the form triggers a Flow transaction that writes the listing to the contract. Buyers can then browse listings in a grid and either purchase instantly or enter raffles. Verified sellers and buyers get a “Verified via Self.xyz” badge in the UI.

Since I worked solo and time was limited, I took some hacky shortcuts: for example, I mocked randomness in the raffle draw instead of integrating a full randomness oracle, and I initially mocked Flow contract calls so I could test the UI before deployment. Leveraging Self.xyz’s new Aadhaar support was particularly helpful, since it let me enforce country-based restrictions without handling sensitive data myself.

background image mobile

Join the mailing list

Get the latest news and updates