Abstract
GoldXCoin (GXC) is a next-generation blockchain implementing a hybrid Proof-of-Work (PoW) and Proof-of-Stake (PoS) consensus mechanism with advanced fraud detection, transaction traceability, and autonomous reversal capabilities. This whitepaper presents the complete mathematical foundations, cryptographic algorithms, consensus protocols, and security mechanisms as implemented in the C++ node software.
The system introduces novel concepts including:
- Proof of Traceability (POT) — Mathematical taint propagation for fraud detection
- Proof of Feasibility (POF) — Cryptographic proofs for safe transaction reversals
- Hybrid Consensus — Alternating PoW and PoS blocks for security and energy efficiency
- Multi-Algorithm Mining — Support for SHA-256, Ethash, and GXHash algorithms
- Self-Sustaining Fraud Detection — Automatic fee-based funding for security operations
- Gold-Backed Token GXC-G — 100% reserve-backed, audited gold token
- On-Chain Governance — Stake-weighted proposals, voting, and parameter changes
- Proof of Price (PoP) Oracle — Multi-oracle consensus for reliable price feeds
- Cross-Chain Bridge — 6 chains, 67% multi-sig threshold
Introduction
1.1 · Design Philosophy
GXC addresses three fundamental blockchain challenges:
Hybrid consensus balances proof-of-work security with proof-of-stake efficiency
Fraud detection enables reversals without compromising immutability
Full traceability for fraud detection while maintaining pseudonymity
1.2 · System Parameters
MAX_SUPPLY = 31,000,000 GXC HALVING_INTERVAL = 1,051,200 blocks (~4 years) INITIAL_BLOCK_REWARD = 50.0 GXC TARGET_BLOCK_TIME = 600 seconds (10 minutes) DIFFICULTY_ADJUSTMENT_INTERVAL = 2016 blocks (~2 weeks) MAX_BLOCK_SIZE = 1,048,576 bytes (1 MB) MIN_TESTNET_DIFFICULTY = 1.0 MIN_MAINNET_DIFFICULTY = 1000.0
1.3 · Network Architecture
RPC: 8332
REST: 8080
Magic: "GXC\x01"
Protocol: 70015
RPC: 18332
REST: 18080
Magic: "GXCT"
Protocol: 70015
Mathematical Foundations
2.1.1 · SHA-256
2.1.2 · Keccak-256
2.1.3 · RIPEMD-160
2.2.1 · secp256k1 Elliptic Curve
2.2.2 · ECDSA Key Generation & Signing
Cryptographic Primitives
3.1 · Block Hashing
3.2 · Merkle Root
std::string calculateMerkleRoot(std::vector<std::string> txHashes) {
if (txHashes.empty()) return "0000...";
if (txHashes.size() == 1) return txHashes[0];
while (txHashes.size() > 1) {
std::vector<std::string> newLevel;
for (size_t i = 0; i < txHashes.size(); i += 2) {
std::string left = txHashes[i];
std::string right = (i+1 < txHashes.size()) ? txHashes[i+1] : left;
newLevel.push_back(keccak256(left + right));
}
txHashes = newLevel;
}
return txHashes[0]; // O(log n) inclusion proofs
}3.3 · Work Receipt (PoW Binding)
Consensus Mechanisms
4.1 · Hybrid Block Selection (Animated)
BlockType Blockchain::getNextBlockType() const {
uint32_t nextHeight = getHeight();
if (nextHeight % 2 == 0) return BlockType::PROOF_OF_WORK;
if (getActiveValidators().empty()) return BlockType::PROOF_OF_WORK;
return BlockType::PROOF_OF_STAKE;
}4.2.1 · PoW Difficulty Target
4.2.2 · Difficulty Adjustment (every 2016 blocks)
4.2.3 · Security-Adjusted Difficulty
4.3.1 · PoS Validator Selection
double Validator::getWeightedStake() const {
if (!isActive) return 0.0;
return stakeAmount * std::pow(static_cast<double>(stakingDays)/365.0, BETA);
}
Validator Blockchain::selectValidatorForBlock() const {
std::mt19937_64 rng(getHeight()); // deterministic seed
std::uniform_real_distribution<double> dist(0.0, totalWeightedStake);
double threshold = dist(rng);
double cumulative = 0.0;
for (const auto& v : activeValidators) {
cumulative += v.getWeightedStake();
if (cumulative >= threshold) return v;
}
return activeValidators.back();
}4.3.2 · PoS Block Validation Requirements
bool Blockchain::validateProofOfStake(const Block& block) const {
// 1. Validator exists and is active
// 2. hasMinimumStake(100 GXC)
// 3. stakingDays ∈ [14, 365]
// 4. validator.verifySignature(block.getHash(), signature) == true
// 5. meetsTarget(block.getHash(), 0.01) // much easier than PoW
return true;
}Transaction Model & Traceability
5.1 · UTXO Model
struct TransactionOutput {
std::string address; // Recipient
double amount; // Value in GXC
std::string script; // Locking script
};
// UTXO Set: Map<TxHash_OutputIndex, TransactionOutput>
std::unordered_map<std::string, TransactionOutput> utxoSet;
// UTXO Key format:
utxoKey = TxHash || "_" || OutputIndex5.2 · Transaction Structure
class Transaction {
std::string txHash;
TransactionType type; // NORMAL | STAKE | UNSTAKE | REWARD | COINBASE | REVERSAL
std::vector<TransactionInput> inputs;
std::vector<TransactionOutput> outputs;
std::time_t timestamp;
// Proof of Traceability fields
std::string prevTxHash; // Hash of Tᵢ₋₁
double referencedAmount; // Amount from Tᵢ₋₁
std::string senderAddress;
std::string receiverAddress;
uint32_t nonce;
// Work receipt (COINBASE only)
std::string workReceiptHash;
uint32_t blockHeight;
double fee;
std::string memo;
};5.3 · Proof of Traceability (POT)
5.4 · Input-Output Balance Invariant
Fraud Detection System
6.1 · Taint Propagation — BFS on the Transaction DAG (Animated)
// BFS Taint Propagation
void FraudDetection::propagateTaint(const std::string& startTx, uint32_t maxHops) {
std::queue<std::pair<std::string, uint32_t>> queue;
queue.push({startTx, 0});
while (!queue.empty()) {
auto [currentTx, depth] = queue.front(); queue.pop();
if (depth >= maxHops) continue;
if (taintMap[currentTx].taintScore < TAINT_THRESHOLD) continue;
for (const auto& desc : blockchain->getDescendantTransactions(currentTx)) {
double t = calculateTaint(blockchain->getTransaction(desc));
if (t > 0) { taintMap[desc] = TaintInfo(t, ...); queue.push({desc, depth+1}); }
}
}
}6.2 · Five Detection Rules
Rapid fund movement indicative of laundering
Splitting funds into many small outputs
Combining split tainted funds (layering)
Stolen funds held dormant then suddenly moved
Tainted funds entering regulated zones
6.3 · Alert Levels
AlertLevel calculateAlertLevel(double taintScore, uint32_t ruleViolations) {
if (taintScore >= 0.8 || ruleViolations >= 3) return CRITICAL; // 🔴
if (taintScore >= 0.5 || ruleViolations >= 2) return HIGH; // 🟠
if (taintScore >= 0.1 || ruleViolations >= 1) return MEDIUM; // 🟡
return LOW; // 🟢
}
Constants:
TAINT_THRESHOLD = 0.1 (δ)
HIGH_TAINT = 0.5
CRITICAL_TAINT = 0.8
VELOCITY_EPSILON = 300 s
FAN_OUT_K = 5
RE_AGG_THETA = 0.7
DORMANCY_PERIOD = 604800 s (7 days)Reversal System
7.1 · Proof of Feasibility (POF) — Animated Pipeline
7.1 · POF Structure
struct ProofOfFeasibility {
std::string proof_type; // "REVERSAL_PROOF"
std::string stolen_tx; // Original stolen tx
std::string current_tx; // Current holding tx
std::vector<std::string> trace_path; // Full taint path
double taint_score; // τ ∈ [0,1]
uint64_t recoverable_amount; // R = τ × balance
std::string origin_owner; // Victim address
std::string current_holder; // Current holder
std::string approved_by; // Admin ID
std::string approval_signature; // Admin ECDSA sig
uint64_t timestamp;
uint64_t block_height;
std::string proof_hash; // Hash(entire proof)
};7.2 · Recoverable Amount Formula
7.3 · Proof Generation Algorithm
ProofOfFeasibility ProofGenerator::generateProof(
stolen_tx, current_holder, admin_id, admin_signature) {
// 1. Verify stolen_tx is marked as stolen
if (!fraudDetection->isStolen(stolen_tx)) return {};
// 2. Taint score must meet threshold
auto taintInfo = fraudDetection->getTaintInfo(currentHolderTx);
if (taintInfo.taintScore < MIN_TAINT_THRESHOLD) return {};
// 3. Within reversal window (20,000 blocks)
if (currentHeight - stolenHeight > REVERSAL_WINDOW) return {};
// 4. Calculate recoverable amount
uint64_t recoverable = calculateRecoverableAmount(
currentHolderTx, currentHolder, taintInfo.taintScore);
// 5. Build + hash proof
proof.proof_hash = generateProofHash(proof);
return proof;
}7.4 · Reversal Execution Steps
7.5 · Self-Sustaining Fee Pool
Staking & Validator Economics
8.1 · Staking Pool Entry Structure
struct StakeEntry {
std::string stakeId;
std::string ownerAddress;
std::string validatorAddress;
double amount;
uint64_t lockStartTime;
uint32_t lockPeriodDays; // [7, 365]
bool isLocked;
double accumulatedRewards;
// Traceability (linked to POT)
std::string stakeTxHash;
std::string previousTxHash;
std::vector<std::string> inputTxHashes;
};
const uint32_t MIN_LOCK_PERIOD_DAYS = 7;
const uint32_t MAX_LOCK_PERIOD_DAYS = 365;
const double MIN_STAKE_AMOUNT = 10.0; // GXC8.2 · Validator Requirements
bool Validator::isValidValidator() const {
return hasMinimumStake(100.0) &&
isStakingPeriodValid() && // days ∈ [14, 365]
isActive &&
!isSlashed;
}8.3 · APY Calculation
8.4 · Validator Pool Statistics
struct ValidatorPoolStats {
double ownStake; // Validator's own stake
double totalDelegated; // Delegated from others
double totalStake; // ownStake + totalDelegated
uint32_t delegatorCount;
uint32_t blocksProduced; // Performance metric
uint32_t missedBlocks; // Slashing trigger
double totalRewardsDistributed;
};Mining Algorithms
9.1 · SHA-256 (Bitcoin-Style)
9.2 · Ethash (Memory-Hard, Ethereum-style)
class EthashAlgorithm {
explicit EthashAlgorithm(uint64_t block_number);
bool hash_full(const uint8_t header_hash[32], uint64_t nonce,
uint8_t result[32], uint8_t mix_hash[32]);
bool verify(const uint8_t header_hash[32], uint64_t nonce,
const uint8_t expected_result[32]);
private:
void generate_cache(); // 16MB+ from seed
void generate_dataset(); // 1GB+ from cache (GPU-hard)
void calc_dataset_item(uint32_t index, uint8_t* output) const;
};9.3 · GXHash (Custom Algorithm)
GXHash is GXC's proprietary memory-hard, ASIC-resistant algorithm. Properties: memory-hard (requires significant RAM), sequential memory access (reduces GPU advantage), tunable difficulty, and fast verification. Implemented in GXHashMiner.cpp.
Network Protocol
10.1 · Message Types
enum class MessageType : uint8_t {
VERSION=0x01, VERACK=0x02, PING=0x03, PONG=0x04,
GETADDR=0x05, ADDR=0x06, GETBLOCKS=0x07, BLOCKS=0x08,
GETDATA=0x09, BLOCK=0x0A, TX=0x0B, MEMPOOL=0x0C,
GETMEMPOOL=0x0D, REJECT=0x0E, ALERT=0x0F,
MINING_WORK=0x10, MINING_SUBMIT=0x11
};10.2 · Peer Discovery & Connection Limits
// Seed Nodes
std::vector<std::string> seedNodes = {
"seed1.gxc.network:8333",
"seed2.gxc.network:8333",
"seed3.gxc.network:8333"
};
const uint32_t MAX_CONNECTIONS = 125;
const uint32_t MAX_OUTBOUND = 8;
const uint32_t PING_INTERVAL = 30; // seconds
const uint32_t PEER_TIMEOUT = 90; // seconds10.3 · Block Synchronization Algorithm
void NetworkNode::syncWithPeers() {
uint32_t ourHeight = blockchain->getHeight();
uint32_t bestHeight = getBestHeight();
if (bestHeight <= ourHeight) return; // already synced
const uint32_t BATCH_SIZE = 500;
for (uint32_t start = ourHeight+1; start <= bestHeight; start += BATCH_SIZE)
requestBlocks(std::to_string(start), BATCH_SIZE);
}Monetary Policy
11.1 · Supply Cap
11.2 · Block Reward Halving Schedule
11.3 · Difficulty Multiplier Bonus (+10% max)
11.4 · Time Bonus (+5% max)
11.5 · Final Block Reward
11.6 · Fee Economics
Security Analysis
12.1 · Attack Vectors & Mitigations
| Attack | Description | GXC Mitigation |
|---|---|---|
| 51% Attack (PoW) | Attacker controls >50% hashrate | Hybrid consensus: need >50% stake AND >50% hashrate + checkpoint system |
| Nothing-at-Stake (PoS) | Validators sign competing chains | Slashing for double-signing + deterministic selection + finality checkpoints |
| Long-Range Attack | Rewrite history from old blocks | Reversal window capped at 20,000 blocks + weak subjectivity checkpoints |
| Taint Evasion | Mixing stolen funds to dilute taint | Fan-out + re-aggregation + clean zone monitoring automatically flag attempts |
12.2 · AI-Based Security Engine
class SecurityEngine {
public:
double calculateSecurityScore();
bool detectHashrateAnomaly();
bool detectSpamAttack();
double getRecommendedFee();
// Metrics: hashrate volatility, tx spam, network partition, double-spend
};12.3 · Cryptographic Security Levels
| Algorithm | Key/Output Size | Security Level |
|---|---|---|
| SHA-256 | 256-bit | 128-bit (birthday) |
| secp256k1 | 256-bit private | 128-bit (discrete log) |
| ECDSA | 512-bit sig (r+s) | 128-bit |
| Blake2b | 256-bit | 256-bit |
| Argon2id | configurable | Very High (memory-hard) |
Implementation Specifications
13.1 · Database (LevelDB)
// Key Prefixes: "blk_" → Block data "tx_" → Transaction data "utxo_" → UTXO set "val_" → Validator data "idx_" → Indexes
13.2 · Configuration
class Config {
static bool isTestnet();
static uint32_t getTargetBlockTime(); // 600 seconds
static uint32_t getDifficultyInterval(); // 2016 blocks
static double getMinDifficulty(); // 1.0 testnet | 1000.0 mainnet
static uint64_t getMaxBlockSize(); // 1,048,576 bytes
};13.3 · Logging System
enum class LogLevel { DEBUG, INFO, WARNING, ERROR, CRITICAL };
LOG_BLOCKCHAIN(level, message); LOG_NETWORK(level, message);
LOG_SECURITY(level, message, component); LOG_MINING(level, message);13.4 · REST & RPC API Endpoints
REST API: GET /api/block/:hash GET /api/block/height/:height GET /api/transaction/:hash GET /api/balance/:address POST /api/transaction GET /api/stats GET /api/validators GET /api/mempool RPC API (JSON-RPC 2.0): getblockcount() getblock(hash) gettransaction(txid) sendtoaddress(address, amount) getbalance(address) getmininginfo() validateaddress(address)
13.5 · Build System
# Dependencies: # OpenSSL 1.1.1+ LevelDB 1.23+ Boost 1.74+ CMake 3.15+ mkdir build && cd build cmake .. make -j$(nproc) ./gxc-node
Advanced Cryptographic Algorithms
14.1 · Argon2id (Memory-Hard KDF)
void argon2id_hash(
const uint8_t* password, size_t pwdlen,
const uint8_t* salt, size_t saltlen,
uint32_t t_cost, // iterations
uint32_t m_cost, // memory in KB
uint32_t parallelism, // threads
uint8_t* out, size_t outlen
);14.2 · Blake2b (High-Speed Cryptographic Hash)
struct Blake2bContext {
uint64_t h[8]; // Hash state (512 bits)
uint64_t t[2]; // Byte counter
uint64_t f[2]; // Finalization flags
uint8_t buf[128];
size_t buflen, outlen;
};
void blake2b_init(Blake2bContext* ctx, size_t outlen);
void blake2b_update(Blake2bContext* ctx, const uint8_t* data, size_t len);
void blake2b_final(Blake2bContext* ctx, uint8_t* out);Gold-Backed Token System (GXC-G)
15.1 · Token Economics
15.2 · Gold Reserve Structure
struct GoldReserve {
std::string vaultId;
std::string vaultAddress; // Blockchain address of vault
double goldGrams; // Physical gold stored (grams)
std::string attestationHash; // Proof of reserves hash
std::time_t lastAuditTime;
std::string auditorSignature; // ECDSA signature of auditor
bool isActive;
};
isFullyBacked() = (Σ active_reserves.goldGrams ≥ totalSupply)15.3 · Mint & Burn
15.4 · Price Oracle Integration
15.5 · Transaction Chaining (same as base GXC)
// GXC-G follows same POT formula as base GXC GoldTokenTransfer.prevTxHash = lastTxHash[sender] GoldTokenTransfer.popReference = currentPriceOracleData // Attestation generation: attestation = Sign(H(vaultId || goldGrams || timestamp || purpose), vault_privateKey)
Decentralized Governance System
16.1 · Parameters
16.2 · Vote Weight & Approval
16.3 · Changeable Parameters via Governance
enum class ParameterType {
TARGET_INFLATION_RATE, TARGET_PRICE_RATIO,
ADJUSTMENT_K1, K2, K3, BASE_BURN_RATE,
MIN_STAKE, ORACLE_THRESHOLD, BRIDGE_THRESHOLD,
BLOCK_REWARD, DIFFICULTY_ADJUSTMENT
};16.4 · Proposal Structure
class Proposal {
std::string id; // H(proposer||title||timestamp||nonce)
std::string proposer;
std::vector<ParameterChange> parameterChanges;
std::time_t createdAt, votingEndsAt;
ProposalStatus status; // PROPOSED→ACTIVE→PASSED|FAILED→EXECUTED
double forVotes, againstVotes, abstainVotes;
double quorumThreshold, passThreshold;
};Proof of Price (PoP) Oracle System
17.1 · Multi-Oracle Aggregation
17.2 · Oracle Reputation System
17.3 · Proof of Price Hash
Cross-Chain Bridge
18.1 · Supported Chains & Confirmation Requirements
| Chain | Confirmations | Chain Type |
|---|---|---|
| GXC | Native | Native |
| Bitcoin (BTC) | 6 | BITCOIN |
| Ethereum (ETH) | 12 | ETHEREUM |
| BNB Smart Chain | 15 | BSC |
| Solana (SOL) | 32 | SOLANA |
| Polkadot (DOT) | 10 | POLKADOT |
18.2 · Multi-Signature Threshold
18.3 · Transfer Lifecycle
initiateTransfer(sourceChain, asset, amount, destination) → transferId = H(sourceChain||asset||amount||destination||nonce) → status: PENDING verifyAndSignTransfer(transferId, validatorId, signature) → if signatures ≥ requiredSignatures: status = READY executeTransfer(transferId) → direction IN: mintWrappedTokens(destination, amount) → direction OUT: releaseLockedTokens(destination, amount) → status: COMPLETED
Stock Contract System
19.1 · Three Legal Models
- → Price-tracking only
- → NO legal ownership
- → Cash/crypto settlement
- → Derivatives-like structure
- → 1:1 backed by real shares
- → Custodian holds physical shares
- → Optional voting/dividend rights
- → Audited reserves
- → Company-issued shares on-chain
- → Direct legal ownership
- → On company cap table
- → Full shareholder rights
19.2 · Corporate Actions
19.3 · Price Validation
19.4 · Index Value
AI-Based Security Engine
20.1 · Hashrate Sentinel
20.2 · Predictive Difficulty Guard
20.3 · Staker-Balance Modifier
20.4 · Emission Guard (Anti-Inflation)
20.5 · Fee Surge Guard
20.6 · Hybrid Penalty Logic
pow_ratio = recentPoWBlocks / (recentPoWBlocks + recentPoSBlocks)
if |pow_ratio − 0.5| > 0.3: // more than 80/20 imbalance
penalty = 1 − |pow_ratio − 0.5|
apply_penalty_to_overrepresented_side(penalty)20.7 · Attack Detection Types
hashrate > predicted × 2.0 → "51% ATTACK SUSPECTED" timeTaken < target × 0.1 → "FAST BLOCK FARMING" consecutiveFastBlocks > 10 → "BOTNET DETECTED" else → "NORMAL"
Mining Infrastructure
21.1 · Stratum Protocol
struct StratumJob {
std::string jobId, prevHash, coinbase1, coinbase2;
std::vector<std::string> merkleBranches;
std::string version, nBits, nTime;
bool cleanJobs;
double difficulty;
uint32_t height;
};
// Per-miner difficulty auto-adjustment:
if (sharesPerMinute > TARGET × 1.2): minerDifficulty *= 1.5
if (sharesPerMinute < TARGET × 0.8): minerDifficulty *= 0.7521.2 · Hardware Detection
enum class DeviceType { CPU, GPU, ASIC };
struct MiningDevice {
uint32_t id;
DeviceType type;
std::string name, vendor;
uint64_t memory; // bytes
uint32_t computeUnits; // cores/CUs
uint32_t clockSpeed; // MHz
double temperature; // Celsius
double power; // Watts
double hashRate; // H/s
};
// Supports: CPU (multi-core), NVIDIA CUDA GPUs, AMD OpenCL GPUs, ASICs21.3 · Mining Optimization
findOptimalThreadCount():
if CPU_MINING: return physicalCores // avoid hyperthreading
if GPU_MINING: return min(4, physicalCores) // GPU driver threads
findOptimalClockSpeeds(deviceId):
for clock in range(baseClock, maxClock, step=25MHz):
hashrate = benchmark(deviceId, 60s)
efficiency = hashrate / getPower(deviceId)
if efficiency > bestEfficiency: bestClock = clockWallet System
22.1 · Wallet Structure
class Wallet {
std::string privateKey; // secp256k1 256-bit
std::string publicKey; // compressed 264-bit
std::string address; // GXC address
std::string lastTxHash; // for POT chaining
// Multi-wallet support
std::unordered_map<std::string, std::string> importedAddresses;
std::unordered_map<std::string, std::string> importedPrivateKeys;
std::unordered_map<std::string, TransactionOutput> unspentOutputs;
};22.2 · Key Generation Process
22.3 · UTXO Coin Selection Algorithm
selectUTXOs(targetAmount, fee):
utxos = getUTXOs(address).sort(descending by amount)
selected = [], total = 0
for utxo in utxos:
selected.append(utxo); total += utxo.amount
if total ≥ targetAmount + fee: break
change = total − targetAmount − fee
return (selected, change)22.4 · Third-Party Wallet Integration
// Import private key:
importPrivateKey(privateKeyHex, label) →
address = deriveAddress(derivePublicKey(privateKeyHex))
importedPrivateKeys[address] = privateKeyHex
// Watch-only address:
importAddress(addr, label) →
require isValidAddress(addr)
importedAddresses[addr] = label
// Sign from specific address:
createTransactionFrom(fromAddress, toAddress, amount, fee) →
privateKey = getPrivateKeyForAddress(fromAddress)
return signTransactionWithKey(tx, privateKey)Address Registry System (Clean Zones)
23.1 · Entity Types
enum class EntityType { EXCHANGE, STAKING_POOL, MERCHANT, VALIDATOR, UNKNOWN };
struct EntityInfo {
EntityType type;
std::string name, address, website, verificationSource;
uint64_t registeredAt, lastVerified;
bool verified;
};23.2 · Integration with Fraud Detection
WebSocket Real-Time API
24.1 · Message Protocol
// Block notification:
{"type":"new_block","data":{"height":12345,"hash":"0000abc...","timestamp":1640995200,"transactions":42,"difficulty":1000.0,"miner":"GXC...","reward":50.0}}
// Transaction notification:
{"type":"new_transaction","data":{"hash":"abc123...","from":"GXC...","to":"GXC...","amount":10.5,"fee":0.001,"confirmed":false}}
// Stats update (every 10 seconds):
{"type":"blockchain_stats","data":{"height":12345,"difficulty":1000.0,"hashrate":1.5e15,"total_supply":15000000.0,"total_staked":5000000.0,"active_validators":50,"mempool_size":120}}24.2 · Subscription Model
// Client → Server:
{"action":"subscribe","topics":["blocks","transactions","stats"]}
// Server → Client:
{"status":"subscribed","topics":["blocks","transactions","stats"]}Big Integer Arithmetic (arith_uint256)
25.1 · 256-bit Integer Structure
class arith_uint256 {
private:
static constexpr int WIDTH = 8; // 8 × 32-bit = 256 bits
uint32_t pn[WIDTH];
};25.2 · Compact Difficulty Representation
25.3 · Block Proof Calculation
Database Layer — Complete LevelDB Specification
26.1 · Singleton + Network Isolation Guard
26.2 · LevelDB Tuning Parameters
options.create_if_missing = true options.paranoid_checks = true options.max_open_files = 100 options.write_buffer_size = 4 MB // in-memory write buffer options.block_cache = 8 MB // LRU read cache options.filter_policy = Bloom(10) // 10-bit Bloom filter per key options.compression = Snappy // fast lossless compression writeOptions.sync = false // async flush (chain is rebuild-able)
26.3 · Key Namespace
// Height key zero-padding (lexicographic = numeric order): "blkh:0000000042" → block at height 42 // Full key examples: "utxo:abc123def:0" → UTXO output 0 of tx abc123def "addr:GXC...:abc123:0" → address index entry "vote:proposalId:voterAddress" → governance vote "price:XAUUSD:1700000000" → gold price at timestamp
26.4 · Atomic WriteBatch (per block)
saveBlock() → single atomic WriteBatch:
1. blk:<hash> = Block JSON
2. blkh:<height> = block hash
3. cfg:latest_* = height + hash
For each tx in block:
4. tx:<txHash> = Transaction JSON
5. txb:<txHash> = {block_hash, block_height}
6. DELETE spent UTXOs
7. utxo:<txHash>:<idx> = new UTXO JSON
8. addr:<addr>:<tx>:<i> = address index
9. trace:<txHash> = traceability record
→ Atomicity: crash = either fully applied or fully absent26.5 · JSON Schemas (key records)
// Block:
{"index":12345,"hash":"0000abc...","previous_hash":"0000xyz...","merkle_root":"...","timestamp":1700000000,"difficulty":1000.0,"nonce":987654321,"miner_address":"GXC...","block_type":0,"tx_hashes":["hash1","hash2"]}
// UTXO:
{"tx_hash":"abc...","output_index":0,"address":"GXC...","amount":10.0,"script":"","block_height":12345}
// Validator:
{"address":"GXC...","stake_amount":5000.0,"staking_days":180,"is_active":true,"blocks_produced":423,"missed_blocks":2,"uptime":99.53,"is_slashed":false}26.6 · DB Maintenance Operations
vacuum() → db->CompactRange(nullptr, nullptr) backup(path) → std::filesystem::copy(dataDirectory, path, recursive) restore(path) → close() → remove(dir) → copy(path) → reopen() getDatabaseSize() → Σ file_size for all files in dataDirectory repairDatabase() → leveldb::RepairDB(dataDirectory, options)
26.7 · Error Codes
DB_SUCCESS=0 DB_ERROR_INIT=1 DB_ERROR_NOT_FOUND=2 DB_ERROR_CORRUPT=3 DB_ERROR_DISK_FULL=4 DB_ERROR_PERMISSION=5 DB_ERROR_IO=6
Block Explorer API
27.1 · Endpoints Overview
Block: getLatestBlocks(limit) · getBlock(hashOrHeight) · getBlockTransactions(id) · searchBlocks(query)
Transaction: getTransaction(hash) · getTransactionChain(hash) · getLatestTransactions(N) · getAddressTransactions(addr,N) · searchTransactions(query)
Address: getAddressDetails(addr) · getAddressBalance(addr) · getAddressUtxos(addr) · getRichestAddresses(limit)
Validator: getAllValidators() · getValidatorDetails(addr) · getTopValidators(N)
Stock: getAllStocks() · getStockDetails(ticker) · getStockHolders(ticker) · getStockTransactions(ticker,N) · getMarketMakerStocks(addr)
Charts: getBlockTimeChart(days) · getTransactionVolumeChart(days) · getValidatorDistributionChart() · getStockPriceChart(ticker,days)
Search: search(query) → {blocks, transactions, addresses, validators, stocks}27.2 · Network Statistics Response
getBlockchainStats():
{"total_blocks":12345,"total_transactions":987654,"total_addresses":45678,"total_supply":15000000.0,"circulating_supply":14500000.0,"total_burned":100.0,"avg_block_time":601.2}
getNetworkStats():
{"hashrate":1.5e15,"difficulty":1000.0,"active_validators":50,"total_staked":5000000.0,"stake_ratio":0.33,"mempool_size":120,"peer_count":87,"protocol_version":70015}Market Maker Administration System
28.1 · Admin Role Hierarchy
super_admin → create/remove admins · approve/reject applications · revoke market makers · full audit log verifier → execute all 5 verification steps reviewer → assign applications · view pending fraud_admin → assign fraud reports · view all fraud_approver → approve/reject fraud reports (triggers reversal pipeline) fraud_reviewer → view fraud reports only
28.2 · Five-Step Verification Pipeline
Contact regulatory body (SEC/FCA/MAS), verify licenseNumber, record proofDocumentHash
Search public records, news, regulatory databases, flag disciplinary history
Review audited financials hash, verify sufficient capital
Review technical capabilities hash, confirm safe on-chain operation
Full Know Your Customer + Anti-Money Laundering, review kycDocumentsHash
28.3 · Application Status Lifecycle
PENDING → UNDER_REVIEW → LICENSE_VERIFIED → REPUTATION_CHECKED
→ FINANCIAL_REVIEWED → TECHNICAL_VERIFIED → KYC_AML_COMPLETED
→ APPROVED (super_admin decision)
OR → REJECTED (at any step)
OR → REVOKED (post-approval)28.4 · Fraud Report Lifecycle
submitFraudReport(txHash, reporter, amount, email, description, evidence)
→ PENDING
→ assignFraudReportToReviewer(reportId)
→ fraud_approver.approveReport(reportId)
→ FraudDetection::markAsStolen(txHash)
→ TaintPropagation starts automatically
→ ProofGenerator::generateProof()
→ ReversalExecutor::executeReversal()
→ PROTOCOL_VALIDATING → EXECUTED | INFEASIBLE
OR → fraud_approver.rejectReport(reportId) → FACTS_REJECTED
Key principle: admins validate FACTS — protocol validates MATH
No admin can force infeasible reversal
No admin can block feasible fact-approved reversal28.5 · Audit Log
struct AuditLogEntry {
std::string logId, adminId, action; // "verify_license", "approve_application"
std::string applicationId, details;
std::time_t timestamp;
std::string ipAddress;
};
// Append-only · accessible only to super_adminConfig System
class Config {
bool isTestnet;
uint16_t p2pPort; // 8333 mainnet / 18333 testnet
uint16_t rpcPort; // 8332 mainnet / 18332 testnet
uint16_t restPort; // 8080
uint32_t targetBlockTime; // 600s mainnet / 120s testnet
uint32_t difficultyAdjustInterval; // 2016 blocks
double minDifficulty; // 1000.0 mainnet / 1.0 testnet
uint64_t maxBlockSize; // 1,048,576 bytes
double initialBlockReward; // 50.0 GXC
uint64_t halvingInterval; // 1,051,200 blocks
double maxSupply; // 31,000,000 GXC
double feePoolSplitPercentage; // 0.15
double minValidatorStake; // 100.0 GXC
uint32_t minStakingDays; // 14
uint32_t maxStakingDays; // 365
std::string dataDirectory;
LogLevel logLevel;
std::string logFile;
};| Parameter | Mainnet | Testnet |
|---|---|---|
| Block time | 600 s | 120 s |
| Min difficulty | 1000.0 | 1.0 |
| P2P port | 8333 | 18333 |
| RPC port | 8332 | 18332 |
| Network magic | "GXC\x01" | "GXCT" |
| Address prefix | "GXC" | "tGXC" |
| DB path | (no testnet) | must contain 'testnet' |
Logger System
// Log levels:
enum class LogLevel { DEBUG, INFO, WARNING, ERROR, CRITICAL };
// All logging macros:
LOG_BLOCKCHAIN(level, message) LOG_NETWORK(level, message)
LOG_MINING(level, message) LOG_DATABASE(level, message)
LOG_SECURITY(level, message, component) // → also writes to security audit trail
LOG_FRAUD(level, message) LOG_REVERSAL(level, message)
LOG_GOVERNANCE(level, message) LOG_BRIDGE(level, message)
LOG_ORACLE(level, message) LOG_STAKING(level, message)
LOG_WALLET(level, message)
// LOG_SECURITY is special: writes to both standard log AND tamper-evident
// security audit trail for forensic review.Mathematical Notation
| Symbol | Meaning |
|---|---|
| τ(T) | Taint score of transaction T ∈ [0,1] |
| wᵢ | Weight of input i = valueᵢ / total_value |
| δ | Taint threshold (0.1) |
| β | Time weight exponent (0.5) |
| H | Block hash function |
| D | Difficulty |
| R | Block reward |
| σ | ECDSA signature (r,s) |
| G | Generator point on secp256k1 |
| n | Order of G |
| p | Prime field of secp256k1 |
| α | EMA smoothing factor (0.60) |
| θ | Re-aggregation threshold (0.7) |
| ε | Velocity epsilon (300 s) |
Complete Constants Reference
// ── Consensus ── MAX_SUPPLY = 31,000,000 GXC HALVING_INTERVAL = 1,051,200 blocks INITIAL_BLOCK_REWARD = 50.0 GXC TARGET_BLOCK_TIME = 600 seconds DIFFICULTY_ADJUSTMENT_INTERVAL = 2016 blocks // ── Staking ── MIN_STAKE_AMOUNT = 10.0 GXC MIN_VALIDATOR_STAKE = 100.0 GXC MIN_STAKING_DAYS = 14 MAX_STAKING_DAYS = 365 VALIDATOR_BETA = 0.5 // ── Fraud Detection ── TAINT_THRESHOLD = 0.1 (δ) HIGH_TAINT = 0.5 CRITICAL_TAINT = 0.8 VELOCITY_EPSILON = 300 s FAN_OUT_K = 5 RE_AGG_THETA = 0.7 DORMANCY_PERIOD = 604,800 s (7 days) // ── Reversal System ── MIN_TAINT_THRESHOLD = 0.1 MAX_TRACE_HOPS = 20 REVERSAL_WINDOW = 20,000 blocks (~30 days) // ── Network ── MAX_CONNECTIONS = 125 MAX_OUTBOUND = 8 PING_INTERVAL = 30 s PEER_TIMEOUT = 90 s MAX_MESSAGE_SIZE = 32 MB // ── AI Security ── PREDICTIVE_WEIGHT (α) = 0.60 SURGE_THRESHOLD = 0.12 DIFFICULTY_ADJUSTMENT_FACTOR = 0.25 MAX_STAKE_INFLUENCE = 0.50 STAKE_FACTOR = 0.20 MAX_DIFFICULTY_CHANGE = 4.0 MIN_REWARD_RATIO = 0.10 MAX_REWARD_RATIO = 1.50 // ── Governance ── DEFAULT_QUORUM_THRESHOLD = 0.15 DEFAULT_PASS_THRESHOLD = 0.60 MINIMUM_PROPOSAL_STAKE = 1,000 GXC DEFAULT_VOTING_PERIOD = 7 days // ── Bridge ── BRIDGE_THRESHOLD = 0.67 (67% multi-sig)
Implementation Files Reference
// Core Blockchain Blockchain.cpp/.h Block.cpp/.h Transaction.cpp/.h block.cpp/.h // Cryptography Crypto.cpp/.h HashUtils.cpp/.h Keccak256.cpp/.h Blake2b.cpp/.h Argon2id.cpp/.h arith_uint256.cpp/.h // Consensus Validator.cpp/.h SalectValidator.cpp StakingPool.cpp/.h ValidatorRegistry.cpp/.h // Fraud & Reversal FraudDetection.cpp/.h ProofGenerator.cpp/.h ReversalExecutor.cpp/.h ReversalFeePool.cpp/.h AddressRegistry.cpp/.h // Tokens & Assets GoldToken.cpp/.h StockContract.cpp/.h StockMarketAPI.cpp/.h ProofOfPrice.cpp/.h // Bridge & Governance CrossChainBridge.cpp/.h Governance.cpp/.h Proposals.cpp Voting.cpp // Mining EthashAlgorithm.cpp/.h EthashMiner.cpp/.h GXHashMiner.cpp/.h SHA256Miner.cpp/.h CPUMiner.cpp MiningManager.cpp/.h MiningOptimizer.cpp/.h HardwareDetector.cpp/.h PoolManager.cpp/.h Stratum.cpp/.h // Network Network.cpp/.h P2PNetwork.cpp PeerManager.cpp/.h MessageHandler.cpp/.h RESTServer.cpp/.h RPCAPI.cpp/.h WebSocketServer.cpp/.h // Security SecurityEngine.cpp/.h // Utilities Database.cpp/.h Logger.cpp/.h Config.cpp/.h Utils.cpp/.h Wallet.cpp/.h
Complete Feature Matrix
| Feature | Bitcoin | Ethereum | GXC |
|---|---|---|---|
| Hybrid PoW/PoS | ❌ PoW only | ❌ PoS only | ✅ Alternating |
| Fraud Detection | ❌ | ❌ | ✅ Taint propagation |
| Transaction Reversal | ❌ | ❌ | ✅ Proof of Feasibility |
| Traceability | Basic UTXO | Account model | ✅ POT (math-enforced) |
| Mining Algorithms | SHA-256 | None (staking) | ✅ SHA-256+Ethash+GXHash |
| Gold-Backed Token | ❌ | ❌ | ✅ GXC-G (100% reserve) |
| On-Chain Governance | ❌ off-chain BIP | Partial | ✅ Stake-weighted |
| Cross-Chain Bridge | Limited | Yes (3rd party) | ✅ 6 chains, 67% multisig |
| Supply Cap | 21M BTC | No hard cap | ✅ 31M GXC |
| Price Oracle | ❌ | Chainlink (3rd party) | ✅ PoP (native) |
| Stock Contracts | ❌ | Via DeFi | ✅ 3 legal models |
| AI Security Engine | ❌ | ❌ | ✅ Hashrate sentinel |
| Market Maker Admin | ❌ | ❌ | ✅ 5-step regulatory |
| Self-Sustaining Pool | ❌ | ❌ | ✅ 15% fee split |
| WebSocket API | 3rd party | 3rd party | ✅ Native real-time |
Mathematical Proofs
E.1 · Taint Conservation Proof
E.2 · Security Engine Convergence Proof
Complete Database Key Reference
blk:<blockHash> → Block JSON
blkh:<0000000000> → Block hash at given height (zero-padded)
tx:<txHash> → Transaction JSON
txb:<txHash> → {"block_hash":..., "block_height":...}
utxo:<txHash>:<outputIndex> → UTXO JSON
addr:<address>:<txHash>:<outputIndex> → UTXO JSON (address index)
val:<address> → Validator JSON
peer:<ip>:<port> → {"ip":..., "port":..., "last_seen":...}
cfg:<key> → Config string value
trace:<txHash> → Traceability JSON
wallet:<address> → {"public_key":..., "encrypted_private_key":...}
proposal:<proposalId> → Governance proposal JSON
vote:<proposalId>:<voter> → {"voter":..., "type":...}
price:<asset>:<timestamp> → {"price":..., "timestamp":...}
bridge:<transferId> → Bridge transfer JSON
share:<poolAddress>:<minerAddress> → {"pool":..., "miner":..., "value":..., "timestamp":...}Admin Permission Matrix
| Action | super_admin | verifier | reviewer | fraud_admin | fraud_approver | fraud_reviewer |
|---|---|---|---|---|---|---|
| Create admin | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Approve/reject application | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Revoke market maker | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
| View audit log | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Execute verification steps | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ |
| Assign application | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ |
| View pending applications | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
| Assign fraud report | ✅ | ❌ | ❌ | ✅ | ❌ | ❌ |
| Approve/reject fraud report | ✅ | ❌ | ❌ | ❌ | ✅ | ❌ |
| View fraud reports | ✅ | ❌ | ❌ | ✅ | ✅ | ✅ |
| View dashboard | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |