KRON — Project Overview

KRON is a hybrid decentralized/centralized NFT trading network built on the Polygon blockchain. It combines on-chain NFT transactions with a centralized backend for managing users, referral trees, and income tracking.

ℹ️ Only three types of transactions are on-chain: NFT minting (subscription), NFT trades (buy/sell), and burn events. All other activities (referral tracking, income calculation, user profiles) are off-chain in MySQL.

Core Mechanics

  • New member pays 150 USDT subscription → smart contract mints 2 NFTs
  • NFT-1 (75 USDT) listed at 85 USDT; NFT-2 (1 USDT) listed at 40 USDT
  • Trading must occur within 24 hours or income is penalized
  • When NFT value reaches 120 USDT, it is burned and the cycle resets
  • Members earn referral income from up to 10 levels of downline
  • Fund distribution is handled automatically by smart contract according to tokenomics

System Architecture

┌─────────────────────────────────────────────────────────┐ │ KRON ARCHITECTURE │ ├─────────────────────────────────────────────────────────┤ │ Browser (HTML/CSS/JS) │ │ ├── index.html (Landing page) │ │ ├── dashboard.html (User dashboard) │ │ ├── admin.html (Admin panel) │ │ └── MetaMask (Web3 wallet) │ │ │ │ │ ▼ │ │ FastAPI Backend (Python) │ │ ├── /api/users (User management) │ │ ├── /api/income (Earnings calc) │ │ ├── /api/referrals (Network tree) │ │ ├── /api/admin (Admin controls) │ │ └── /api/webhook (Blockchain events) │ │ │ │ │ │ ▼ ▼ │ │ MySQL Database Polygon Blockchain │ │ (Users, Income, (NFT Mint, Trade, │ │ Referrals, etc.) Burn, Subscription) │ └─────────────────────────────────────────────────────────┘

Tech Stack

LayerTechnologyPurpose
FrontendHTML5, CSS3, Vanilla JSAll UI pages
BackendFastAPI (Python 3.11+)REST API, business logic
DatabaseMySQL 8.0+Users, referrals, income, off-chain data
BlockchainPolygon (MATIC)NFT minting, trades, burns (ERC-721)
WalletMetaMaskUser & admin authentication
Web3ethers.js v6Blockchain interaction in browser
ORMSQLAlchemy + AlembicDB models and migrations
Smart ContractSolidity 0.8+NFT ERC-721 + fund distribution

File Structure

kron/ ├── frontend/ # All HTML files │ ├── index.html # Landing page │ ├── dashboard.html # User dashboard │ ├── admin.html # Admin panel │ ├── docs.html # This documentation │ ├── style.css # Global styles │ ├── dashboard.css # Dashboard styles │ ├── admin.css # Admin styles │ ├── app.js # Main JS (wallet, animations) │ ├── dashboard.js # Dashboard logic │ └── admin.js # Admin panel logic ├── backend/ │ ├── main.py # FastAPI app entry point │ ├── config.py # Settings & env vars │ ├── models/ │ │ ├── user.py │ │ ├── nft.py │ │ ├── income.py │ │ └── transaction.py │ ├── routers/ │ │ ├── users.py │ │ ├── income.py │ │ ├── referrals.py │ │ ├── admin.py │ │ └── webhook.py │ ├── services/ │ │ ├── income_engine.py │ │ └── polygon_listener.py │ └── database.py ├── contracts/ │ ├── KronNFT.sol # Main ERC-721 contract │ └── KronFund.sol # Fund distribution contract ├── .env ├── requirements.txt └── README.md

Backend Setup (FastAPI)

1. Prerequisites

  • Python 3.11 or higher
  • MySQL 8.0+
  • Node.js (for Hardhat/contract deployment)

2. Installation

# Clone the repo git clone https://github.com/yourorg/kron.git cd kron/backend # Create virtual environment python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate # Install dependencies pip install fastapi uvicorn sqlalchemy pymysql python-dotenv pip install web3 alembic pydantic[email] python-jose

3. Environment Variables (.env)

DATABASE_URL=mysql+pymysql://user:password@localhost/kron_db SECRET_KEY=your-secret-key-here POLYGON_RPC_URL=https://polygon-rpc.com CONTRACT_ADDRESS=0x...your_contract_address ADMIN_WALLET=0x...your_admin_wallet

4. Run the server

uvicorn main:app --reload --host 0.0.0.0 --port 8000 # API docs available at: http://localhost:8000/docs

API Endpoints

MethodEndpointDescription
POST/api/users/registerRegister user with wallet address + referrer
GET/api/users/{wallet}Get user profile and stats
GET/api/income/{wallet}Get all income for a wallet
GET/api/referrals/{wallet}Get full referral tree (10 levels)
POST/api/webhook/nft-mintedCalled by smart contract on mint
POST/api/webhook/nft-tradedCalled by smart contract on trade
POST/api/webhook/nft-burnedCalled by smart contract on burn
POST/api/admin/trade-modeSet slow/fast mode (admin)
POST/api/admin/daily-limitSet daily trade limit (admin)
POST/api/admin/buybackTrigger buy back (admin)
GET/api/admin/membersGet all members (admin)
PATCH/api/admin/brandingUpdate logo/contact/social links

MySQL Database Schema

-- Users table CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, wallet VARCHAR(42) UNIQUE NOT NULL, referrer_wallet VARCHAR(42), rank ENUM('none','bronze','silver','gold','platinum') DEFAULT 'none', is_active BOOLEAN DEFAULT TRUE, joined_at DATETIME DEFAULT NOW(), subscription_expires DATETIME, missed_days INT DEFAULT 0, trade_mode ENUM('slow','fast') DEFAULT 'fast' ); -- NFTs table CREATE TABLE nfts ( id INT AUTO_INCREMENT PRIMARY KEY, token_id VARCHAR(100) UNIQUE NOT NULL, owner_wallet VARCHAR(42) NOT NULL, mint_price DECIMAL(10,2), current_price DECIMAL(10,2), status ENUM('minted','listed','sold','burned'), created_at DATETIME DEFAULT NOW(), burned_at DATETIME NULL ); -- Income table CREATE TABLE income ( id INT AUTO_INCREMENT PRIMARY KEY, wallet VARCHAR(42) NOT NULL, source_wallet VARCHAR(42), amount DECIMAL(10,2), type ENUM('nft_sale','referral_l1','referral_l2','referral_l3', 'referral_l4','referral_deep','pairing_bonus','trading'), level INT DEFAULT 1, created_at DATETIME DEFAULT NOW() ); -- Transactions (blockchain mirror) CREATE TABLE transactions ( id INT AUTO_INCREMENT PRIMARY KEY, tx_hash VARCHAR(100) UNIQUE NOT NULL, wallet VARCHAR(42), type ENUM('subscribe','nft_mint','nft_trade','nft_burn','buyback'), amount DECIMAL(10,2), block_number BIGINT, created_at DATETIME DEFAULT NOW() ); -- Settings table (admin panel config) CREATE TABLE settings ( key_name VARCHAR(100) PRIMARY KEY, value TEXT, updated_at DATETIME DEFAULT NOW() ON UPDATE NOW() ); -- Insert defaults INSERT INTO settings VALUES ('trade_mode', 'fast', NOW()), ('daily_limit', '5', NOW()), ('mint_price_nft1', '75', NOW()), ('mint_price_nft2', '1', NOW()), ('burn_threshold', '120', NOW()), ('subscription_fee', '150', NOW()), ('site_logo', '', NOW()), ('announcement', '', NOW());

Polygon Blockchain Setup

Adding Polygon to MetaMask

SettingValue
Network NamePolygon Mainnet
RPC URLhttps://polygon-rpc.com
Chain ID137
SymbolMATIC
Explorerhttps://polygonscan.com
💡 Users need MATIC for gas fees and USDT (on Polygon) for subscriptions and trades. USDT contract on Polygon: 0xc2132D05D31c914a87C6611C10748AEb04B58e8F

Smart Contract Overview

// KronNFT.sol (simplified) // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract KronNFT is ERC721 { address public admin; IERC20 public usdt; uint256 public subscriptionFee = 150 * 1e6; // USDT has 6 decimals on Polygon uint256 public burnThreshold = 120 * 1e6; uint256 public mintPriceNFT1 = 75 * 1e6; uint256 public mintPriceNFT2 = 1 * 1e6; // Fund distribution wallets address public burnWallet; address public crisisFundWallet; address public fundersWallet; address public newProjectsWallet; address public creatorWallet; event NFTMinted(address indexed user, uint256 tokenId, uint256 price); event NFTTraded(address indexed from, address indexed to, uint256 tokenId, uint256 price); event NFTBurned(uint256 indexed tokenId); function subscribe(address referrer) external { usdt.transferFrom(msg.sender, address(this), subscriptionFee); _distributeFunds(subscriptionFee, false); _mintNFTs(msg.sender); // Emit event for backend webhook } function _distributeFunds(uint256 amount, bool isProfit) internal { uint256 burn = amount * 40 / 100; uint256 crisis = isProfit ? amount * 30 / 100 : amount * 20 / 100; // ... distribute to each wallet } }

NFT Transaction Flow

User clicks "Join" on website → MetaMask opens, user approves USDT transfer (150 USDT) → Smart contract: distributeFunds() → splits to 5 wallets → Smart contract: mintNFT1(75 USDT) + mintNFT2(1 USDT) → Events emitted: NFTMinted × 2 → Backend webhook receives events → MySQL: user created, NFTs stored, subscription set → Frontend: redirect to dashboard NFT Trade Flow: User sells NFT-1 for 85 USDT → Buyer approves 85 USDT transfer → Smart contract: trade() transfers NFT + USDT → Event: NFTTraded(from, to, tokenId, price) → Backend: records trade, calculates referral income → Backend: distributes income to upline (up to 10 levels) → MySQL: income table updated for all eligible upline Burn Flow: NFT price reaches 120 USDT → Admin or auto-trigger: burn() → Event: NFTBurned(tokenId) → Backend: marks NFT as burned → Backend: triggers re-mint for owner (new cycle)

Income & Trading Rules

Referral Commission Table

LevelCommissionEligibility
L1 (Direct)5 USDTAlways active with active subscription
L23 USDTNeed ≥2 direct referrals
L33 USDTNeed ≥2 direct referrals
L44 USDTBronze rank required
L5–L101 USDT eachBronze rank required

Trading Rules

  • 24-Hour Rule: If you miss trading in your window, your referral income for the next day is cut
  • 17-Day Rule: Missing more than 3 days in a 17-day window stops all referral income. Max earnings capped at base 150 USDT
  • Subscription Window: First subscription is valid for 18 days
  • Pairing Bonus: 5 USDT earned when you achieve 2 direct referrals (a "pair")
  • Missed Income: If you are inactive, your share goes to the Company Wallet
⚠️ The income_engine.py service must run daily (cron job) to recalculate member eligibility, check missed trading days, and update rank statuses.

Tokenomics & Fund Distribution

RecipientFrom SubscriptionsFrom Leveling Profit
🔥 Burning (Deflation)40%40%
🛡 Financial Crisis Fund20%30%
👥 Funders20%
🚀 New Projects10%20%
⭐ Creator10%10%

All fund distributions are executed automatically by the smart contract at the time of each transaction. No manual intervention is needed for routine distributions.

Admin Panel Guide

Accessing the Admin Panel

  1. Navigate to admin.html
  2. Click "Connect MetaMask" and sign with the admin wallet address configured in .env
  3. The backend verifies the wallet signature before allowing admin API calls

Key Admin Functions

  • Trading Control: Toggle Slow/Fast mode; set daily trade limits; activate/deactivate specific Trade IDs; set minting prices
  • NFT & Burn: Manually execute burn for a specific NFT token ID; trigger company buy back; update burn threshold and subscription fee
  • Wallet Management: Update any of the 5 fund distribution wallet addresses (requires on-chain tx confirmation)
  • Branding: Upload logo, update contact details, social media links, and announcement banners
  • Security: Update admin wallet; pause/resume the entire system in emergencies
🔐 The admin wallet must be kept secure. Changing it requires an on-chain transaction from the current admin wallet. There is no recovery mechanism.

Deployment Guide

Production Checklist

  1. Deploy smart contract to Polygon Mainnet using Hardhat or Remix
  2. Set up MySQL 8.0 on your server (or use PlanetScale/AWS RDS)
  3. Configure .env with production values
  4. Run alembic upgrade head to create all tables
  5. Deploy FastAPI using Gunicorn + Nginx
  6. Point frontend files to your FastAPI API URL
  7. Set up a daily cron job to run income_engine.py
  8. Configure a blockchain event listener (polygon_listener.py) as a background service
  9. Enable HTTPS on all endpoints
# Start FastAPI in production gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker \ --bind 0.0.0.0:8000 # Daily cron job (add to crontab) 0 0 * * * /path/to/venv/bin/python /path/to/income_engine.py # Start blockchain listener (systemd service recommended) python polygon_listener.py