Skip to content

Instantly share code, notes, and snippets.

View ilblackdragon's full-sized avatar

Illia Polosukhin ilblackdragon

  • NEAR Protocol
  • San Francisco, CA
View GitHub Profile
@ilblackdragon
ilblackdragon / qubic-upow-analysis.md
Created July 5, 2026 19:37
Qubic (QU) useful PoW deep dive: real evolutionary-ANN compute that's verifiably done but not verifiably useful, and how its fungible work fabric was weaponized against Monero (2025)

Qubic (QU) Useful Proof of Work: Real Compute, Unverified Usefulness, and the Monero Weaponization

Third in a series with the Pearl cuPOW analysis and Gonka PoC analysis. Sources: github.com/qubic/core, docs.qubic.org, and the forensic paper arXiv:2512.01437. Qubic mainnet has ticked since April 2022; founder Sergey Ivancheglo ("Come-from-Beyond", ex-NXT/IOTA).

TL;DR: Qubic is the most instructive counter-example in the verifiable-AI-compute field because it inverts the usual failure mode. Its "useful work" is genuinely real computation — deterministic evolutionary neural-network search, re-executed and verified by all validators — not Pearl's discardable noise. Yet it still fails the two tests that matter: (1) the chain keeps only the score and discards th

@ilblackdragon
ilblackdragon / gonka-poc-analysis.md
Last active July 5, 2026 21:25
Gonka (GNK) Proof of Compute deep dive: sprint mechanism, statistical inference verification, and why 'rent GPUs 10 min/day + answer garbage' fails post-PoC-v2

Gonka (GNK) Proof of Compute: Design, Choices, and Why "Rent GPUs for 10 Minutes a Day + Answer Garbage" Doesn't Work

Companion to the Pearl cuPOW analysis. Sources: whitepaper, github.com/gonka-ai/gonka (docs/gonka_poc.md, docs/specs/inference-validation-flow.md, chain params), current as of July 2026. Mainnet since Sept 2025; ~14K H100-equivalents as of Feb 2026.

TL;DR: Gonka is the economics-first counterpoint to Pearl's cryptography-first design. Chain voting power = compute demonstrated in a periodic seeded benchmark ("Proof of Compute sprint"), inference honesty = statistical logprob spot-checking priced by reputation, and security = escrow + collateral slashing + a majority-of-compute honesty assumption. The naive attack — rent hardware only for the sprint, then serve garbage — is killed not by cryptography but by three interlocking mechanisms:

@ilblackdragon
ilblackdragon / pearl-cupow-analysis.md
Created July 5, 2026 12:51
Pearl (PRL) cuPOW deep dive: how LLM matmuls become proof-of-work, ZK verification, lazy-mining complexity, Apple Silicon, fused-kernel ossification

Pearl (PRL) cuPOW: How LLM Compute Becomes Proof-of-Work — a Code-Level Analysis

Notes from reading the Pearl monorepo (July 2026). Pearl is a btcd-forked L1 whose PoW is "cuPOW" — proof-of-useful-work via noised integer matrix multiplication, based on arXiv:2504.09971. Mainnet launched April 2026.

TL;DR: The miner is a stock vLLM server serving real inference; every large int7 linear layer runs a "NoisyGEMM" CUDA kernel that returns the exact matmul result to the model while hashing the noised accumulator states as lottery tickets, all keyed to the current block header. Verification is a Plonky2-wrapped STARK proof checked by every full node. The construction genuinely prevents amortization of repeated matmuls — but consensus cannot distinguish useful inference from junk-matrix grinding, and the design ossifies Hopper's GEMM dataflow into the protocol.


1. The core idea

Ethereum has a conflict between native token ETH and third-party tokens.

The first example of it is Maker. In case of Maker, the user locks ETH and gets PETH (Pooled ETH) token, which then gets locked into CDPs and that issues DAI (see whiteboard for more detail). At the same time DAI borrow rate accrues to MKR token holders (via burning MKR).

There is clearly in this model a way to remove MKR and just buy more ETH for the Pool, accruing value to all of Pool holders instead (also would incentivize holding CDPs longer as it now becomes a yield generating asset) Or even better, by buying and burning ETH - value would accrue to ALL ETH holders.

Similar story goes when a third-party token is used for transaction fees or as intermediate. There are no direct captures in such a token, and it can be removed by forking the contract. The most known example is Uniswap being a Bancor without their BNT token. Bancor is splitting value between liquidity providers and BNT vs in Uniswap the value only goes to liquidity

@ilblackdragon
ilblackdragon / truffle.js
Created February 14, 2020 06:33
Truffle example
const { NearProvider, nearlib } = require('near-web3-provider');
const web3 = require('web3');
ACCOUNT_ID = 'illia'
const fileKeyStore = new nearlib.keyStores.UnencryptedFileSystemKeyStore('neardev');
const networkId = 'default';
const defaultAccount = web3.utils.keccak256(ACCOUNT_ID).slice(26, 66);
module.exports = {
networks: {
@ilblackdragon
ilblackdragon / serialize.rs
Last active October 19, 2023 03:07
Protobuf vs Bincode vs CBOR
/*
test serialize_bincode_block ... bench: 2,187,247 ns/iter (+/- 305,944)
test serialize_bincode_block2 ... bench: 2,214,480 ns/iter (+/- 359,709)
test serialize_bincode_tx ... bench: 2,280 ns/iter (+/- 222)
test serialize_cbor_block ... bench: 1,950,128 ns/iter (+/- 188,149)
test serialize_cbor_tx ... bench: 2,182 ns/iter (+/- 334)
test serialize_proto_block ... bench: 3,688,611 ns/iter (+/- 541,517)
test serialize_proto_tx ... bench: 3,567 ns/iter (+/- 449)
@ilblackdragon
ilblackdragon / exception_hook.py
Last active December 11, 2017 23:50
Exception Hook for not print debugging
import sys
import traceback
def _format_value(key, value, first_n=20, last_n=20):
s = repr(value)
s = s.replace('\n', ' ').strip()
if len(s) > first_n + last_n + 3:
s = s[:first_n] + "..." + s[-last_n:]
return "%s: %s" % (key, s)
@ilblackdragon
ilblackdragon / tree_lstm_folded.py
Last active September 6, 2017 23:17
Tree LSTM folded
from pytorch_tools import torchfold
def encode_tree_fold(fold, tree):
def encode_node(node):
if node.is_leaf():
return fold.add('leaf', node.id).split(2)
else:
left_h, left_c = encode_node(node.left)
right_h, right_c = encode_node(node.right)
return fold.add('children', left_h, left_c, right_h, right_c).split(2)
@ilblackdragon
ilblackdragon / tree_lstm_regular.py
Last active September 6, 2017 23:16
TreeLSTM regular model
class TreeLSTM(nn.Module):
def __init__(self, num_units):
super(TreeLSTM, self).__init__()
self.num_units = num_units
self.left = nn.Linear(num_units, 5 * num_units)
self.right = nn.Linear(num_units, 5 * num_units)
def forward(self, left_in, right_in):
lstm_in = self.left(left_in[0])
lstm_in += self.right(right_in[0])
@ilblackdragon
ilblackdragon / torchfold_api.py
Created September 6, 2017 20:56
TorchFold API
class TorchFold(object):
def __init__(self, versatible=False, cuda=False):
...
def add(self, op, *args):
...
def apply(self, nn, return_values):
...