Trade Mining Overview
How DepthSight nodes mint $DEPTH by submitting anonymous trade telemetry — node identity, scoring, mining epochs and reward distribution.
Trade Mining is the federated incentive layer of the DepthSight ecosystem. Every node in the federation — the central master hub or any self-hosted mining server — mines tokens by reporting anonymous telemetry about the real trades it executes. Verified trades earn $DEPTH from a fixed daily emission budget, distributed across the nodes that contribute activity.
Telemetry is anonymous: no API keys, orders or secrets are shared. A node only sends trade facts (symbol, direction, entry, exit, duration, exit reason, strategy blocks, volume). Rewards follow the node identity, not the exchange account.
1. Concepts
| Term | Meaning |
|---|---|
| Central Hub | The central deployment (IS_CENTRAL_HUB=true). Hosts the hub API, verifies trades, finalizes epochs and mints rewards. |
| HubNode | A node identity (node_uuid + node_secret) registered on the hub. Every miner and every mining server is a HubNode. |
| Mining server | A HubNode flagged is_mining_server=True. Hosts external miners and earns a commission on trades mined through it (source_node_uuid). |
| Miner node | The HubNode a specific trade is attributed to (node_uuid on the report). |
| Wallet-bound node | A node owned by an EVM wallet. Its node_uuid = UUIDv5(NAMESPACE_DNS, "evm:<address>") is deterministic, so the same identity reproduces on any server and history follows the wallet. |
| HubServerConfig | Per-server override of the user/server reward share (default 75%). |
| $DEPTH | The reward token minted by mining epochs. |
Key modules: api/hub_router.py (hub endpoints), api/routes/config.py (local mining endpoints), bot_module/controller.py (telemetry dispatch), tasks.py (epoch processing), telemetry_sync.py (offline resync), api/models.py (mining schema).
2. Node Identity & Wallet Binding
Before any telemetry can be attributed, a node must exist on the hub and prove who it is.
Node credentials
node_uuid— unique 36-char identity.node_secret— the telemetry write credential. The hub stores onlysha256(node_secret)and verifies every payload with an HMAC-SHA256 signature keyed by the raw secret. The raw secret is never persisted and travels only over TLS.
Local nodes read their identity from the HUB_NODE_UUID / HUB_NODE_SECRET env vars or from a node_identity.json / identity.json file. Wallet-bound users prefer the wallet identity stored in AppConfig.exchange_settings.weex (mining_node_uuid / mining_node_secret).
Wallet binding & ownership
POST /api/v1/config/node/wallet/nonce— returns a self-verifying, expiring SIWE-style ownership message (embeds the address, purpose, and absolute expiry — no shared nonce state, safe across uvicorn workers).POST /api/v1/config/node/wallet/verify— verifies the signature and binds the wallet:- stores
node_uuid = UUIDv5("evm:<address>"), a freshmining_node_secret,wallet_addressandwallet_configured=trueinexchange_settings.weex; - migrates any legacy
mining_node_uuid/virtual-<user_id>history (telemetry, ledger,total_mined, referral links) onto the new EVM node via_transfer_node_data— nothing is lost; - purges legacy mnemonics.
- stores
The EVM wallet is the ownership credential: wallet-bound nodes cannot be created, claimed, re-keyed, given a referrer, or revoked without a valid wallet signature. The node secret is only a write-only telemetry credential.
Hub registration
Nodes register via POST /api/v1/hub/nodes/register:
- stores
sha256(node_secret), IP, geolocation, version, optionalweex_uid/public_domain; - assigns a unique referral code (
DSN-REF-...) if absent and binds the referrer whenreferrer_codeis provided; - may flag the node as a mining server and record its
user_reward_share_percentinhub_server_configs; - adopts legacy random-UUID nodes onto their deterministic wallet UUID (FK-safe re-key of telemetry/rewards/server-config children);
- guard rails:
virtual-*UUIDs are reserved; a legacy node's secret hash is never overwritten with a different value; wallet signatures are mandatory for wallet-bound nodes — preventing pre-registration hijack.
POST /api/v1/hub/nodes/ping is the heartbeat: it refreshes last_ping, latency, version, public domain, auto-updates geolocation and upserts the server's reward share. The live network is exposed by GET /api/v1/hub/nodes (all nodes with a ping in the last 5 minutes).
Wallet-bound nodes may revoke their telemetry credential via POST /api/v1/hub/nodes/revoke-telemetry (wallet signature required; secret_hash is cleared and the node can no longer report until re-keyed).
3. Telemetry Dispatch
When a position closes and the user has both shareTelemetry enabled (auto-asserted when mining is active) and a hub mining config allows the exchange, the bot controller (_dispatch_telemetry_to_hub) performs:
- Saves a local
LOCAL_ONLYcopy (visible in the "Trades" UI tab). - Computes
HMAC-SHA256over the exact serialized body (sort_keys=True). POSTs the report to the hub at/api/v1/hub/telemetry/reportwithX-Node-UUID,X-Node-Secret,X-Node-Signatureheaders.- Marks the local copy
SENTwhen the hub acknowledges (a409duplicate is also treated as success).
The full payload schema, headers and signing rules are documented on the Telemetry Report API page.
If the node goes offline, telemetry_sync.py / the sync_pending_telemetry_task re-uploads any LOCAL_ONLY records later.
4. Scoring & Eligibility
On ingestion the hub computes an anti-abuse score and an estimated rebate.
Eligibility — a report is eligible only when:
- mining is enabled in
MiningConfigand the exchange is ineligibleExchanges; tradeModeisLIVE(never backtest/paper);- hold time is at least
minTradeDurationSec(default 30 s) — anti-wash; - entry and exit prices are set and positive.
Score (_score_trade) — 0.0–1.0; longer holds score higher (duration capped at 1 h), so fast scalps earn less than trend holds.
Estimated rebate (_estimate_rebate) — tradeVolumeUsdt × 0.0005 (fee rate) × rebateRate[exchange_market]. Volume is the notional open+close (|qty × entry| + |qty × exit|).
The report row stores score, is_mining_eligible, estimated_rebate_usdt, and the initial verification status (PENDING / SKIPPED).
5. Verification Statuses
| Status | Meaning |
|---|---|
PENDING | Awaiting broker verification (exchange in the verifiable set). |
VERIFIED | Broker-verified; eligible to be credited by a mining epoch. |
SKIPPED | Reported from an exchange with no verifier — treated as verified immediately. |
LOCAL_ONLY | Saved locally, not yet uploaded to the hub. |
SENT | Local copy acknowledged by the hub. |
Verification of PENDING reports happens in the daily epoch processor on the hub (closed-source broker verification in a private module). The open source manages the status columns (verification_status, verified_volume_usdt, verification_error, verified_at).
6. Mining Epochs
Rewards are minted once per UTC day by the Celery task process_mining_epoch_task (tasks.py, shared logic also exposed via POST /api/v1/hub/mining/process-epoch and recalculate_past.py). The daily algorithm is documented in the closed-source epoch processor; from the open-source side the persisted state is:
- Epoch day — yesterday (UTC), unless forced. Days that are not fully over are never finalized (late-arriving reports for a past day are credited to the next epoch via
epoch_date IS NULL). - Verification pass over the epoch window (closed-source verifier).
- Eligible reports —
VERIFIED, eligible,created_at <= end-of-day,epoch_date IS NULL. Already-attributed reports are never re-added, so re-processing is idempotent.- If
PENDINGreports remain, the epoch is not finalized and re-queued.
- If
- Emission with halving:
daily_emission = daily_emission_base / 2**halvings. - Points — base points = summed
estimated_rebate_usdt; referral points = base ×referral_mining_boost(credited to the referrer node). Tokens-per-point =daily_emission / total_points. - Reward per node — base reward + referral bonus, plus a one-time welcome bonus milestone when cumulative volume crosses
MIN_WELCOME_REBATE_USDT.- Welcome bonuses come from a dedicated 100M $DEPTH pool with progressive stages (1000 / 500 / 250 / 125 $DEPTH) and a per-UID claim cap.
- Per-report server commission — the reporting server keeps
(1 − share)of each report's gross base reward (shared_fromitshub_server_configs; otherwise global 75% default); the miner keepsshare.NULL/banned source routes the commission to the hub operator root (is_operator, else the first admin who bound a wallet node). - Persist — upsert
MiningLedgerper node+epoch; incrementHubNode.total_mined; trackMiningConfig.total_commission_collected.
Referral and welcome bonuses are not subject to server commission.
The $DEPTH reward formula
dailyEmission = dailyEmissionBase / 2^(daysSinceLaunch / halvingIntervalDays)
tokenPerPoint = dailyEmission / Σ(basePoints + referralPoints)
baseReward(node) = Σ(estRebate(node)) × tokenPerPoint
referralReward(node)= Σ(estRebate(referrals)) × boost × tokenPerPoint
gross(perReport)= baseReward(node) × (reportRebate / nodeTotalRebate)
netBase = Σ gross × serverShareOf(source_server)
totalReward = netBase + referralReward + welcomeBonus
Referral model
A node's referrer is resolved in priority order: explicit referrer_node_uuid → the owner user's referred_by relationship resolved to that user's mining node. Referrers earn boost × base points on every eligible trade of their referred nodes, plus a matching welcome grant at mint time.
7. Configuration
Public mining settings: GET /api/v1/hub/mining/config (public), POST /api/v1/hub/mining/config (admin). Node-level: GET/PUT /config/mining/node-config (admin, on the hub side).
Setting (MiningConfig) | Default | Meaning |
|---|---|---|
is_mining_enabled | false | Global switch |
eligibleExchanges | ["weex","weex_futures","weex_spot"] | Eligible exchanges + market keys |
dailyEmissionBase | 547945.21 | Initial daily $DEPTH emission |
halvingIntervalDays | 365 | Days between halvings |
launchDate | NULL | Start date for the halving countdown |
minTradeDurationSec | 30 | Minimum hold time for eligibility |
minTradePnlAbs | 0.0 | Not an active gate |
referralMiningBoost | 0.10 | Referral multiplier on base points |
rebateRates | see below | Rebate fraction per exchange_market |
Rebate rate defaults: weex_futures 0.60, weex_spot 0.45, weex 0.60, bybit_futures 0.40, binance_futures 0.25.
NodeMiningConfig: is_global_mining_enabled (True) and user_reward_share_percent (75% — positive values only, legacy 0 is treated as 75% so rewards are never silently zeroed). Per-server: hub_server_configs.user_reward_share_percent.
8. Environment Variables
| Variable | Purpose |
|---|---|
IS_CENTRAL_HUB | true on the hub (no outbound reporting, owns the mining DB). |
FEDERATION_HUB_URL | Hub base URL for telemetry posts, mining status and the epoch proxy. |
HUB_NODE_UUID / HUB_NODE_SECRET | Local node identity (non-wallet nodes). |
HUB_ADMIN_API_KEY | Admin key for hub config, epoch trigger and operator designation. |
WELCOME_BONUS_MAX_POOL | Welcome bonus total supply (default 100000000.0). |
MIN_WELCOME_REBATE_USDT | Volume threshold to earn the welcome bonus (default 5.0). |
MAX_NODES_PER_UID | Max welcome grants per Weex UID (default 1). |
9. Operations Tooling
| Tool | Purpose |
|---|---|
recalculate_past.py | Re-runs the epoch processor for a historical day. |
reset_mining.py | Dev/ops: wipes MiningLedger/MiningEpoch, zeroes total_mined and commission, resets reports to PENDING/re-open for re-processing. |
telemetry_sync.py + sync_pending_telemetry_task | Re-uploads LOCAL_ONLY reports to the hub after connectivity is restored. |
10. Security Model
X-Node-Secretis only sent over TLS; the hub stores only its SHA-256 hash and the raw secret is needed to compute the HMAC, so a leaked DB never exposes a usable signing key.- Payload tampering → HMAC mismatch →
403; duplicatebroker_trade_idon another node →409. - Attribution is restricted to the caller's own node or a node of the same owner (referral / Weex UID / wallet), so trades can't be misattributed.
source_node_uuidmust point to a node flaggedis_mining_server.- No double-counting: reports carry
epoch_date, ledger upserts are additive and epochs are finalized exactly once. - Privacy: report carries no API keys, order IDs, risk config or private data.
The closed-source verifier is the only private component; telemetry intake, scoring, attribution, epoch math and the ledger all ship open-source.
Dynamic Risk Management
Comprehensive analysis of the 11-stage signal assessment pipeline, automatic blacklisting, dynamic trade size scaling, and portfolio-level risk limits inside the DepthSight RiskManager.
Telemetry Report API
The exact trade telemetry payload, node authentication headers, HMAC signature and the complete mining REST API surface of the central hub and local nodes.