<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Malcolm Venter</title>
    <description>The latest articles on DEV Community by Malcolm Venter (@vinny010).</description>
    <link>https://dev.to/vinny010</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3980229%2F4063f851-7066-45fa-a98a-32a83d1f1017.png</url>
      <title>DEV Community: Malcolm Venter</title>
      <link>https://dev.to/vinny010</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vinny010"/>
    <language>en</language>
    <item>
      <title>I built an AI agent that proves a crypto wallet is hacked — on Qwen Cloud</title>
      <dc:creator>Malcolm Venter</dc:creator>
      <pubDate>Thu, 11 Jun 2026 22:44:51 +0000</pubDate>
      <link>https://dev.to/vinny010/i-built-an-ai-agent-that-proves-a-crypto-wallet-is-hacked-on-qwen-cloud-5f31</link>
      <guid>https://dev.to/vinny010/i-built-an-ai-agent-that-proves-a-crypto-wallet-is-hacked-on-qwen-cloud-5f31</guid>
      <description>&lt;p&gt;&lt;em&gt;Building ChainSleuth for the Global AI Hackathon Series with Qwen Cloud (Track 4: Autopilot Agent).&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;There's a single mistake a crypto wallet can make that hands its private key to the entire world. Not a leaked seed phrase, not a phishing link — a subtle cryptographic slip called &lt;strong&gt;nonce reuse&lt;/strong&gt;. When it happens, anyone looking at the &lt;em&gt;public&lt;/em&gt; blockchain can recover the key with a few lines of arithmetic.&lt;/p&gt;

&lt;p&gt;It broke the PlayStation 3's code-signing in 2010. It drained Android Bitcoin wallets in 2013. And it still shows up on-chain today.&lt;/p&gt;

&lt;p&gt;I wanted to build an AI agent that hunts for it — and, crucially, one you can actually &lt;em&gt;trust&lt;/em&gt;. That became &lt;strong&gt;ChainSleuth&lt;/strong&gt;, and I built it on &lt;strong&gt;Qwen Cloud&lt;/strong&gt;. Here's the journey.&lt;/p&gt;

&lt;h2&gt;
  
  
  The flaw, in one paragraph
&lt;/h2&gt;

&lt;p&gt;Every ECDSA signature is a pair &lt;code&gt;(r, s)&lt;/code&gt;, where &lt;code&gt;r&lt;/code&gt; depends only on a random number &lt;code&gt;k&lt;/code&gt; (the "nonce") chosen per signature. If a wallet ever signs two different transactions with the &lt;strong&gt;same&lt;/strong&gt; &lt;code&gt;k&lt;/code&gt;, both signatures get the &lt;strong&gt;same&lt;/strong&gt; &lt;code&gt;r&lt;/code&gt; — a glaring fingerprint. From two such signatures you can solve two equations for two unknowns and pop out the private key. One reused nonce, and the wallet is gone.&lt;/p&gt;

&lt;h2&gt;
  
  
  The hard part isn't the math — it's &lt;em&gt;trust&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;Here's the problem with pointing an LLM at security: &lt;strong&gt;LLMs hallucinate.&lt;/strong&gt; The last thing the world needs is an "AI security tool" that confidently declares a wallet compromised when it isn't. A forensic verdict has to be &lt;em&gt;true&lt;/em&gt;, not &lt;em&gt;plausible&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;So I built ChainSleuth around one non-negotiable rule:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The LLM proposes and explains. Deterministic math proves.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The architecture is a five-agent pipeline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Planner → Collector → SignatureAnalyst → CryptoVerifier → Reporter
 (Qwen)               (Qwen triage)     (pure math)      (Qwen)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;Planner&lt;/strong&gt;, &lt;strong&gt;Analyst&lt;/strong&gt;, and &lt;strong&gt;Reporter&lt;/strong&gt; are Qwen agents — they scope the audit, triage the signatures, and write the human-readable forensic report. But the &lt;strong&gt;CryptoVerifier&lt;/strong&gt; has &lt;em&gt;no LLM in it at all&lt;/em&gt;. It runs the real secp256k1 recovery and then &lt;strong&gt;verifies&lt;/strong&gt; the recovered key against the on-chain signatures. A finding is only ever reported if the key mathematically checks out. An agent's narrative can never become the verdict.&lt;/p&gt;

&lt;p&gt;That single design decision is what makes the output credible instead of a confident guess.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building the agents on Qwen Cloud
&lt;/h2&gt;

&lt;p&gt;The agents run on &lt;strong&gt;&lt;code&gt;qwen-max&lt;/code&gt;&lt;/strong&gt; via &lt;strong&gt;Alibaba Cloud Model Studio (DashScope)&lt;/strong&gt;. A few things that stood out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The OpenAI-compatible endpoint made wiring trivial.&lt;/strong&gt; I didn't even need an SDK — a plain stdlib HTTP call to the DashScope compatible-mode endpoint was enough to get the whole agent loop running. Flip one env var and the mock pipeline became a live one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;qwen-max&lt;/code&gt; is genuinely good at structured reasoning.&lt;/strong&gt; The Planner produces concrete, well-organized audit plans, and the Reporter writes incident reports with severity and remediation that read like a human analyst wrote them — not generic filler.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It's all Alibaba Cloud.&lt;/strong&gt; Inference runs on Alibaba Cloud Model Studio; reports archive to Alibaba Cloud OSS.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The best part: because the crypto is deterministic, I developed the &lt;em&gt;entire&lt;/em&gt; pipeline offline in a free "mock" mode and only flipped to live Qwen at the end. The findings were identical — Qwen just added the reasoning and the prose on top.&lt;/p&gt;

&lt;h2&gt;
  
  
  Watching it work on the real chain
&lt;/h2&gt;

&lt;p&gt;A demo on a planted sample is one thing. So I pointed it at &lt;strong&gt;live Ethereum&lt;/strong&gt;. ChainSleuth pulled real transactions, reconstructed each signing hash with pure-Python keccak-256 + RLP decoding, and scanned thousands of real signatures.&lt;/p&gt;

&lt;p&gt;I scanned &lt;strong&gt;5,320 live signatures across 20 recent blocks&lt;/strong&gt;. Reused nonces found: &lt;strong&gt;zero.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's not a failure — that's the lesson. Modern wallets use &lt;em&gt;deterministic&lt;/em&gt; nonces (RFC 6979), so they physically can't reuse one. A healthy chain looks clean. ChainSleuth correctly clears a safe wallet, which is most of what a real audit does.&lt;/p&gt;

&lt;p&gt;Then, for fun, I aimed it at the most famous coins in existence: &lt;strong&gt;Satoshi Nakamoto's earliest signatures.&lt;/strong&gt; Could the legendary ~1.1M BTC be exposed by a nonce slip in 2009? I indexed those early signatures and checked.&lt;/p&gt;

&lt;p&gt;Every one used a distinct nonce. &lt;strong&gt;Cryptographically flawless.&lt;/strong&gt; Fifteen years of the entire world scrutinizing those coins, independently re-confirmed in an afternoon: Satoshi's signing was meticulous. No door, just a very solid wall.&lt;/p&gt;

&lt;h2&gt;
  
  
  The ethics are part of the architecture
&lt;/h2&gt;

&lt;p&gt;A tool that recovers private keys is dual-use, and I took that seriously. ChainSleuth only ever produces a key for a wallet that &lt;strong&gt;already leaked it&lt;/strong&gt; on the public chain — it cannot touch a correctly-signing wallet. And recovered keys are &lt;strong&gt;masked by default&lt;/strong&gt;, revealed only after a human analyst confirms at a checkpoint. It's built for &lt;strong&gt;responsible disclosure&lt;/strong&gt; — detect exposed wallets so owners can be warned, never to move funds. The line is simple: &lt;em&gt;audit what you own or are authorized to check; never go fishing in other people's wallets.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;p&gt;The biggest takeaway is bigger than crypto: &lt;strong&gt;the most trustworthy way to use an LLM is to wrap it around a deterministic core.&lt;/strong&gt; Let it plan, triage, and explain — the things it's genuinely great at — and never let it be the source of truth for a claim that has to be correct. Qwen made the agents feel like a real forensic team; the math made them honest.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;ChainSleuth is open source: &lt;strong&gt;&lt;a href="https://github.com/Vinny010/chainsleuth" rel="noopener noreferrer"&gt;https://github.com/Vinny010/chainsleuth&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Built solo for the &lt;strong&gt;Global AI Hackathon Series with Qwen Cloud — Track 4: Autopilot Agent&lt;/strong&gt;, on &lt;code&gt;qwen-max&lt;/code&gt; + Alibaba Cloud Model Studio + OSS.&lt;/p&gt;

&lt;p&gt;When a wallet reuses a nonce, its private key is already gone. ChainSleuth turns that subtle cryptographic flaw into a one-click, &lt;em&gt;provable&lt;/em&gt; forensic verdict — and it runs on Qwen.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>security</category>
      <category>blockchain</category>
      <category>qwen</category>
    </item>
  </channel>
</rss>
