VHASH System Technical Analysis

1. System Overview
VHASH, https://vhash.xyz, is a virtual mining system running on the Ethereum mainnet 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.
To ensure long-term upgradability, modularity, and separation of concerns, the system is architected using EIP-2535 (Diamond Standard) principles. Business logic is decomposed into independent facets, while state is centralized and persistent. This allows the protocol to evolve over time (new mining mechanics, reward logic, or administrative controls) without migrating user assets or redeploying the entire system.
2. System Architecture
The system is composed of three primary layers, implemented through a Diamond-based contract architecture.
Diamond Core (EIP-2535)
At the center of the system is a Diamond proxy contract, which:
- Acts as the single entry point for protocol interactions
- Routes function calls to specific Facet contracts
- Preserves a stable contract address for integrations, NFTs, and users
- Enables atomic upgrades by adding, replacing, or removing facets
All logic described below is either implemented as a facet or interacts with facets through the Diamond.
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 – Diamond Facet)
- 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 – Diamond Storage)
- 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
- Mining Power (VHASH): Every miner has a vhash value. The contract tracks the vhashTotal of the entire network.
- 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).
- 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.
4. Why EIP-2535 Matters in VHASH
Using the Diamond Standard provides several concrete benefits:
- Upgradeable Mining Economics – Reward formulas, epoch timing, or delegation logic can evolve without redeploying NFTs or breaking integrations.
- Operational Safety – Bugs or inefficiencies can be patched by replacing a facet rather than migrating the entire system.
- Protocol Longevity – VHASH can add new miner types, staking mechanics, or secondary reward layers over time.
- Clean Separation of Concerns – NFTs remain assets, facets remain logic, and storage remains stable and auditable.
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.
- Minting/creation: User calls mint on NFTProtominter or NFTCustomProtoMiner.
- Registration Call: The minting contract automatically calls addMiner on the NFTLoyalty contract.
- It passes the new NFT’s address, token ID, and initial VHash.
- 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.
- 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.
