GPUCoin is a blockchain where CUDA kernels (.cu files) serve as smart contracts. The system compiles CUDA source through BarraCUDA into BIR (BarraCUDA Intermediate Representation), which is stored on-chain as the canonical bytecode.
- types.hpp: Fundamental types —
Hash256,Address,Signature,uint256_t - transaction.hpp/cpp: Three transaction types with serialization
- Type 0: Transfer (sender, recipient, amount)
- Type 1: DeployKernel (sender, CUDA source, compiled BIR)
- Type 2: ExecuteKernel (sender, kernel address, grid/block dims, args)
- block.hpp/cpp: Block header with PoC fields, block body with transactions and receipts
- SHA-256 and double SHA-256 via OpenSSL
- Keccak-256 for Ethereum-compatible address derivation
- secp256k1 key generation, signing, and recovery via OpenSSL 3.x EVP API
- Merkle root computation
- StateDB: RocksDB wrapper with 10 column families:
block_headers,block_bodies,block_indextransactions,tx_index,receiptsstate(accounts),kernels,kernel_state,metadata
- WorldState: High-level state management — accounts, kernels, storage slots
- MerkleTree: Binary Merkle tree with proof generation and verification
- BarraCUDACompiler: RAII C++ wrapper around BarraCUDA's C99 API
- Pipeline: preprocess -> lex -> parse -> sema -> bir_lower -> bir_mem2reg
- Produces BIR (target-independent) and optionally .hsaco (AMD GPU binary)
- KernelCache: Thread-safe LRU cache for compiled .hsaco binaries
- ComputeMeter: BIR opcode cost table (144 opcodes). Deterministic gas calculation.
- TransactionExecutor: Processes all three transaction types
- GPURuntime: HIP/HSA kernel dispatch (gated behind
GPUCOIN_HAS_GPU)
- BIRInterpreter: Deterministic software execution of BIR programs
- IEEE 754 round-to-nearest-even, no FMA
- Sequential thread execution for determinism
- ProofOfComputation: Block validation, difficulty adjustment, rewards
- FraudProofVerifier: Challenge/response system with 100-block window
- Custom wire protocol: 12-byte header (magic "GPUC", type, length, checksum)
- Boost.Asio TCP sessions with async I/O
- Peer management with scoring and ban lists
- Two-phase gossip (announce hash, then send data on request)
- Header-first block sync state machine
- JSON-RPC 2.0 over Boost.Beast HTTP
- Ethereum-compatible methods (
eth_blockNumber,eth_getBalance, etc.) - Custom GPU methods (
gpu_deployKernel,gpu_executeKernel, etc.)
- Chain: Chain management, genesis creation, fork choice (heaviest-compute)
- FullNode: Wires all components, mining loop, message dispatch
User submits .cu source via RPC
-> Mempool accepts DeployKernel tx
-> Miner includes in block
-> Executor compiles via BarraCUDA
-> BIR stored in WorldState (Kernels CF)
-> Kernel address = hash(sender || nonce || source_hash)
User submits ExecuteKernel tx via RPC
-> Mempool accepts tx
-> Miner includes in block
-> Executor loads BIR from WorldState
-> GPU Runtime executes .hsaco on real GPU (fast path)
-> Output hash + compute used stored in receipt
-> Any validator can challenge within 100 blocks
-> Challenge resolved via BIR interpreter (deterministic)
| Parameter | Value |
|---|---|
| Chain ID | 42069 |
| Block target | 15 seconds |
| Difficulty adjustment | Every 256 blocks |
| Base reward | 50,000,000 (halves every 210,000 blocks) |
| Fee split | 80% miner, 20% burned |
| Fraud proof window | 100 blocks |
| Max BIR instructions | 262,144 |
| Max source size | 4 MB |