Project architecture

BAFEX is based on a modular architecture that combines a frontend application, a managed backend for service functions and analytics, and smart contracts.

This approach ensures scalability and reliability as the number of users increases.

Front-architecture

  • Frontend

    • Development using modern frameworks (React/Vue/Angular) and web3 libraries for interaction with smart contracts.

    • Adaptive design, optimized for various devices (mobile, desktop).

    • Built-in module for authentication and wallet binding.

    • A marketplace platform with a user-friendly interface and product cards, including search, filtering, sorting functionality, and detailed product pages with descriptions, prices, and transaction terms.

    • User sections: personal account, order management, transaction history, and notifications.

  • Backend

    • A service layer that works with a database (seller rating, transaction history, product catalog), notifications, and analytics.

    • Uses REST or GraphQL API to communicate between the frontend and blockchain services (via a node or RPC provider).

    • Supports microservice architecture, enabling easy scaling of individual components (e.g., image processing services, AI assistant modules).

  • Database (DB)

    • Stores data that is not critical for the blockchain: product descriptions, ratings, browsing history, user profiles (taking into account KYC/AML, where required), and other information.

    • A relational (PostgreSQL) or NoSQL (MongoDB) solution can be used depending on the need for data structure flexibility.

  • Integration with blockchain

    • Smart contracts are deployed across one or more networks via web3 providers (e.g., Infura, QuickNode, or custom nodes).

    • All key operations (NFT release, Escrow, staking, DAO voting) are carried out through smart contracts, ensuring transparency and decentralization.

  • Analytics and Alert services

    • Automatic collection of logs from smart contracts using specialized indexes (for example, The Graph) or custom parsers.

    • Analytics panel for tracking sales dynamics, product popularity, staking statistics, and referral accruals.

    • Real-time notifications (email, push, messengers) for transactions, DAO updates, staking period ends, and more.


Smart-contracts

  1. BAFEX token contract

    • Complies with the ERC-20/BEP-20 standard (depending on the chosen network).

    • Implements basic functions: transfer, approve, transferFrom.

    • Supports operations mint (issue) & burn (burning) in accordance with the project's tokenomics (limited or controlled volume).

    • Serves as the primary means of payment on the platform.

  2. Escrow-contract

    • Responsible for automatically blocking the buyer's funds when placing an order.

    • Integrated with NFT mechanism: when a transaction is created, a unique NFT is issued, which acts as a β€œguarantee card”.

    • After successful confirmation of delivery (manual by the buyer or automatic after a specified period), the funds are unlocked and transferred to the seller. In case of disputes, separate conflict resolution functions are used, including through DAO (if included in the business logic).

  3. Staking Contract

    • Provides freezing (Lock) of BAFEX tokens for a set period with calculation of percentage yield (APY).

    • Provides different types of locking: Soft Lock (flexible withdrawal, but low profitability) and Hard Lock (fixed term, higher APY rates).

    • Regulates the limited emission of rewards, taking into account economic restrictions (no more than 25% of tokens in staking, automatic reduction of APY in case of overheating).

  4. Referral system contract

    • Takes into account the referrer, referral, and the time period for receiving bonuses (one-time or multi-level system).

    • Provides the ability to change referral program levels by decision of the DAO or upon reaching certain KPIs.

    • Allows you to delegate verification of a transaction's authenticity to the Escrow smart contract, thereby eliminating the potential for cheating.

  5. DAO contract

    • Implements the mechanics of voting and making proposals (Proposals).

    • Each address with a certain amount of BAFEX tokens can participate in votes and/or initiate them (the threshold for creation and approval is adjustable).

    • When proposals are approved, the system automatically makes changes (for example, to the staking configuration) or signals updates to other smart contracts via multisig or a trusted execution mechanism.


Product identification mechanism

  • Each product and its various attributes (model, color, flavor, and other parameters) are automatically assigned a unique digital identifier (ID). This ensures accurate accounting, facilitates search, and eliminates errors in cryptocurrency transactions.

  • Sellers receive this functionality at no additional cost. Using unique IDs simplifies analytics, allowing you to clearly classify products, identify trends, and forecast demand on the marketplace.


NFT-mechanism

Each transaction comes with a secure NFT token, protecting both the seller and the buyer from any form of fraud.

Each time an item is shipped, the smart contract issues a unique NFT, which is β€œburned” once the buyer confirms delivery (or after a specified amount of time, depending on the chosen shipping method).

  • Standard: ERC-721/BEP-721 (the choice depends on the network on which the platform is deployed).

  • Generation mechanics: An NFT is created when an order is placed and contains encrypted information about the product, seller, buyer, and delivery times.

  • NFT burning: occurs automatically after confirmation of successful receipt of the goods or when the conditions for termination of the transaction arise (in case of refusal due to the fault of the seller).

  • Item-based: Each NFT has a unique identifier stored in the database, associated with a specific lot. This ensures transparency and protects against the reuse of the NFT.

  • Interaction with users: NFTs can be viewed by the buyer and seller in their personal accounts. Delivery confirmation is recorded in the blockchain, eliminating the risk of counterfeiting.


API/Integration

  • External API

    • Provides REST or GraphQL interfaces for integrating third-party services, aggregators, and applications (e-commerce plugins, mobile clients).

    • Access to methods for creating orders, initiating staking, obtaining NFT status, managing DAO, etc.

  • SDK

    • A set of libraries (JavaScript, Python, possibly Go) for simplified integration between web developers and mobile applications.

    • Includes methods for authorization, transaction signing, and secure key storage (priority - non-custodial solutions).

  • Wallet support

    • Initial compatibility with Metamask, Trust Wallet, and other web3 wallets.

    • The priority is to create our own native wallet (built into the platform), where users can safely store BAFEX tokens, participate in staking, and manage NFTs.

  • Third-party service integrations

    • Oracles for delivery confirmation (optional), courier services, AI service for analyzing product cards.

    • Possible integration with DeFi protocols to provide liquidity (DEX, liquidity pools).


Security

  • Smart-contract audit

    • Regular external audits (previously verified companies with a reputation in the market) and open source code on GitHub for independent community review.

    • Vulnerability analysis (reentrancy, overflow, fraud by contract owners).

  • Bug Bounty-program

    • A multi-tiered bug bounty program, including critical vulnerabilities related to theft of funds or counterfeiting of NFTs.

    • Publicly available reports of found and fixed bugs.

  • Protection Mechanisms

    • Use of proven libraries (OpenZeppelin, other standard contracts).

    • Multi-signature wallets for managing important parameters (APY changes, new token releases, referral settings updates).

    • Limiting the maximum possible emission and strict control of staking limits, excluding hyperinflation.

Last updated