<?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: Anton</title>
    <description>The latest articles on DEV Community by Anton (@alhimikix).</description>
    <link>https://dev.to/alhimikix</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%2F3904916%2Fc58aaca0-0a72-4c92-a90e-5ccfff56222d.jpg</url>
      <title>DEV Community: Anton</title>
      <link>https://dev.to/alhimikix</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alhimikix"/>
    <language>en</language>
    <item>
      <title>How I optimized a Solana vanity address grinder to 44M keys/sec on GPU</title>
      <dc:creator>Anton</dc:creator>
      <pubDate>Wed, 29 Apr 2026 19:07:50 +0000</pubDate>
      <link>https://dev.to/alhimikix/how-i-optimized-a-solana-vanity-address-grinder-to-44m-keyssec-on-gpu-4l48</link>
      <guid>https://dev.to/alhimikix/how-i-optimized-a-solana-vanity-address-grinder-to-44m-keyssec-on-gpu-4l48</guid>
      <description>&lt;p&gt;I needed a suffix vanity address for a Solana token. Every tool I found either:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claimed "GPU" but ran on CPU&lt;/li&gt;
&lt;li&gt;Only did prefix search&lt;/li&gt;
&lt;li&gt;Sent keys through a server&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So I wrote one from scratch in CUDA. Here's the optimization journey.&lt;/p&gt;

&lt;h2&gt;
  
  
  Baseline: naive GPU port
&lt;/h2&gt;

&lt;p&gt;Starting point: port TweetNaCl ed25519 to CUDA kernels.&lt;br&gt;
Result: &lt;strong&gt;311k keys/sec&lt;/strong&gt; — &lt;em&gt;slower than CPU&lt;/em&gt; (455k on 16 threads).&lt;/p&gt;

&lt;p&gt;GPU parallelism is wasted if the per-thread work is slow. Time to fix the math.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: 8-bit signed-digit comb — 4.65M k/s (10x)
&lt;/h2&gt;

&lt;p&gt;Standard scalar multiplication does 256 point doublings + 256 conditional adds.&lt;/p&gt;

&lt;p&gt;The comb method splits the 256-bit scalar into 32 signed bytes, each indexing a precomputed table of &lt;code&gt;j × 256^w × G&lt;/code&gt; for &lt;code&gt;j ∈ [1..128]&lt;/code&gt;, &lt;code&gt;w ∈ [0..31]&lt;/code&gt; (4096 points, 480 KB — fits in L2 cache).&lt;/p&gt;

&lt;p&gt;One scalar mult = &lt;strong&gt;32 mixed additions&lt;/strong&gt; instead of 512 operations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: ref10 fe10 field arithmetic — 31M k/s (68x)
&lt;/h2&gt;

&lt;p&gt;TweetNaCl uses 16×16-bit limbs. ref10 uses radix-2^25.5: 10 signed i32 limbs alternating 26/25 bits.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;fe_mul&lt;/code&gt; drops from 256 partial products to 100, and uses &lt;code&gt;mad.wide.s32&lt;/code&gt; (1-cycle on Ampere) instead of slow i64 multiply.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Montgomery batched inversion — 38M k/s (84x)
&lt;/h2&gt;

&lt;p&gt;Each thread processes 4 candidates. Instead of 4 separate inversions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Forward pass: compute prefix products of Z coordinates&lt;/li&gt;
&lt;li&gt;One &lt;code&gt;inv25519&lt;/code&gt; on the final product&lt;/li&gt;
&lt;li&gt;Backward pass: recover individual inverses&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;One inversion amortized across 4 candidates.&lt;/strong&gt; Saves ~75% of inversion cost.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Suffix mod-58^K prefilter — 44M k/s (97x)
&lt;/h2&gt;

&lt;p&gt;After &lt;code&gt;pack25519&lt;/code&gt;, compute &lt;code&gt;pubkey_int mod 58^K&lt;/code&gt; where K = suffix length.&lt;br&gt;
Compare against precomputed target. 99.99% of non-matching keys skip the full base58 encode entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final numbers
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;th&gt;k/s&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;CPU 16 threads&lt;/td&gt;
&lt;td&gt;455k&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPU naive (TweetNaCl)&lt;/td&gt;
&lt;td&gt;311k&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;+ 8-bit comb&lt;/td&gt;
&lt;td&gt;4.65M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;+ fe10&lt;/td&gt;
&lt;td&gt;31M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;+ batched inversion&lt;/td&gt;
&lt;td&gt;38M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;+ mod-58^K prefilter&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;44M&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;RTX 3090, CUDA 13.1. Bottleneck: 255 registers/thread = Ampere max → 8 warps/SM occupancy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vanity_gpu_sm86.exe pump        &lt;span class="c"&gt;# runs forever → pump_results.csv&lt;/span&gt;
vanity_gpu_sm86.exe pump 100    &lt;span class="c"&gt;# find 100 matches and stop&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pre-built binaries for RTX 20xx / 30xx / 40xx. Private keys never leave your machine.&lt;/p&gt;

&lt;p&gt;→ &lt;a href="https://github.com/alhimikix/solana-suffix-gpu" rel="noopener noreferrer"&gt;https://github.com/alhimikix/solana-suffix-gpu&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cuda</category>
      <category>solana</category>
      <category>gpu</category>
      <category>cryptocurrency</category>
    </item>
  </channel>
</rss>
