GPU Workers / Mining — Overview¶
GPU Workers (miners) execute useful computations on GPU and receive rewards for correct task execution.
Concept¶
Proof-of-Compute replaces meaningless hash rate with useful computations:
- Instead of searching for nonce, workers execute real tasks
- Results are verified and recorded in blockchain
- Workers receive rewards for correct execution
Worker Role¶
Main Functions¶
- Connection to PoC Validator:
- WebSocket or HTTP connection
-
Receiving tasks for execution
-
Computation Execution:
- Running CUDA/ROCm kernels on GPU
-
Processing tasks (matrix multiplication, inference, training, etc.)
-
Result Submission:
- Hashing the result
- Forming proof (future: ZK-proof)
-
Sending
SUBMIT_RESULTtransaction to L1 -
Reward Receipt:
- Off-chain (via PoC validator) or
- On-chain (via L1 reward mechanism)
ComputeResult Structure¶
Fields¶
class ComputeResult:
task_id: str # Task UUID
worker_address: str # Worker address (cpc1...)
result_hash: str # Computation result hash
proof: Optional[str] = None # Correctness proof (future: ZK-proof)
nonce: Optional[int] = None # For synthetic tasks
signature: Optional[str] = None # Worker signature
Example Payload¶
{
"task_id": "550e8400-e29b-41d4-a716-446655440000",
"worker_address": "cpc1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t",
"result_hash": "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcd",
"proof": null,
"nonce": 12345,
"signature": "abcdef1234567890abcdef1234567890abcdef1234567890abcdef12345678"
}
SUBMIT_RESULT Transaction¶
Transaction Type¶
TxType.SUBMIT_RESULT
Gas Cost: 80,000 gas
Transaction Structure¶
Transaction(
tx_type=TxType.SUBMIT_RESULT,
from_address="cpc1worker...", # Worker address
to_address=None,
amount=0, # Reward not yet integrated in L1
fee=gas_limit * gas_price,
nonce=...,
gas_price=1000,
gas_limit=80000,
payload={
"task_id": "...",
"worker_address": "cpc1worker...",
"result_hash": "...",
"proof": None,
"nonce": 12345,
"signature": "..."
}
)
Validation¶
L1 checks:
ComputeResultstructure is validworker_addressmatchestx.from_address- Proof is verified (future: via ZK-verification)
signatureinsideComputeResultis currently informational (onlytx.signatureis verified in MVP)
Blockchain Integration¶
compute_root¶
In block header:
Calculation:
def compute_poc_root(txs: List[Transaction]) -> str:
leaves = []
for tx in txs:
if tx.tx_type == TxType.SUBMIT_RESULT:
res = ComputeResult(**tx.payload)
data = res.model_dump_json().encode("utf-8")
leaves.append(sha256(data))
if not leaves:
return ""
# Implementation uses AccountState helper: state._compute_merkle_root_from_leaves(leaves).hex()
return compute_merkle_root(leaves).hex()
Task Types¶
Synthetic Tasks¶
Status: ✅ Implemented on L1 (Stage 4). Off-chain worker is planned in Local Worker guide.
Purpose: GPU stress test and benchmark
Type: challenge_type: "synthetic"
Properties: - Deterministic output - Fast verification - Generated from block hash
Example:
# Generate task from block hash
block_hash = get_latest_block_hash()
seed = sha256(block_hash + worker_address)
matrix_size = 1024
# Execution
result = matrix_multiplication(seed, matrix_size)
result_hash = sha256(result)
Real Tasks (Future)¶
Status: 🚧 In development (Stage 5)
Types:
- inference — ML model inference
- training — Model training
- rendering — Graphics rendering
- simulation — Scientific simulations
Properties: - Loaded via Task Market - Paid by user - Verified via ZK-proofs or duplicate execution
Task Execution Workflow¶
Current Implementation (Stage 4)¶
Simplified flow:
- Worker generates task from block hash (synthetic)
- Worker executes computation (CPU/GPU mock)
- Worker sends
SUBMIT_RESULTtransaction to L1 - L1 validator verifies structure and includes in block
compute_rootis updated in block header
Future Implementation (Stage 5)¶
Full flow with marketplace:
- User creates task via Task Market API
- PoC validator receives task and splits into jobs
- PoC validator distributes jobs to workers via WebSocket
- Worker executes task on GPU
- Worker sends result with proof back
- PoC validator verifies result (selective verification)
- PoC validator or Worker sends
SUBMIT_RESULTto L1 - L1 validator includes transaction in block
- Worker receives reward (off-chain or via L1 reward)
Rewards¶
Current Implementation¶
Status: Off-chain (in PoC validator) or via simple bonus in _distribute_rewards
Rewards are not yet integrated into L1 at protocol level.
Future Implementation¶
L1 Integration:
- Rewards for
SUBMIT_RESULTtransactions - Distribution via
_distribute_rewards - Worker rating in state (off-chain or on-chain)
Worker Requirements¶
Hardware¶
- GPU: RTX 4090/5090 or similar (CUDA/ROCm support)
- CPU: Sufficient for task orchestration
- RAM: Depends on task type
- Storage: Minimal requirements (for code and data)
Software¶
- Python 3.12+
- CUDA Toolkit or ROCm (for GPU computations)
- L1 node (for sending transactions)
- PoC client (for connecting to orchestrator)
Network Connection¶
- Stable internet connection
- Access to L1 node (local or remote)
- Access to PoC validator (WebSocket/HTTP)
Next Steps¶
- Local Worker — Running a local worker
- Task Market — Publishing tasks
- PoC Details — Proof-of-Compute details