
Block Bazaar
A decentralized marketplace for on-chain stores, tokens, and products.
Demo
About
Block Bazaar – A Decentralized Retail Marketplace Block Bazaar is a full-stack decentralized application that lets anyone launch on‑chain retail stores, issue native store tokens, and list products—without relying on centralized platforms. It blends a familiar e‑commerce experience with crypto-native primitives: programmable tokens, transparent on-chain state, and non‑custodial user ownership. Core Value Proposition - Empower creators and brands to spin up on-chain stores in minutes. - Issue store-native fungible tokens that power loyalty, pricing, and rewards. - Transparently manage inventory and store data via smart contracts. - Let users interact with stores directly from their wallets—no accounts, no custody. Key Capabilities - Wallet-first login: Fast, secure authentication using Dynamic Labs with Wagmi/Viem. - Factory-based store creation: A Retail Factory deploys dedicated Store contracts for each creator. - Tokenized stores: Each Store mints its own fungible token at initialization; the contract handles token decimals (6). - Liquidity setup: Option to pair the store token with PYUSD and add liquidity via Uniswap V2 pathways. - Product management: Creators can add products to their store through a guided modal. - Browsable homepage: All stores are fetched from the factory; store metadata is resolved per-store where RPCs allow. - Owner dashboard: Shows the creator’s stores, token balances, total supply, on-chain reserves, and product utilities. - Store details modal: Unified view of a store’s on-chain footprint, with copy/explorer shortcuts and clean fallback handling. How It Works – End-to-End Flow 1. Connect wallet - Uses Dynamic Labs + Wagmi; supports injected wallets and a clean UX. - Network: Sepolia testnet by default. 2. Create a store - Retail Factory deploys a new Store contract owned by the creator. - Initialization sets name, description, token name/symbol, and initial supply (decimals handled by the contract). - Optional liquidity parameters (PYUSD + Uniswap V2) can be provided during init. 3. Manage the store - Add products via a modal. - Review token data: total supply, store-held balance (reserve), and user balance. - Share store contract links with explorers for transparency. 4. Browse stores - Homepage fetches all store addresses from the Factory. - For each store, the app tries to fetch metadata from the Store contract; if RPCs are limited, the UI gracefully degrades with placeholders. 5. Buy/interact - Store tokens can be used to pay or reward customers (flow extendable). - Swap Tokens button provides an entry point to a swapping modal/flow (no embedded swap box noise). Smart Contract Design (high-level) - Retail Factory - Deploys Store contracts. - Exposes queries like `getAllStores()` and mappings like `storeToOwner`. - Store - Holds store metadata (name, description, created timestamp, active flag). - Manages a fungible store token (decimals set to 6 within the contract). - Handles initialization (mints initial supply, can integrate with PYUSD and liquidity workflows). - Exposes `storeToken()` and `getStoreInfo()` for read operations. Token and Decimal Handling - Decimals: 6 (set at the smart contract level). - UI normalization: - Balances and supply values are displayed in human-readable units (normalized by 10^6). - The app avoids client-side “10**6” scaling during initialization—contracts handle it. - Liquidity amounts (e.g., PYUSD) are passed in base units aligned with contract expectations to prevent double-scaling. UX Highlights - Clean, professional modal design with compact badges and explicit states. - One-click copy for addresses; one-click Etherscan links for contract transparency. - Helpful status indicators (Active, Limited Info due to RPC constraints). - Clear error toasts and progressive loading. Security and Ownership - Non-custodial: Users retain control of their keys and assets at all times. - Transparent contracts: Users can verify data/transactions on-chain via explorer links. - Principle of least trust: The app reads from-chain and degrades gracefully when RPCs are limited. Extensibility and Roadmap - Product catalog and purchasing flows: - Expand Products tab with on-chain SKU definitions, inventory, and order history. - Add token-gated products, loyalty tiers, and rewards. - Token utilities: - Discounts, staking, or revenue-sharing models for token holders. - Payments: - Smooth swap/checkout flows integrating directly with AMMs or aggregators. - Analytics: - Reintroduce an Analytics tab with sales KPIs, holders distribution, and liquidity stats. - Multi-chain: - Add more networks and RPC resiliency strategies as needed. Block Bazaar turns store creation into a one‑click, on‑chain experience—combining the trust of smart contracts with the familiarity of modern e‑commerce, and paving the way for tokenized retail, loyalty, and community-driven commerce.
How it's made
Tech stack: Next.js (App Router), React Wagmi + Viem for chain interactions Dynamic Labs for wallet UX shadcn/ui components and lucide-react icons Solidity: ^0.8.13 (compiled with solc 0.8.30) Framework/Tooling: Foundry (Forge, Anvil, Cast) Libraries: OpenZeppelin Contracts v5.4.0 Testing: forge-std (Test, Script) Deployment: Forge scripts (broadcast to Anvil/local or RPC) Scripts: Bash (scripts/start-local.sh), Node.js snippets for ABI extraction Network: Anvil local chain (chainId 31337)