DeBazaar
Trustless P2P marketplace for any digital goods with crypto escrow + arbitration
Problem Statement
DeBazaarDeBazaar is a decentralized marketplace that allows two strangers to safely trade any digital good using crypto.It replaces risky P2P deals in Telegram DMs with on-chain escrow, verifiable delivery checks, and decentralized arbitration, ensuring both sides are protected.System Overview DeBazaar currently consists of three core components:1.1. Frontend (Web App) - Buyers can browse listings and make payments securely. - Sellers can list any digital product — game assets, accounts, activation keys, NFT ownership, and more. - The UI guides users through creating an escrowed deal, avoiding unsafe off-chain trades.1.2. Backend / Coordinator - Coordinates trade flow and tracks deal states. - Manages disputes and integrates with oracle verification. - Bridges the frontend UX with the smart contract trust layer.1.3. Smart Contracts (Escrow + Arbitration) This is the trust layer of DeBazaar. - Escrow Contract: Locks buyer funds and releases them only when conditions are met. - Arbitration Contract: Enables dispute resolution via randomly selected arbiters.Settlement Paths DeBazaar supports three types of settlement flows, depending on asset verifiability:2.1. On-Chain Assets For crypto-native assets that exist entirely on-chain (NFTs, ERC-20 tokens, contract ownership, etc.): - Buyer locks funds in escrow. - Seller proves delivery on-chain. - Smart contract automatically releases funds.2.2. API-Verifiable Assets For off-chain actions or assets verifiable via API: - Uses oracle functions (e.g., Chainlink Functions) to validate delivery. - Example: Buyer pays for a Twitter repost.Buyer escrows funds.Seller reposts.Smart contract queries the Twitter API via oracle.If verified, funds are released.2.3. Human-Arbitrated Disputes For cases where delivery cannot be automatically verified, yet: - Either party can open a dispute. - The Arbitration contract uses verifiable randomness (e.g., Pyth VRF) to select a random jury from a pool of arbiters. - Arbiters are added to a private Telegram group with buyer and seller. - Both sides submit evidence. - Arbiters vote, and the final decision determines fund release or refund.Summary DeBazaar replaces “trust a random middleman” with: ✅ On-chain escrow ✅ Verifiable delivery checks ✅ Decentralized human arbitrationIt’s designed to handle both crypto-native assets and the massive gray market of off-chain digital goods that people already trade today.Test Transactions (Arbitrum Sepolia) Here are live examples of all three settlement paths: 4.1. On-Chain NFTListing: https://sepolia.arbiscan.io/tx/0x689e4619affc568f87c5e069d49c61a34c7d228507ad7952725a71a4759427b5Fill: https://sepolia.arbiscan.io/tx/0x9828b6e93df062fbb3be5e1a8a5375726b51b2b7113121281a2726c6f7e61f75Deliver & Release: https://sepolia.arbiscan.io/tx/0xec7a87315a9360bc6b937c165dfa783dd0d7754868d1c1cfb44873c7a8edf6224.2. Off-Chain Retweet - Listing: https://sepolia.arbiscan.io/tx/0x556657b1b330ddd00c9a3fd5cf1a737586f5559f4de360a7b32ad7d765a00c40 - Fill: https://sepolia.arbiscan.io/tx/0xf0bf3354d67042ea08209edd3be3fd5ffc30d0551d27ff1ca29195f97cbd185d - Deliver & Release: https://sepolia.arbiscan.io/tx/0xf5ea9bf858e6ac6ea0d5038a2695a23e7011aeadb7db7a5b505928a930afce9f4.3. Dispute Flow - Listing: https://sepolia.arbiscan.io/tx/0x2dc76c8d76af281e0029a12ac6b77c7e29db177ae7cb2bcb0bed44fe8e5791ab - Fill: https://sepolia.arbiscan.io/tx/0xc58ca64c6676ef17636af91481fedec798fa0ad5669e43e30ccac8a9adbd4723 - Deliver: https://sepolia.arbiscan.io/tx/0x6bbae4bd453506d1b8c9cc5f8fdd03337b04759450b5fee5aa55cb35346ad45c - Dispute: https://sepolia.arbiscan.io/tx/0xe66ad698257054a81e072a0e701f8a5d15b1ac338ae11d62a08bfb191ddd9c36 - Resolve: https://sepolia.arbiscan.io/tx/0x268ff86fd3183f7fba68d448dfa6f67660857148274e673d73632d7fe09942d8Documentation Full project details — including roadmap, architecture overview, and market research — are available in our GitHub documentation: https://github.com/4rdii/debazaar-marketplace/tree/main/docs.
Solution
Architecture Overview Built as a full-stack dApp with both on-chain and off-chain components.Smart Contracts (Solidity) Tech Stack:Solidity ^0.8.28Hardhat 3.0.7ethers.js v61.1. Contracts'DebazaarEscrow.sol' – Core marketplace with three escrow flows:API Approval: via Chainlink FunctionsOn-chain Approval: state verificationDisputable: arbiter-mediated resolution'DebazaarArbiter.sol' – Dispute resolution with randomized arbiter selection using Pyth Entropy V2'FunctionsConsumerUpgradable.sol' – Proxy consumer for "Chainlink Functions"1.2. Notable FeaturesRandomized arbiter selection using Pyth Entropy V2 for fairness and efficiencyWeb2 API integration through Chainlink Functions, allowing smart contracts to verify ownership of any offchain asset (e.g. in-game items, twitter reposts, etc.)Cross-chain NFT marketplace support enabled via Chainlink FunctionsOn-chain proof mechanism using a static call approach, enabling verifiable off-chain actions — unlike existing on-chain marketplacesEIP-712 permit-based arbitration, where permits must match arbiter order (see lines 109–114 in DebazaarArbiter.sol)Backend (Python/Django) Tech Stack:Django 4.2.7Django REST Framework (DRF)Web3.py '6.11.3PostgreSQL2.1. ComponentsREST API for listing managementBuilding unsigned transactions for frontend signing via MetaMaskABI encoding for Chainlink Functions through 'transaction_builder.py''addresses.py`' loads contract addresses from deployment artifacts'abis/' loader manages ABI data for all contracts2.2. Notable FeaturesFrontend-signing pattern: backend builds, frontend signs and executesJavaScript source flattening for Chainlink FunctionsOn-chain verification via multicallPYUSD used as the single purchase tokenFrontend (React) Tech Stack:React 18.2ethers.js 5.7.23.1. FeaturesBrowse and create listingsMetaMask integration with network switchingMulti-step transaction flows with status indicatorsDirect UX for listings3.2. Notable FeaturesWallet-first architecture (platform context only for merchant identity)Gas-optimized staging: approval → fill → deliveryChainlink Functions secrets managed via GitHub GistPartner TechnologiesPyth Entropy V2: Unbiased arbiter selectionPYUSD: Stable main payment tokenHardhatV3: Smart contract development and deploymentBenefitsPyth provides verifiable randomness without a VRF delayPYUSD offers price stability and accessibilityHardhatV3 provides a secure and reliable development environmentHacks & WorkaroundsArbitrum Sepolia contract verification issue: Encountered a bug and lack of documentation regarding chainDescriptor setup for contract verification. Resolved manually through Hardhat’s extended configuration.Entropy integration: Integrated Pyth Entropy V2 for random arbiter selection — the flow was straightforward, reliable, and cost-efficient, providing verifiable randomness without the complexity of VRF callbacks.Permit ordering for arbitration: Implemented strict EIP-712 permit ordering in DebazaarArbiter.sol, ensuring permits align with the randomized arbiter list to maintain fairness during disputes.Proxy upgrades for Chainlink Functions: Used ERC1967 upgradeable proxy pattern to allow seamless updates of the Chainlink Functions consumer without redeploying dependent contracts.Frontend-only signing: Enforced a frontend-only signing model—no private keys on the server—by building unsigned transactions on the backend and requiring MetaMask execution on the client.API secrets handling: Managed Chainlink Functions’ API secrets through encrypted GitHub Gists, allowing secure and flexible off-chain verifications without exposing keys.Static call verification pattern: Used a static call approach for on-chain verification, letting contracts safely validate off-chain claims without triggering state changes or high gas costs.Deployment Smart Contracts: Hardhat Ignition Full Stack: Docker Compose orchestrating Django backend, PostgreSQL database, and React frontend, with Caddy as the web server
Hackathon
ETHOnline 2025
2025
Contributors
- 4rdii
45 contributions
- Anttarress
40 contributions
- aryaethn
11 contributions