TREZ Token Project: Mining Contract Overview for Developers, Investors and Miners

TREZ Token Project: Mining Contract Overview for Developers, Investors and Miners

Last updated: October 2025

The TREZ Token Project is a Solana-based ecosystem designed for proof-of-work (PoW) mining and controlled token distribution. The mining contract (EUBkEwKJJnuenTnocaUHDZUaSegeWWZAFwBTqTRcQ1sJ) enables users to mine TREZ through a secure, transparent PoW system with dynamic difficulty and referral bonuses. The vesting contract (5qD4qAqMPg2yUTDjMLF1Ys5piDwX7aYpT8hPFA8Jz2s7) enforces locked distributions for DEV and SALES, preventing unauthorized access. The mining application (trez_miner.py) provides a user-friendly interface to participate, manage wallets, and track rewards.

This page explains the mining contract’s functions, the vesting contract’s role, and how the system is locked and secure—so both investors and miners can verify the mechanics on-chain.

Table of Contents

TREZ Mining Contract: Functions & Security

Implemented in programs/trez-mining/src/lib.rs (Anchor framework), the mining program manages PoW, user registration, referrer settings, and reward distribution.

Program ID

  • Program ID: EUBkEwKJJnuenTnocaUHDZUaSegeWWZAFwBTqTRcQ1sJ
  • Deployed on Solana mainnet for immutability and transparency.

Key Accounts

  • State PDA ([b"state"]): global mining state (challenge, difficulty, block count, era, reward).
  • MinerData PDA ([b"miner_data", user_pubkey]): per-miner data including referrer.
  • Distributor PDA ([b"distributor"]): authority for token payouts.
  • Distributor Token Account: TREZ ATA controlled by the distributor PDA.

Instructions (Functions)

1) initialize

  • Purpose: bootstraps the State, configures distributor, and readies TREZ payouts.
  • Behavior: sets initial challenge/difficulty, block count (0), era (0), reward; wires distributor PDA/ATA; emits init event.
  • Security: Anchor PDA checks prevent reinit; distributor is program-owned so tokens move only via valid instructions.

2) register_user

  • Purpose: creates the caller’s MinerData PDA.
  • Behavior: links account to the user, initializes referrer as None (set later).
  • Security: PDA derivation and user signature required; stops spoofed registrations.

3) set_referrer

  • Purpose: locks a referrer on-chain (one-time action).
  • Behavior: writes referrer to MinerData, then prevents changes (error on re-set); emits event.
  • Security: validates not self-referring; PDA must match miner; UI disables edits once locked.

4) claim_reward

  • Purpose: submits a valid PoW solution and pays rewards.
  • Behavior: verifies SHA-256 digest vs difficulty; pays miner; pays +3 TREZ to referrer (if set); rolls challenge; adjusts difficulty to ~180s; advances era and reduces reward on schedule; emits events; ends after final jackpot.
  • Security: strict account checks; distributor balance verified; stale or invalid shares rejected.

Security & Transparency Features

  • Immutable State: only valid claims mutate challenge/difficulty/reward.
  • PDA Ownership: State, MinerData, and Distributor are program-controlled.
  • Referral Locking: one-time set_referrer enforces integrity.
  • Dynamic Difficulty: targets ~180s solves to keep mining fair.
  • Events: initialization, rewards, difficulty/era changes all logged on-chain.
  • Final Jackpot: 10,000 TREZ payout halts mining (mining_finished=true).

Mining Application Integration

The reference app (trez_miner.py) uses Anchor’s Python client to interact with the program:

  • _load_program: loads IDL and connects with the correct program ID.
  • _ensure_registered: creates MinerData if needed, with retries.
  • _lock_referrer_onchain: sets referrer and disables edits.
  • _mine_loop: finds nonces, submits claim_reward, handles stale shares/fees.
  • _refresh_loop: polls state (challenge/difficulty/reward/era) for fresh work.

TREZ Vesting Contract: Locked Token Distribution

  • Program ID: 5qD4qAqMPg2yUTDjMLF1Ys5piDwX7aYpT8hPFA8Jz2s7 (mainnet, immutable)

Key Accounts

  • Vault PDA: holds TREZ under vesting program control.
  • Linear Vesting: DEV schedule with start/cliff/end and totals.
  • Tranche Vesting: SALES schedule with up to 32 unlocks.

Instructions

1) initialize_linear_vesting

  • Creates vault and linear vesting account; tokens unlock gradually from start→end.
  • Security: PDA ownership and beneficiary checks; tokens inaccessible outside schedule.

2) claim_linear

  • Beneficiary claims vested amount to their TREZ ATA.
  • Security: signature-verified; releases strictly per schedule.

3) initialize_tranche_vesting

  • Creates vault and a tranche schedule (time/amount pairs).
  • Security: validates tranche data; PDA-owned vault.

4) claim_tranches

  • Transfers unlocked tranches to beneficiary’s ATA and marks them claimed.
  • Security: signature-verified; only at unlock times.

Verification with proveVesting.ts

A TypeScript script checks vault ownership, vesting configuration, mint authority (None), and claimable amounts for public transparency.

cd scripts
npx ts-node proveVesting.ts --dev=DevPubkey --sales=SalesPubkey

Locked & Secure Aspects for Investors and Miners

  1. Immutable Contracts: Mining and vesting are deployed on mainnet with fixed Program IDs.
  2. Token Supply Security: TREZ mint authority is None; supply is fixed (genesis + final jackpot).
  3. Mining Fairness: Dynamic difficulty targets ~180s per block; +3 TREZ referral is on-chain and conditional on valid claims; mining ends after the jackpot.
  4. Transparency: All key actions emit events verifiable on explorers; vesting can be proven with read-only checks.
  5. User Protections: The app guards secrets, checks balances, and disables risky actions until safe.
  6. Referral Integrity: One-time on-chain lock; UI shows locked state and real-time counts.

Mining Application: User Experience for Miners

  • Wallet Management: create/import with secure local storage.
  • Mining Controls: start/stop with live hashrate, shares, balances.
  • Referrer Locking: set once; then marked 🔒 in the UI.
  • Transactions: send SOL/TREZ with confirmations and logs.
  • Fees: configurable priority fees and limits with autoscaling on failures.
  • Logs: clear feedback (e.g., “🎉 Nonce found!”, “🟢 Confirmed”).

Assurance for Investors & Miners

  • Fixed Supply: enforced on-chain; no mint authority.
  • Locked Distribution: vesting contracts release only per schedule.
  • Fair Mining: difficulty and referrals enforced by code, not promises.
  • Secure App: wallet safety, UI locks, clear errors.
  • Auditable Code: program and app sources are reviewable.
  • Mainnet Live: PDAs/events verifiable on explorers.

Next Steps for Verification

# Verify vesting setup (public, read-only)
cd scripts
npx ts-node proveVesting.ts --dev=DevPubkey --sales=SalesPubkey
  • Inspect On-Chain State: check State, MinerData, Distributor PDAs and vesting vaults on explorers.
  • Test the App: run trez_miner.py with a funded wallet; confirm claims and referrer logic.
  • Audit Source: review programs/trez-mining/src/lib.rs, programs/trez-vesting/src/lib.rs, and mining-app/trez_miner.py.

This overview is informational and not financial advice. Always validate program IDs and account addresses before interacting on-chain.