Skip to content

voidchain-net/slice-contracts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VoidChain Slice Contracts (TRC100)

Modular Blockchain Infrastructure for Infinite-Dimensional Metaspaces

WebsiteArchitectureContractsGovernance


Table of Contents


Overview

This repository contains the TRC100 Slice Contract Specification for the VoidChain blockchain ecosystem. These smart contracts form the foundational layer for managing metaspaces (slices) — isolated, modular blockchain environments that can operate independently while maintaining interoperability with the main chain.

The TRC100 standard is the sole pathway for slice management on the VoidChain mother chain, serving as the unique operational contract for each slice and determining its entire lifecycle.


What is VoidChain?

VoidChain is a next-generation modular blockchain infrastructure designed to address scalability, security, and modularity challenges in decentralized systems. Its architecture introduces:

Feature Description
Vacuum-Isolated Metaspaces Complete isolation of execution environments, preventing cross-metaspace leakage
AI-Managed Trust Autonomous management of private key delegation, trust scoring, and access control
Proof-of-Trust (PoT) Novel consensus combining AI-audited behavior, time-based staking, and probabilistic finality
Modular Architecture Customizable execution logic, consensus parameters, and permission models

Key Applications

  • AI-integrated infrastructures
  • Secure IoT systems
  • Confidential smart contracts
  • High-frequency GameFi platforms
  • Real World Asset (RWA) tokenization

TRC100 Standard

The TRC100 specification defines how slices (metaspaces) are created, managed, and governed on VoidChain. Each operational entity can implement different attributes and capabilities through the TRC100 interfaces according to their development needs.

Core Principles

  1. Modularity: Each slice operates as an independent unit with its own governance
  2. Interoperability: Cross-chain asset transfer between slices
  3. Decentralized Governance: DAO-based proposal and voting system
  4. Incentive Alignment: Mining rewards and token locking mechanisms
  5. Upgradeability: Contract upgrade proposals through governance

Architecture

System Diagram

┌─────────────────────────────────────────────────────────────────────────────┐
│                           VoidChain Mother Chain                            │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │                        trc100_base.sol                               │   │
│  │                    (Base Contract - Entry Point)                     │   │
│  └────────────────────────────────┬────────────────────────────────────┘   │
│                                   │                                         │
│                                   ▼                                         │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │                          trc100.sol                                  │   │
│  │                    (Root Implementation Hub)                         │   │
│  └────────────────────────────────┬────────────────────────────────────┘   │
│                                   │                                         │
│           ┌───────────────────────┼───────────────────────┐                 │
│           │           │           │           │           │                 │
│           ▼           ▼           ▼           ▼           ▼                 │
│  ┌─────────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐           │
│  │ trc100_     │ │ trc100_ │ │ trc100_ │ │ trc100_ │ │ trc100_ │           │
│  │ slice.sol   │ │cross.sol│ │locktoken│ │propose  │ │static   │           │
│  │             │ │         │ │ .sol    │ │ .sol    │ │ .sol    │           │
│  │  Slice      │ │ Cross-  │ │ Token   │ │  DAO    │ │ Static  │           │
│  │ Management  │ │ Chain   │ │ Locking │ │Governance│ │Metaspace│           │
│  └──────┬──────┘ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘           │
│         │             │           │           │           │                 │
│         └─────────────┴───────────┴───────────┴───────────┘                 │
│                                   │                                         │
│                                   ▼                                         │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │                         trc100_miner.sol                             │   │
│  │                    (Mining & Incentive Module)                       │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘

                    ┌─────────────────────────────────────┐
                    │              Slices                 │
                    ├─────────────────────────────────────┤
                    │  ┌─────────┐ ┌─────────┐ ┌───────┐  │
                    │  │Dynamic  │ │Dynamic  │ │Static │  │
                    │  │Slice #2 │ │Slice #3 │ │Slice  │  │
                    │  │         │ │         │ │#1M    │  │
                    │  └─────────┘ └─────────┘ └───────┘  │
                    │      ...         ...        ...     │
                    └─────────────────────────────────────┘

Slice Types

VoidChain implements two distinct types of slices (metaspaces):

Type Starting ID Description Use Case
Dynamic Slices 2+ Flexible, DAO-governed spaces DApps, DeFi, GameFi
Static Slices 1,000,000+ Permissioned, node-controlled spaces Enterprise, IoT, RWA

Module Relationships

interface_trc100 ◄──────┐
       ▲                │
       │                │
       │         ┌──────┴──────┐
       │         │  trc100.sol │
       │         └──────┬──────┘
       │                │
       │    ┌───────────┼───────────┬───────────┬───────────┐
       │    │           │           │           │           │
       │    ▼           ▼           ▼           ▼           ▼
       │ interface_  interface_  interface_  interface_  interface_
       │ slice       cross       locktoken   propose     static
       │    │           │           │           │           │
       │    ▼           ▼           ▼           ▼           ▼
       │ trc100_     trc100_     trc100_     trc100_     trc100_
       │ slice.sol   cross.sol   locktoken   propose.sol static.sol
       │                           .sol
       │
trc100_base.sol ──────► External Entry Point for Users

Contracts

Core Contracts

trc100.sol - Root Contract

Purpose: The central hub that coordinates all TRC100 modules. Acts as the implementation layer between the base contract and specialized modules.

Key Features:

  • Initializes and connects all module contracts
  • Routes function calls to appropriate modules
  • Enforces access control between modules
  • Manages contract upgrade lifecycle

Core Functions:

Function Description
InitAnyTrc100() Initialize all module addresses
trc100Addr() Query all contract addresses
upateTrc100() Upgrade contract implementation
applyslice() Apply for a new dynamic slice
applyStaticSlice() Apply for a new static slice

State Variables:

address public sliceAddr;       // Slice management contract
address public lockAddr;        // Token locking contract
address public proposeAddr;     // Proposal/governance contract
address public trc100Root_addr; // Root contract address
address public staticAddr;      // Static slice management
address public crossAddr;       // Cross-chain transfer contract

trc100_base.sol - Base Contract

Purpose: The primary entry point for external interactions. Provides a stable API while allowing implementation upgrades through the DAO governance system.

Key Features:

  • User-facing interface for all TRC100 operations
  • Nonce-based replay protection for critical operations
  • Separates interface from implementation for upgradeability
  • Stores fundamental slice metadata (name, number, type)

Slice Information Storage:

uint256 private sliceno;     // Unique slice identifier
uint256 private slicetype;   // 1 = Dynamic, 2 = Static
bytes32 private name;        // Human-readable slice name

Core User Functions:

Function Description
initslice() Initialize slice with name, number, and type
slice() Query slice information
trc100_applyslice() Apply for dynamic slice creation
trc100_applyStaticSlice() Apply for static slice creation
trc100_lockToken() Lock platform tokens
trc100_submitpropose() Submit governance proposal
trc100_voteing() Vote on active proposals
trc100_runpropose() Execute approved proposals
trc100_transsend() Initiate cross-chain transfer

Functional Modules

trc100_slice.sol - Slice Management

Purpose: Manages the lifecycle of dynamic and static slices, including creation, weight configuration, and RWA platform integration.

Key Features:

  • Dynamic slice creation with auto-incrementing IDs (starting at 2)
  • Static slice creation with IDs starting at 1,000,000
  • Mining pool weight configuration per slice
  • RWA (Real World Asset) platform management

Data Structures:

struct Slices {
    address submit;     // Applicant address
    uint256 timeval;    // Creation timestamp
    uint256 sliceno;    // Unique slice number
    uint256 weight;     // Mining pool weight
}

Core Functions:

Function Description
applyslice() Create new dynamic slice
applyStaticSlice() Create new static slice
setSliceWeight() Configure mining weight
checkslice() Verify slice validity
addRwaMiner() Register RWA platform
removeRwaMiner() Unregister RWA platform
QuerySliceInfo() List slice details
QueryRWAInfo() List RWA platforms

trc100_cross.sol - Cross-Chain Module

Purpose: Handles asset transfers between different slices (metaspaces), enabling interoperability across the VoidChain ecosystem.

Key Features:

  • Secure cross-slice asset transfers
  • Transaction tracking with nonce-based identification
  • Source and destination slice verification
  • Integration with external token contracts via interface_crossProcess

Transaction Flow:

Source Slice                                    Destination Slice
    │                                                   │
    │  1. transsend()                                   │
    │  ───────────────────────────────────────────►     │
    │  (Lock tokens, record transaction)                │
    │                                                   │
    │  2. authsend()                                    │
    │  ◄───────────────────────────────────────────     │
    │  (Verify transaction exists)                      │
    │                                                   │
    │  3. transrecv()                                   │
    │  ───────────────────────────────────────────►     │
    │  (Mint/unlock tokens on destination)              │
    │                                                   │

Data Structure:

struct Trans {
    bool avail;         // Transaction validity flag
    address conaddr;    // Contract address involved
    uint256 amount;     // Transfer amount
}

// Mapping: destSlice => operator => nonce => Transaction
mapping(uint256 => mapping(address => mapping(uint256 => Trans))) public sender;
mapping(uint256 => mapping(address => mapping(uint256 => Trans))) public recv;

Core Functions:

Function Description
transsend() Initiate outbound transfer
authsend() Verify outbound transaction
transrecv() Process inbound transfer

trc100_locktoken.sol - Token Lock Module

Purpose: Enables voluntary token locking for staking, vesting, and governance participation. Supports both linear and cliff-based release schedules.

Key Features:

  • Flexible lock duration (days)
  • Two release types: daily linear release or lump-sum at maturity
  • One active lock per address
  • Query interface for all locked tokens

Lock Types:

Type Value Description
Daily Release 0 Tokens released linearly each day
Cliff Release 1 All tokens released at end of period

Data Structure:

struct Token {
    address addr;       // Token holder
    uint256 begin;      // Lock start timestamp
    uint256 nums;       // Amount locked
    uint256 ldays;      // Lock duration in days
    uint256 ltype;      // Release type (0: daily, 1: cliff)
}

Core Functions:

Function Description
lockToken() Create new token lock
lockTokenInfo() Query all lock information
unlockToken() Release tokens after maturity

trc100_propose.sol - DAO Governance

Purpose: Implements a decentralized governance system with proposal submission, weighted voting, and automated execution.

Key Features:

  • Six proposal types for different governance actions
  • Token-weighted voting mechanism
  • Minimum thresholds for voting and proposal submission
  • Time-locked proposals (minimum 3 days)
  • Automated pass/fail determination based on vote weights

Proposal Types:

Type Value Description
Token Pool Transfer 0 Transfer from foundation/community pools
Gas Price Adjustment 1 Modify transaction costs
Network Upgrade 2 Main network code upgrades
Contract Upgrade 3 TRC100 contract upgrades
Miner Incentives 4 Token distribution to miners
DAO Management 5 General governance proposals

Proposal Lifecycle:

┌──────────────┐      ┌──────────────┐      ┌──────────────┐      ┌──────────────┐
│   Submit     │ ───► │   Voting     │ ───► │  Validate    │ ───► │   Execute    │
│   Proposal   │      │   Period     │      │  Threshold   │      │   (or Fail)  │
└──────────────┘      └──────────────┘      └──────────────┘      └──────────────┘
     │                      │                      │                      │
     │ - Content hash       │ - Min 3 days        │ - Pass > Reject      │ - On-chain
     │ - Target address     │ - Token-weighted    │ - Pass > 1% total    │   action
     │ - Duration           │ - Pass/Reject       │ - InitSender voted   │
     └──────────────────────┴──────────────────────┴──────────────────────┘

Data Structures:

struct propose {
    uint256 ltype;          // Proposal type (0-5)
    address submit;         // Proposer address
    uint256 status;         // Current status
    uint256 pno;            // Proposal number
    uint256 sliceno;        // Affected slice
    address contentAddr;    // Target address
    bytes32 contentMark;    // Content hash/IPFS
    uint256 ldays;          // Voting duration
    uint256 timeval;        // Submission time
}

struct vote {
    uint256 no;             // Proposal number
    address[] pass;         // Approving voters
    address[] rjuest;       // Rejecting voters
}

Core Functions:

Function Description
submitpropose() Submit new proposal
voteing() Cast weighted vote
runpropose() Execute mature proposal
QueryPropose() Query proposal status
queryVoteInfo() Get vote counts and weights
removepropose() Cancel own proposal

trc100_static.sol - Static Metaspace Module

Purpose: Manages static slices with permissioned node access and custom incentive mechanisms. Designed for enterprise and IoT applications.

Key Features:

  • Node ID-based access control (whitelisting)
  • Custom coinbase/incentive contract configuration
  • Batch node management (add/remove multiple)
  • Isolated execution environment

Data Structure:

struct Node {
    bytes32 markid;     // Unique node identifier
    bytes32 cotnent;    // Node metadata/description
}

Core Functions:

Function Description
addnode() Register single authorized node
addnodes() Batch register nodes
delnode() Remove node authorization
delnodes() Batch remove nodes
nodeinfo() Query registered nodes
SetCoinbase() Configure incentive contract
CoinbaseOf() Query incentive contract

trc100_miner.sol - Mining & Rewards

Purpose: Manages the energy/gas economics and block reward distribution for static slices.

Key Features:

  • Transaction energy verification
  • Configurable gas pricing
  • Block reward configuration
  • Miner reward distribution

Incentive Contract Interface:

The coinbase contract must implement:

function CanSubmitTrans(address sender, uint256 txlen) returns(bool)  // Verify energy
function RunTrans(uint256 txlen) returns(bool)                         // Deduct energy
function SetGasPrice(uint256 v1, uint256 v2) returns(bool)            // Set gas price
function SetMinerPrice(uint256 v1) returns(bool)                       // Set block reward
function AllocMiner(address[] addrs, uint256[] nums) returns(bool)    // Distribute rewards

Core Functions:

Function Description
Trc100_CanSubmitTrans() Check transaction eligibility
Trc100_RunTrans() Process transaction energy
SetGasPrice() Configure energy costs
SetMinerPrice() Set block rewards
Trc100_AllocMiner() Distribute miner rewards

Token Contract

trc20.sol - Token Implementation

Purpose: Basic token contract supporting cross-chain operations within the TRC100 ecosystem.

Key Features:

  • Standard balance tracking
  • Parent contract authorization for transfers
  • Cross-chain send/receive integration
  • One-time supply initialization

Core Functions:

Function Description
InitAmount() Initialize total supply
transsend() Deduct for cross-chain transfer
transrecv() Credit for cross-chain receive
balanceOf() Query account balance
Info() Get supply and parent info

Interface Contracts

All interfaces follow a modular design pattern enabling loose coupling:

Interface Purpose
interface_trc100.sol Main TRC100 standard interface
interface_base.sol Base contract upgrade interface
interface_slice.sol Slice management operations
interface_cross.sol Cross-chain transfer operations
interface_crossProcess.sol Token contract cross-chain hooks
interface_locktoken.sol Token locking operations
interface_propose.sol Governance proposal operations
interface_static.sol Static slice node management
interface_miner.sol Mining incentive interface

Governance System

Proposal Types

┌─────────────────────────────────────────────────────────────────────────────┐
│                          PROPOSAL TYPES                                      │
├───────┬─────────────────────────────────────────────────────────────────────┤
│ Type  │ Description                                                          │
├───────┼─────────────────────────────────────────────────────────────────────┤
│   0   │ Token Pool Transfer - Move tokens from foundation/community pools   │
│   1   │ Gas Price Adjustment - Modify transaction costs                     │
│   2   │ Network Upgrade - Main chain code updates                           │
│   3   │ Contract Upgrade - TRC100 implementation changes                    │
│   4   │ Miner Incentives - Token reward distribution                        │
│   5   │ DAO Management - General governance decisions                       │
└───────┴─────────────────────────────────────────────────────────────────────┘

Voting Mechanism

  1. Token-Weighted Voting: Votes are weighted by the voter's token holdings
  2. Minimum Thresholds:
    • Submit: limitsubmit tokens (default: 10,000)
    • Vote: limitvote tokens (default: 10,000)
  3. Pass Conditions:
    • Pass votes > Reject votes (by token weight)
    • Pass votes ≥ 1% of total supply
    • Original deployer must approve (security measure)

Proposal Lifecycle

Submit ──► Voting Period (min 3 days) ──► Threshold Check ──► Execute/Fail
   │              │                              │                 │
   └──────────────┴──────────────────────────────┴─────────────────┘
                           Can query status at any stage

Cross-Chain Operations

Cross-slice asset transfers follow a three-phase commit process:

Phase 1: Send (Source Slice)

// User initiates transfer to destination slice
trc100_transsend(destAddress, amount, destSliceNo, nonce)

Phase 2: Authenticate

// Verify transaction was recorded on source
trc100_authsend(sourceAddress, nonce, tokenContract, destSliceNo)

Phase 3: Receive (Destination Slice)

// Mint/credit tokens on destination slice
trc100_transrecv(sourceAddress, nonce, tokenContract, amount, sourceSliceNo)

Token Economics

Token Locking Benefits

  • Governance Power: Locked tokens count toward voting weight
  • Staking Rewards: Potential mining rewards for long-term holders
  • Commitment Signaling: Demonstrates ecosystem commitment

Release Options

Option Description
Linear Daily proportional release over lock period
Cliff Full release at end of lock period

RWA Integration

VoidChain supports Real World Asset tokenization through dedicated platform management:

// Register RWA platform
trc100_addRwaMiner(platformAddress)

// Query registered platforms
QueryRWAInfo(startIndex, count)

// Remove platform
trc100_removeRwaMiner(platformAddress)

RWA platforms can participate in mining rewards based on their slice weight configuration.


Security Model

Access Control Layers

┌────────────────────────────────────────────────────────────────┐
│                     User/External Call                         │
└────────────────────────────────┬───────────────────────────────┘
                                 │
                                 ▼
┌────────────────────────────────────────────────────────────────┐
│                   trc100_base.sol                              │
│            (Entry validation, nonce checks)                    │
└────────────────────────────────┬───────────────────────────────┘
                                 │
                                 ▼
┌────────────────────────────────────────────────────────────────┐
│                      trc100.sol                                │
│         (Module routing, cross-module auth)                    │
└────────────────────────────────┬───────────────────────────────┘
                                 │
                                 ▼
┌────────────────────────────────────────────────────────────────┐
│                   Module Contracts                             │
│    (Function-specific access: InitSender, trc100_addr)         │
└────────────────────────────────────────────────────────────────┘

Key Security Features

  1. InitSender Pattern: Original deployer retained for critical operations
  2. Nonce-Based Replay Protection: Prevents duplicate transaction execution
  3. Multi-Layer Authorization: Module calls verified at each layer
  4. DAO Governance for Upgrades: No single-point-of-failure for contract changes
  5. Threshold Requirements: Prevents proposal spam and low-participation decisions

Deployment

Deployment Order

  1. Deploy individual modules:

    trc100_slice.sol
    trc100_cross.sol
    trc100_locktoken.sol
    trc100_propose.sol
    trc100_static.sol
    trc100_miner.sol (if static slice)
    
  2. Deploy root contract:

    trc100.sol
    
  3. Initialize root with module addresses:

    InitAnyTrc100(
        baseAddr,
        sliceAddr,
        lockAddr,
        proposeAddr,
        staticAddr,
        crossAddr
    )
  4. Deploy base contract:

    trc100_base.sol
    
  5. Link base to root:

    upateTrc100(trc100RootAddress)
  6. Initialize slice metadata:

    initslice(name, sliceNumber, sliceType)

License

All contracts are licensed under GPL-3.0.

SPDX-License-Identifier: GPL-3.0

VoidChain — Building the Infrastructure for Infinite-Dimensional Metaspaces

Learn More

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors