writing
Notes on cryptography, proof systems, Rust systems engineering, and the protocols I build.
subscribe via rss# all posts

A DarkFi Node on a Raspberry Pi — ARM Bring-Up Notes and the Circuits Underneath
Notes from turning a Raspberry Pi 5 into a 24/7 DarkFi testnet node and miner: NVMe boot, self-hosted WireGuard, the ARM dependency trail for darkfid and xmrig, and a look at the ZK circuits the node deploys on startup — including the v3a exploit that sat on a Poseidon binding.

Learning Solana from Outdated Tutorials: What Changed in Modern Anchor
Notes on migrating from Anchor 0.29 to 1.0 while following RareSkills' Solana course. Concrete diffs in project structure, instruction serialization, testing infrastructure, and what stayed invariant.

Bytes, Bits, and Breaking XOR — Notes from Cryptopals in Rust
Notes from implementing the first Cryptopals challenges in Rust without libraries: hex, base64, XOR, frequency analysis, Hamming distance, and breaking a repeating-key cipher.

Reverse-Engineering a North-Korean-Style Supply Chain Attack Delivered via Fake Web3 Job Interview
Full forensic analysis of a targeted supply chain attack delivered through a fake Web3 job interview. A single npm install silently deployed a two-stage RAT: an initial loader that decrypts a second-stage C2 endpoint, exfiltrates the full process environment, and maintains a persistent TCP beacon on port 1224 awaiting operator commands. I got targeted, responded in 45 minutes, then reproduced the entire attack chain in an isolated Hetzner VM and captured the complete C2 protocol.

dag_exec: a std-only DAG executor for CPU-heavy pipelines (pruning + bounded parallelism)
A tiny std-only DAG executor that computes only the requested outputs (partial evaluation) and runs heavy nodes in parallel with explicit bounds.

Rollup Commitments as a DAG: Pruning, Parallelism, and Proof Plumbing (Rust std-only)
A rollup-shaped batch pipeline modeled as a DAG: compute only the chunk/proof you need, and scale CPU-heavy hashing with bounded parallelism — all in std.

Testing Concurrency Invariants in a Parallel Executor
How to verify max_in_flight bounds using AtomicUsize, CAS loops, and deterministic gating without sleep().

Designing Backpressure in a Parallel DAG Executor
How I introduced bounded backpressure into a parallel DAG scheduler using sync channels and an in-flight cap.

Rust — Trait Objects, Sized, and Why My DAG Needed `Box<dyn Fn>`
Why heterogeneous closures require type erasure, how trait objects become unsized, and why 'static is necessary when storing tasks.

ZKML EZKL MNIST Lab: Verifiable Inference, Quantization, and the Prover Memory Wall
A small, reproducible ZKML lab: train a CNN, export ONNX, compile an EZKL circuit, generate keys, prove & verify inference — then benchmark the practical tradeoff that matters on consumer hardware: numerical fidelity vs prover memory / PK size.

Crescent Bench Lab: Measuring ZK Presentations for Real Credentials (JWT + mDL)
A small Rust lab that vendors microsoft/crescent-credentials, generates Crescent test vectors, and benchmarks zksetup/prove/show/verify across several parameters — including proof sizes and selective disclosure variants.

TEE Auction Coprocessor: Replay-Safe Attested Auction Receipt with Gramine SGX — Tutorial
A Rust mini-lab that turns a Vickrey (second-price) auction into a TEE coprocessor: deterministic core, bid commitments, replay protection, and a policy-driven verifier—leaving full DCAP collateral/TCB verification (PCS chain, revocation, freshness rules) for a follow-up.

Baby-Ligero: Three Tiny Tests for a Tiny Circuit — ZK Hack S3M5
A mini Rust lab that implements a baby version of Ligero's three tests — proximity, multiplication, and linear — for a tiny arithmetic circuit, and uses them to see soundness amplification in action.

Norm Blowup in Lattice Folding (LatticeFold Lab) — ZK Hack S3M4
A hands-on Rust experiment exploring why folding causes norm blowup in lattice commitments, and how decomposition keeps the digits small — the core idea behind LatticeFold and LatticeFold+.

SIS Labs — Commitments, PoK & MC soundness experiment (ZK Hack S3M3)
From Vadim Lyubashevsky's lattice-based SNARKs whiteboard to a tiny Rust lab: SIS commitments, a proof of knowledge, and a soundness experiment.

NTT Bench — BabyBear vs Goldilocks (ZK Hack S3M2)
Hands-on NTT benchmarks over BabyBear and Goldilocks fields, connecting Jim Posen’s ZK Hack talk on high-performance SNARK/STARK engineering to real Rust code.

icRamp Devlog #21 — Vault Refactor & ic-alloy EVM Reads
Final milestone wrap-up: IcRamp v2 with a simplified vault, ICP-driven state instead of on-chain commit/uncommit, and ic-alloy-powered EVM reads for getDeposit.

icRamp Devlog #20 — Pay with Crypto (Settlement & Verification)
We finish the pay-with-crypto flow: from Locked orders to on-chain payments, matching provider assets, and verifying EVM/Solana txs on the backend.

Cryptography — What makes a Hash ZK-Friendly (ZK Hack S3M1)
Practical Learnings from ZK Hack with JP Aumasson with hands-on benchmarks: SHA-256/512, BLAKE3, Poseidon. What does 'ZK-friendly' really mean?

icRamp Devlog #19 — Pay with Crypto (Frontend UX & Provider Flows)
Frontend wiring for the experimental 'pay with crypto' path: crypto providers in the user profile, filtered provider selection in Create Order, and a compact order card UX for onrampers choosing how to pay.

icRamp Devlog #18 — Pay with Crypto (Experimental Trustless P2P Bridge)
We add an experimental 'pay with crypto' path that lets onrampers settle in stables on a different chain than the escrowed asset. Includes provider model refactor and order validation. Frontend exposure starts with stables for speed.

icRamp Devlog #17 — Liquid Orders: Partial Fills
We add partial fills: the onramper can lock only a fraction of the order, pay, and get a proportional crypto payout while the rest stays open. Single lock path, pro-rata fees, idempotent fill records, and listener-safe completion.

icRamp Devlog #16 — Liquid Orders: Top‑ups + Provider Icons
Added liquid (top‑up) orders and unified provider icons across the app. Safe processing lock on the backend, fee recomputation on the new total, and a polished top‑up UI with available-balance max.

icRamp Devlog #15 — Stripe Order Payments (Email↔️Connect, per‑order redirects)
End-to-end Stripe payments for orders: Onramper pays by email, Offramper receives via Connect destination charges. Per‑order success/cancel, email verification, and a resilient FE redirect flow.

icRamp Devlog #14 — Stripe Frontend (Register & Checkout UX)
Frontend wiring for Stripe Connect: a register flow that survives redirect/refresh, provider cards UI, and Create Order with destination charges. Includes the Onramper≠Offramper split and backend-validated providers.

icRamp Devlog #13 — Stripe Backend (Connect + Checkout)
Starting Milestone 2: bringing Stripe Connect (destination charges) into icRamp with IPv6-friendly HTTPS outcalls, multi-region key routing, and Candid-first tests.

DeFi Bots Series — Part 8: The Monitor Test Saga (Making the Monitor Debuggable)
I debugged the PnL, refactored the messy code we left implemented in our last devlog and made everything more compact and debuggable.

DeFi Bots Series — Part 7: The Monitor Test Saga (One-Sided Bids, Skew Rebalances, and Real PnL)
I stress-tested a one-sided, USDC-anchored LP strategy overnight: ~15 rebalances, lots of fee accrual, a few bugs, and a clearer picture of what to fix next. We tightened pool orientation, made SOL/WSOL funding sane, added skew gates (TVL/fees), and wrote proper lineage + flows. The monitor is quieter—until it needs not to be.

DeFi Bots Series — Part 6: Base-Funded Opens and Sweeps, Clean PnL, and a Quiet (Smarter) Monitor
I moved position funding and settlements to a USDC base, fixed a sneaky PnL bug (price/mint orientation), taught the monitor to chill (cooldown + “in-range = HOLD”), and battle-tested open/close scripts with ledgered flows. It’s finally… boring—in the good way.

DeFi Bots Series — Part 5: Live Rebalance on Meteora DLMM (RPC Profiles, Clean PnL & One-Sided Liquidity)
I rewired RPC handling with role-based profiles, unified LP strategy controls, fixed PnL accounting, and executed a live one-sided rebalance on a PUMP/USDC DLMM pool over gRPC—end to end with Supabase ledgering.

DeFi Bots Series — Part 4: Prepping the Monitor — Decimals, Prices, Symbols & Clean Balances
Before we let the monitor act on positions, we hardened the boring bits: one source of truth for decimals, fast prices, safe BigInt math, and clean balance reads. The goal is simple: trustworthy PnL so alerts and actions are correct.

DeFi Bots Series — Part 3: Telegram Bot Lite, Portfolio RPC, and a Lean Path to the Scheduler
I stripped our Telegram surface down to a fast, durable “Lite” mode: no Kafka, no AI agent in the middle—just clean wallet UX, on-chain balances via RPC, token prices from Jupiter, PnL wired to Supabase, and buttons that actually do something. This sets the table for the trading scheduler.

DeFi Bots Series — Part 2: Orchestrator, LP-Copy Warm-Up & Safe Monitor (Dry-Run)
We wire a minimal orchestrator with a primed LP-copy scanner and a policy-driven monitor that runs in dry-run, notifies via Telegram, reads positions from Supabase, and calls execution logic via imports (no gRPC).

DeFi Bots Series — Part 1: A Practical Meteora DLMM Scanner (From TXs to Pool Intents)
We build a robust scanner that reads a leader’s recent transactions and extracts DLMM position inits as (poolAddress, positionPda) intents — no brittle bin-array decoding, just clean signals my scheduler can act on.

DeFi Bots Series — Building an multi-strategy bot on Solana (Intro: Goals & Plan)
Kicking off a new series: revive the old defi_server stack I built at Taigo, drop a new bot/ module on top, and ship a scheduler that can copy-trade Meteora LPs — with PnL tracked and later expanded to memecoins, xStocks, and perps.

icRamp Devlog 12 — Milestone Submission: Solana P2P Onramping (SOL + BONK)
Final wrap-up for the Solana Integration milestone: 5-min demo, slides, deliverables checklist, tests, and canister URLs.

icRamp Devlog #11 — Testing Saga 4: Vault State (SOL + SPL), Full Suite Green
We finish the vault branch for SOL and SPL: deposits, cancels, locks, unlocks, and completion — entirely in-canister state. Plus, the full Solana suite now passes.

icRamp Devlog #10 — Testing Saga 3: Token Registry, Token-2022 & Solid Wasm Paths
We include the Solana token registry tests (incl. Token-2022), fix flaky JSON-RPC shapes, and make the test harness robust with `include_bytes!` + workspace-aware wasm paths.

icRamp Devlog #9 — Testing Saga 2: PocketIC Solana Mocks & Test Harness
We continue the Solana testing story by building a clean HTTP-outcall mocking layer, composable responders, and readable integration tests.

icRamp Devlog #8 — Testing Saga 1: Refractor and Solana Test Expansion
We refractored and improved our testing architecture and expanded it to include a fully-fledged solana backend canister integration test flow.

icRamp Devlog #7 — Extra: Creating spl tokens
Let's create some spl tokens so we can generate a fully fledged test with orders containing solana tokens.

icRamp Devlog #6 — icRamp Orders with Solana
Everything is ready for us to create orders in the frontend containing solana and executing the full offramping flow.

icRamp Devlog #5 — icRamp frontend Solana Wallet Adapter

icRamp Devlog #4 — icRamp frontend Deployment Setup with Solana
Third Chain Fusion grant log: wiring icRamp's core backend with the Solana canister, persisting canister IDs, and preparing escrow flows for SOL/SPL assets.

icRamp Devlog #3 — icRamp Canister & Solana Integration
Third Chain Fusion grant log: wiring icRamp's core backend with the Solana canister, persisting canister IDs, and preparing escrow flows for SOL/SPL assets.

icRamp Devlog #2 — Solana Canister, Registry & Vault
Second Chain Fusion grant: building a Solana canister with safe token registry and a thin vault to coordinate escrow.

ETHGlobal Unite DeFi — How We Won with ICP
Design decisions, trade‑offs, and the fully on‑chain architecture that won 🥈 in 1inch’s Fusion+ → ICP track.

icRamp Devlog #1 — Chain Fusion & Bitcoin
Bringing Bitcoin and Solana native actions to ICP: setup, pitfalls, and tests.
$ curl -O /feed.xmlrss