VHASH System Technical Analysis

1. System Overview

VHASH is a virtual mining system running on the blockchain. It simulates the mechanics of physical hardware mining but uses NFTs as “miners”. Each NFTminer has a property called vhash (Virtual Hashrate), which determines its mining power relative to the total network.

Users acquire these NFT miners, which then accrue VTOKENS over time based on a block-based epoch system. The system entails separating business logic, data storage, and the NFT assets themselves into distinct contracts to ensure upgradability and separation of concerns.

2. System Architecture

The system is composed of three main layers:

A. NFT Layer (Assets)

This layer consists of the ERC721 contracts that users interact with to mint miners.

  • NFTProtominter.sol: Manages “ProtoMiners”, which are standardized miners with fixed attributes (Name, Image, Price, VHash). Users pay ETH to mint these.
  • NFTCustomProtoMiner.sol: Allows for more flexible miner creation, likely for administrative or special use cases.
  • These contracts call into the Logic Layer to register new miners upon minting.

B. Logic Layer (Business Rules)

  • NFTLoyalty.sol: This is the brain of the operation. It handles:
    • Onboarding: Registering new NFTs as miners (addMiner).
    • Upgrades: Adding more vhash to existing miners (addVhash).
    • claiming: Calculating and distributing rewards (claimToken).
    • Designees: Managing delegation of mining rights.
  • It does not store persistent state about the miners; it relies on the Storage Layer for that.

C. Storage Layer (State)

  • NFTLoyalStore.sol: Acts as the database for the system.
    • Stores all Miner structs (owner, vhash, claimed balance, etc.).
    • Tracks Epoch data (total vhash per epoch, tokens per epoch).
    • Holds the configuration for costs and limits.
    • Holds the VTOKEN supply and transfers it to users upon instruction from the Logic Layer.
  • VToken.sol: The ERC20 reward token contract.

3. Core Mechanisms

Virtual Mining Process

  1. Mining Power (VHASH): Every miner has a vhash value. The contract tracks the vhashTotal of the entire network.
  2. Epochs: Time is divided into “Epochs” (defined by a number of blocks, originally 216,904).
    • Each epoch has a fixed amount of VTOKEN allocated to it (TOKENS_PER_EPOCH).
  3. Reward Calculation:
    • A miner’s share of the epoch’s rewards is proportional to their share of the total hashrate: $$ Reward = \frac{MinerVHash \times EpochTokens}{TotalNetworkVHash} $$
    • When a user claims, the system calculates rewards for all fully passed epochs since their last claim, plus the partial progress in the current epoch.

Onboarding & Minting (NFT Uploading)

The process of “uploading” an NFT into the VHASH system involves registering the NFT as an active miner. This is a critical step that links the ERC721 asset to the internal mining logic.

  1. Minting/creation: User calls mint on NFTProtominter or NFTCustomProtoMiner.
  2. Registration Call: The minting contract automatically calls addMiner on the NFTLoyalty contract.
    • It passes the new NFT’s address, token ID, and initial VHash.
  3. State Upload: NFTLoyalty verifies the request and calls NFTLoyalStore.registerMiner.
    • This effectively “uploads” the miner’s data (Owner, VHash, ID) into the permanent storage of the system.
    • Once uploaded, the NFT is recognized as a miner and begins accruing VTOKENS starting from the current block height.
  4. Metadata Handling: For NFTCustomProtoMiner, image data and attributes can be passed during the minting process (multicallMint), allowing for dynamic “uploading” of visual assets directly to the chain state (as data URIs).

Custom VHASH NFT Minting

The system supports the creation of unique, user-generated miners through the NFTCustomProtoMiner contract. This feature allows users to “upload” their own visual assets to be used as the NFT image.

  • Asset Support: The system accepts static images or video content as the visual representation of the miner.
  • On-Chain Metadata:
    • During the multicallMint process, the system accepts a full data URI string (e.g., data:image/png;base64,… or a URL).
    • This URI is stored directly in the contract mapping tokenImageURIs.
    • The tokenURI function dynamically generates the JSON metadata, embedding this custom URI into the image field.
  • Flexibility: This design decouples the visual asset from the mining logic. As long as the URI is valid, the VHASH system can render any visual content (image or video) associated with the mining power.

Claiming Rewards

  • Users call claimToken on NFTLoyalty.
  • The contract iterates through the provided list of NFTs.
  • It calculates pending rewards by iterating through historical epochs stored in NFTLoyalStore.
  • It updates the “last claimed block” for the miner.
  • Finally, it instructs NFTLoyalStore to transfer result VTOKENS to the user.

4. Key Security & Design Features

  • Separation of Concerns: Logic can be upgraded by deploying a new NFTLoyalty contract without losing the state stored in NFTLoyalStore.
  • Multi-Signature Admin Controls: The system employs a decentralized governance model for sensitive actions (e.g., updating contract addresses, changing variables).
    • Admin.sol and the minting contracts implement a voting mechanism.
    • Changes require a specific number of approvals (REQUIRED_VOTES, defined in the Store) from authorized admins before they are executed.
    • This prevents a single compromised admin key from altering critical system parameters.
  • Designee System: Allows a miner’s owner to designate another address to manage the miner, adding flexibility for custody or management services.