<?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: 晓道</title>
    <description>The latest articles on DEV Community by 晓道 (@xiaodao).</description>
    <link>https://dev.to/xiaodao</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%2F184890%2Fe7396e0c-dd01-4dc1-9170-97815419dbb9.jpg</url>
      <title>DEV Community: 晓道</title>
      <link>https://dev.to/xiaodao</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/xiaodao"/>
    <language>en</language>
    <item>
      <title>🚀 Introducing Solana Instruction MCP — A Game-Changing Tool for Solana Developers</title>
      <dc:creator>晓道</dc:creator>
      <pubDate>Fri, 24 Oct 2025 14:40:00 +0000</pubDate>
      <link>https://dev.to/xiaodao/introducing-solana-instruction-mcp-a-game-changing-tool-for-solana-developers-4jib</link>
      <guid>https://dev.to/xiaodao/introducing-solana-instruction-mcp-a-game-changing-tool-for-solana-developers-4jib</guid>
      <description>&lt;p&gt;I had the honor of meeting the author of this project during the &lt;strong&gt;Chengdu HackHouse&lt;/strong&gt;, and after testing the &lt;strong&gt;Solana Instruction MCP&lt;/strong&gt;, I was genuinely &lt;em&gt;blown away&lt;/em&gt;.&lt;br&gt;
 This project is so impactful that it would be a real loss for the Solana and AI developer community if it goes unnoticed.&lt;/p&gt;

&lt;p&gt;So, I decided to write this article to introduce how to &lt;strong&gt;install and use&lt;/strong&gt; this powerful MCP.&lt;/p&gt;


&lt;h2&gt;
  
  
  ⚙️ Note
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;This guide currently supports only Linux and macOS users.&lt;/strong&gt;&lt;br&gt;
 Instructions for IDE integrations (e.g., VS Code) will be added later.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The project already has an official website, which is currently simple but functional — the author mentioned that it will be updated and beautified later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Official Website:&lt;/strong&gt; &lt;a href="https://solmcp.daog1.workers.dev/dashboard" rel="noopener noreferrer"&gt;https://solmcp.daog1.workers.dev/dashboard&lt;/a&gt;&lt;br&gt;
 &lt;strong&gt;Author:&lt;/strong&gt; &lt;em&gt;Xiaodao&lt;/em&gt; (Community ID)&lt;/p&gt;


&lt;h2&gt;
  
  
  🔑 Step 1: Log in and Get Your API Key
&lt;/h2&gt;

&lt;p&gt;Go to the official website and click &lt;strong&gt;Log In with GitHub&lt;/strong&gt;.&lt;br&gt;
 Once logged in, you’ll see a dashboard page like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0w5ug0mp3sqp3zk9yx14.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0w5ug0mp3sqp3zk9yx14.png" alt="image.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After login, you’ll be able to see your &lt;strong&gt;API Key&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj8mkigotn2mrwhdcpt3q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj8mkigotn2mrwhdcpt3q.png" alt="Screenshot from 2025-10-24 15-56-47.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  💻 Step 2: Set Up with Your AI CLI (Example: Opencode CLI)
&lt;/h2&gt;

&lt;p&gt;Depending on which AI CLI tool you use, check its documentation on how to connect an MCP server.&lt;/p&gt;

&lt;p&gt;Here we’ll take &lt;strong&gt;&lt;a href="https://opencode.ai/" rel="noopener noreferrer"&gt;Opencode CLI&lt;/a&gt;&lt;/strong&gt; as an example.&lt;/p&gt;

&lt;p&gt;First, visit the official Opencode CLI website and install it following their instructions.&lt;br&gt;
 After installation, you can verify it by running a version check or chatting with Opencode via terminal.&lt;/p&gt;


&lt;h2&gt;
  
  
  🔧 Step 3: Configure the Solana MCP
&lt;/h2&gt;

&lt;p&gt;To install and configure an MCP, refer to the official Opencode documentation here:&lt;br&gt;
 👉 &lt;a href="https://opencode.ai/docs/mcp-servers/#remote" rel="noopener noreferrer"&gt;https://opencode.ai/docs/mcp-servers/#remote&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Look for the section titled &lt;strong&gt;“Using &lt;code&gt;opencode.json&lt;/code&gt;”&lt;/strong&gt; — this explains how to add MCP servers manually.&lt;/p&gt;

&lt;p&gt;You’ll need to create (or edit) an &lt;code&gt;opencode.json&lt;/code&gt; file inside either:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;your project’s &lt;code&gt;.opencode&lt;/code&gt; directory, &lt;strong&gt;or&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;your global config directory: &lt;code&gt;~/.opencode&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Global installation is recommended. Run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/.opencode
&lt;span class="nb"&gt;touch &lt;/span&gt;opencode.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then insert the following content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://opencode.ai/config.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"SolanaMCP"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"http"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://solmcp.daog1.workers.dev/mcp?apiKey=MY_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"enabled"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"headers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bearer MY_API_KEY"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Replace &lt;code&gt;MY_API_KEY&lt;/code&gt; with the key displayed on the MCP dashboard (after &lt;code&gt;apiKey=&lt;/code&gt;).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Save the file, then restart Opencode by typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;opencode
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once restarted, you can start using the Solana MCP!&lt;br&gt;
 When giving instructions to your AI assistant, make sure to &lt;strong&gt;explicitly mention “using MCP”&lt;/strong&gt; or similar wording so it recognizes the request correctly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fctzbyktnffswcl4mumrv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fctzbyktnffswcl4mumrv.jpg" alt="mcp ai" width="800" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzf232dvu5li77dozfbq2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzf232dvu5li77dozfbq2.jpg" alt="mcp ai" width="800" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzox68hxp39lu1q02vclq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzox68hxp39lu1q02vclq.jpg" alt="mcp ai" width="800" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5yka232zlee5cjz2ii1n.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5yka232zlee5cjz2ii1n.jpg" alt="mcp ai" width="800" height="452"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Summary
&lt;/h2&gt;

&lt;p&gt;That’s it! You now have &lt;strong&gt;Solana Instruction MCP&lt;/strong&gt; connected to your AI CLI environment.&lt;br&gt;
 With it, your assistant can perform &lt;strong&gt;deep instruction-level analysis of Solana transactions&lt;/strong&gt;, decode parameters, trace CPIs, and much more — all powered by an expanding IDL library and AI-enhanced understanding.&lt;/p&gt;

&lt;p&gt;If you’re building tools or doing audits in the Solana ecosystem, &lt;strong&gt;this is a must-try.&lt;/strong&gt;&lt;/p&gt;




</description>
      <category>mcp</category>
      <category>solana</category>
      <category>anchor</category>
    </item>
    <item>
      <title>Why Cogoma: Go Implementation of Codama IDL Ecosystem</title>
      <dc:creator>晓道</dc:creator>
      <pubDate>Sun, 12 Oct 2025 12:22:56 +0000</pubDate>
      <link>https://dev.to/xiaodao/why-cogoma-go-implementation-of-codama-idl-ecosystem-k0j</link>
      <guid>https://dev.to/xiaodao/why-cogoma-go-implementation-of-codama-idl-ecosystem-k0j</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In Solana blockchain development, Interface Definition Language (IDL) serves as the critical bridge connecting smart contracts (programs) with client applications. Codama, as a powerful IDL processing toolkit, was originally implemented primarily in TypeScript, providing developers with 67 standardized node types, visitor pattern-based traversal framework, and complete code generators. However, with the Solana Foundation promoting Codama standardization, a critical issue has emerged: &lt;strong&gt;core programs like solana-program/system and solana-program/token-2022 provide IDLs exclusively in Codama format&lt;/strong&gt;, while the Go ecosystem has no library capable of directly parsing this format.&lt;/p&gt;

&lt;p&gt;This creates a significant technical bottleneck: Go developers cannot directly use official Solana program IDLs. Cogoma was born to provide Go developers with complete, type-safe IDL processing capabilities, achieving 100% feature alignment with the TypeScript version, &lt;strong&gt;enabling direct integration with Solana official programs&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solana IDL Technical Architecture
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Core Role of IDL in Solana Ecosystem
&lt;/h3&gt;

&lt;p&gt;Solana programs (smart contracts) define their interfaces through IDL files, including instructions, account structures, and type definitions. These IDL files play key roles in the technical architecture:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Program Documentation&lt;/strong&gt;: Clear API interface specifications&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code Generation Foundation&lt;/strong&gt;: Automatic generation of client SDKs and type definitions for multiple programming languages&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type Safety&lt;/strong&gt;: Ensures type consistency between clients and programs, avoiding runtime errors&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-language Support&lt;/strong&gt;: Multi-language integration through standardized formats&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Technical Evolution of IDL Formats
&lt;/h3&gt;

&lt;p&gt;Solana IDL has evolved from concrete implementations to abstract specifications:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Anchor IDL&lt;/strong&gt;: Concrete JSON format specifications defining implementation details for instructions, accounts, and types&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shank IDL&lt;/strong&gt;: Another concrete JSON format with similar structure but different semantic specifications&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Codama IDL&lt;/strong&gt;: Abstract node type system providing unified internal representation and advanced processing capabilities&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This evolution reflects the transformation of IDL from simple interface description to complex data processing frameworks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Technical Necessity of Go Implementation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Technical Advantages of Go in Blockchain Infrastructure
&lt;/h3&gt;

&lt;p&gt;Go has become the preferred language for blockchain infrastructure due to its technical characteristics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;High-performance Concurrency&lt;/strong&gt;: Goroutines and Channels provide efficient concurrency models suitable for high-throughput IDL processing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Static Type Safety&lt;/strong&gt;: Compile-time type checking perfectly aligns with IDL's type safety requirements&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fast Compilation&lt;/strong&gt;: Go's compilation speed significantly outperforms TypeScript, ideal for CI/CD integration&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory Efficiency&lt;/strong&gt;: Efficient garbage collection and memory management&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deployment Friendly&lt;/strong&gt;: Single binary deployment without runtime dependencies&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Technical Gaps in Go IDL Processing
&lt;/h3&gt;

&lt;p&gt;Despite the powerful TypeScript version of Codama, the Go ecosystem faces significant technical gaps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lack of Native Processing&lt;/strong&gt;: Existing tools cannot handle complex IDL data structures&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-language Call Overhead&lt;/strong&gt;: Performance loss when calling TypeScript version through Node.js&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type System Mismatch&lt;/strong&gt;: Go's strong typing system conflicts with JavaScript's dynamic typing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runtime Dependencies&lt;/strong&gt;: Node.js dependencies are unsuitable for certain production environments&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cannot Use Official Programs&lt;/strong&gt;: &lt;strong&gt;Most critically, unable to directly use solana-program series Codama format IDLs&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Technical Limitations of Existing Go Tools
&lt;/h3&gt;

&lt;p&gt;The Go ecosystem's IDL processing tools are primarily represented by Gabriele Girardi's (@gagliardetto) &lt;code&gt;anchor-go&lt;/code&gt; project, but have significant limitations:&lt;/p&gt;

&lt;h4&gt;
  
  
  anchor-go Technical Limitations
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;anchor-go&lt;/code&gt; is the current mainstream Anchor IDL processing library but has key limitations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Limited Format Support&lt;/strong&gt;: Only supports Anchor v0.30.0+ IDL formats, incomplete support for earlier versions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Version Compatibility Issues&lt;/strong&gt;: Old version IDLs require manual conversion using &lt;code&gt;anchor idl convert&lt;/code&gt; command&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Incomplete Error Parsing&lt;/strong&gt;: Limited error type parsing functionality affects type safety&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Single-functionality&lt;/strong&gt;: Lacks complete IDL processing ecosystem, focuses only on code generation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Insufficient Extensibility&lt;/strong&gt;: Cannot handle non-Anchor format IDL files (such as Shank, Codama)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Fundamental Limitations
&lt;/h4&gt;

&lt;p&gt;Existing tools have huge gaps compared to Codama:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lack of Abstract Processing&lt;/strong&gt;: Cannot handle Codama's 67-node type system&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Missing Advanced Features&lt;/strong&gt;: No support for visitor patterns, path parsing, link resolution, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Missing Modern Toolchain&lt;/strong&gt;: Lacks type validation, error reporting, IDE integration, and other development tools&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ecosystem Fragmentation&lt;/strong&gt;: Cannot handle the Codama standard promoted by Solana Foundation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These technical limitations result in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cannot Use Official Programs&lt;/strong&gt;: Go developers cannot directly integrate solana-program series&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance Bottlenecks&lt;/strong&gt;: Require cross-language calls to TypeScript versions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Maintenance Complexity&lt;/strong&gt;: Multiple toolchains increase technical debt&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feature Limitations&lt;/strong&gt;: Cannot leverage Codama's advanced capabilities&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Technical Value of Codama Abstraction Layer
&lt;/h3&gt;

&lt;p&gt;Codama, as the core abstraction layer for IDL processing, provides the following technical advantages:&lt;/p&gt;

&lt;h4&gt;
  
  
  Unified Data Model
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;67 Standardized Node Types&lt;/strong&gt;: Comprehensive type system covering all IDL elements including instruction nodes, account nodes, type nodes, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Format Agnosticism&lt;/strong&gt;: Abstract representation layer that shields underlying format differences&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type Richness&lt;/strong&gt;: Supports composite types (arrays, maps), modifiers (readonly, optional), and context values (comments, metadata)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Advanced Processing Framework
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Visitor Pattern&lt;/strong&gt;: Double dispatch pattern based on Go interfaces for type-safe operation traversal&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Parsing&lt;/strong&gt;: Runtime type inference for intelligent parsing when complete type information is unavailable&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Path Resolution&lt;/strong&gt;: Navigate complex data structures through XPath-like expressions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link Resolution&lt;/strong&gt;: Handle cross-file references and type dependencies&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Cross-format Interoperability
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Format Conversion&lt;/strong&gt;: Seamless conversion between different IDL formats while maintaining semantic equivalence&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mixed Processing&lt;/strong&gt;: Handle multiple format IDL files simultaneously, supporting gradual migration&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unified API&lt;/strong&gt;: Consistent interface design reducing developer learning costs&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Real-world Technical Cases
&lt;/h3&gt;

&lt;p&gt;Major Solana projects have adopted Codama as a technical standard, highlighting the critical gap in the Go ecosystem:&lt;/p&gt;

&lt;h4&gt;
  
  
  solana-program/system
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Technical Specifications&lt;/strong&gt;: Complete system program IDL including account creation, transfers, nonce, and other core functions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Format Standard&lt;/strong&gt;: Uses Codama 1.0.0 with "shank" origin&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Critical Impact&lt;/strong&gt;: &lt;strong&gt;Codama format only&lt;/strong&gt;, Go developers cannot use directly&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Technical Challenge&lt;/strong&gt;: No library in Go ecosystem can parse Codama format, must rely on TypeScript version&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  solana-program/token-2022
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Complexity&lt;/strong&gt;: Complete IDL for Token-2022 program including all extension functions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Technical Implementation&lt;/strong&gt;: Based on Codama 1.0.0 standard&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Industry Impact&lt;/strong&gt;: Technical choices by major projects prove Codama's maturity&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Go Ecosystem Dilemma&lt;/strong&gt;: Go developers cannot directly integrate these official program IDLs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;This situation highlights Cogoma's core value&lt;/strong&gt;: As the Solana Foundation promotes Codama standardization, the lack of native support in the Go ecosystem has become a severe technical bottleneck. Cogoma is the only Go library capable of directly parsing these official program IDLs.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Hierarchical Technical Architecture of IDL Formats
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Format Hierarchy
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Anchor IDL&lt;/strong&gt;: Concrete JSON implementation specifications&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shank IDL&lt;/strong&gt;: Another concrete JSON specification&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Codama IDL&lt;/strong&gt;: Abstract node type system&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Technical Inclusion Relationships
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Upper Compatibility&lt;/strong&gt;: Codama can fully represent all information from Anchor and Shank&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lower Limitations&lt;/strong&gt;: Concrete formats cannot express Codama's abstraction capabilities&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One-way Conversion&lt;/strong&gt;: Conversion from concrete to abstract is feasible, reverse conversion loses information&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  7. Performance Advantages of Go Implementation
&lt;/h3&gt;

&lt;p&gt;Go versions provide the following technical advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Zero Runtime Dependencies&lt;/strong&gt;: Direct compilation to native binaries without Node.js&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native Performance&lt;/strong&gt;: Go's concurrency model better suited for large-scale processing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory Efficiency&lt;/strong&gt;: Superior memory management and garbage collection&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deployment Simplification&lt;/strong&gt;: Single binary suitable for containerization and microservices&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cogoma Technical Implementation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Complete TypeScript Version Alignment
&lt;/h3&gt;

&lt;p&gt;Cogoma commits to 100% technical alignment with TypeScript Codama 1.3.4:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;67 Node Types&lt;/strong&gt;: Complete implementation of all node types as Go structs and interfaces&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Compatibility&lt;/strong&gt;: Maintain identical function signatures and behavior specifications&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code Generation Compatibility&lt;/strong&gt;: Ensure client code matches TypeScript version&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Go Language Technical Optimization
&lt;/h3&gt;

&lt;p&gt;Deep optimization for Go language characteristics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Generic Removal&lt;/strong&gt;: Convert TypeScript generic constraints to Go interface composition, improving compilation efficiency and code clarity&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native Type System&lt;/strong&gt;: Leverage Go struct embedding and interface composition for flexible type systems&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory Safety&lt;/strong&gt;: Utilize Go's automatic memory management to avoid pointer errors and memory leaks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Concurrency Safety&lt;/strong&gt;: Design thread-safe data structures for concurrent large-scale IDL processing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero-copy Optimization&lt;/strong&gt;: Reduce unnecessary data copying through reference passing and buffer reuse&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Multi-format Support Architecture
&lt;/h3&gt;

&lt;p&gt;Cogoma provides unified multi-format processing architecture:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Anchor IDL Support&lt;/strong&gt;: Full support for v0.0 and v0.1 versions, no format conversion required&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shank IDL Support&lt;/strong&gt;: Native parsing with support for all Shank specification features&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Codama Node Support&lt;/strong&gt;: Direct processing of abstract nodes without serialization/deserialization&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unified Interface&lt;/strong&gt;: Same API for different formats, achieving format agnosticism&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Modular Technical Architecture
&lt;/h3&gt;

&lt;p&gt;Project adopts clear package structure design:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;node_types&lt;/code&gt;: Core node type implementations with 67-node structure definitions&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;visitors&lt;/code&gt;: Visitor pattern implementation based on Go interfaces&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;nodes_from_anchor&lt;/code&gt;: Anchor IDL to Codama node converters&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;renderers_py&lt;/code&gt;: Code generators supporting multiple target languages&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. High-performance Processing Engine
&lt;/h3&gt;

&lt;p&gt;Cogoma implements the following performance optimizations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Zero-allocation Parsing&lt;/strong&gt;: Minimize memory allocation for improved processing speed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Concurrent Processing&lt;/strong&gt;: Support multi-threaded IDL processing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Caching Mechanisms&lt;/strong&gt;: Intelligent caching to reduce repetitive calculations&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stream Processing&lt;/strong&gt;: Support streaming parsing for large files&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Technical Achievements and Industry Value
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Achieved Technical Milestones
&lt;/h3&gt;

&lt;p&gt;Cogoma has accomplished the following key achievements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;100% Node Type Coverage&lt;/strong&gt;: Complete implementation of 67/67 node types, verified through unit testing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comprehensive Test Coverage&lt;/strong&gt;: High test coverage ensuring code quality and reliability&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complete Technical Documentation&lt;/strong&gt;: Bilingual documentation including API references and usage guides&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Production Validation&lt;/strong&gt;: Practical application verification in multiple Solana projects&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Technical Value for Developers
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Compile-time Type Safety&lt;/strong&gt;: Leverage Go's strong typing to avoid runtime errors&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Development Efficiency Improvement&lt;/strong&gt;: Automatic code generation reduces manual coding by 80%+&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Maintenance Cost Reduction&lt;/strong&gt;: Unified toolchain reduces multi-tool dependencies&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ecosystem Complementarity&lt;/strong&gt;: Enrich Go Solana development ecosystem&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Technical Impact
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Industry Standard Support&lt;/strong&gt;: Support for Solana Foundation's recommended Codama standard&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-language Generation&lt;/strong&gt;: Support TypeScript, Python, etc., &lt;strong&gt;Go version focuses on Go SDK generation&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Toolchain Integration&lt;/strong&gt;: Seamless integration with existing Go toolchains&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance Benchmarking&lt;/strong&gt;: Outperforms cross-language solutions in benchmarks&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Future Technical Roadmap
&lt;/h2&gt;

&lt;p&gt;Cogoma will continue to evolve in the following directions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Go SDK Generation&lt;/strong&gt;: Focus on high-quality Go client SDK generation, one language handles its own language&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance Optimization&lt;/strong&gt;: Optimize large-scale IDL processing for million-level nodes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ecosystem Integration&lt;/strong&gt;: Deep integration with mainstream Go libraries like solana-go&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advanced Validation&lt;/strong&gt;: Implement type inference, error reporting, and other advanced features&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IDE Support&lt;/strong&gt;: Provide Language Server Protocol support&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloud-native Optimization&lt;/strong&gt;: Support distributed IDL processing and caching&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Cogoma represents an important evolution in blockchain development toolchains. In the TypeScript-dominated IDL tools landscape, the Go version fills a critical technical gap. Through native performance, type safety, and modern architectural design, Cogoma enables Go developers to process Solana IDLs more efficiently and safely. As Solana ecosystem continues to grow, especially with increasing demand for high-performance infrastructure, Cogoma will become a crucial technical bridge connecting programs with client applications, driving deeper Go adoption in blockchain development.&lt;/p&gt;

&lt;p&gt;Special thanks to Codama author Lorisleiva for pioneering work. Author xiaodao has learned extensively from Codama and benefited greatly, gaining deep understanding of IDL abstraction layer design philosophy. Cogoma's implementation is based on the Codama standard (&lt;a href="https://github.com/codama-idl/codama" rel="noopener noreferrer"&gt;https://github.com/codama-idl/codama&lt;/a&gt;), with the TypeScript version as the ultimate reference, ensuring technical alignment. xiaodao doesn't intend to fragment the open-source community, but simply provides Go developers with an additional choice, reflecting the diversified development of the Solana ecosystem.&lt;/p&gt;

&lt;p&gt;Cogoma is not just a language port, but a rethinking of technical architecture, providing Go developers with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Native Performance&lt;/strong&gt;: Direct processing without cross-language calls&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type Safety&lt;/strong&gt;: Compile-time validation reliability&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Modern Architecture&lt;/strong&gt;: Modular, scalable design patterns&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Industry Standards&lt;/strong&gt;: Complete support for mainstream IDL standards&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This marks Go's important expansion from application layer to infrastructure layer in the Solana ecosystem, reflecting the ecosystem's diversified development. Cogoma project: &lt;a href="https://github.com/daog1/cogoma" rel="noopener noreferrer"&gt;https://github.com/daog1/cogoma&lt;/a&gt;&lt;/p&gt;

</description>
      <category>solana</category>
      <category>codama</category>
      <category>idl</category>
    </item>
    <item>
      <title>An Instruction Analysis MCP Usage Case</title>
      <dc:creator>晓道</dc:creator>
      <pubDate>Tue, 30 Sep 2025 02:22:24 +0000</pubDate>
      <link>https://dev.to/xiaodao/an-instruction-analysis-mcp-usage-case-4eel</link>
      <guid>https://dev.to/xiaodao/an-instruction-analysis-mcp-usage-case-4eel</guid>
      <description>&lt;h1&gt;
  
  
  An Instruction Analysis MCP Usage Case
&lt;/h1&gt;

&lt;p&gt;When developing MCP, we often use @modelcontextprotocol/inspector for direct calls. I just tried it directly with qwen, and it feels pretty good.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://solscan.io/tx/4kVvQfb4faVsGjwUoDa7Ez1RYSy6t4TdZ5uwVDt9Rdx8zsfbDqYHyx3YdRdah9YVCGd4GwgDiV7xPBeezRQwy1EU" rel="noopener noreferrer"&gt;Transaction tx: 4kVvQfb4faVsGjwUoDa7Ez1RYSy6t4TdZ5uwVDt9Rdx8zsfbDqYHyx3YdRdah9YVCGd4GwgDiV7xPBeezRQwy1EU&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The process is as follows:&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing MCP in Qwen
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;qwen mcp add sol-mcp -t http https://solmcp.daog1.workers.dev/mcp?apiKey={your_api_key}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Checking if MCP is effective
&lt;/h2&gt;

&lt;p&gt;Execute in qwen&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/mcp list
🟢 sol-mcp - Ready (4 tools)
   Tools:
   - analyze_instruction_data
   - analyze_solana_instruction
   - get_solana_transaction
   - get_transaction_with_inner_instructions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If it includes the above, it's ready.&lt;/p&gt;

&lt;h2&gt;
  
  
  Triggering MCP call with prompt
&lt;/h2&gt;

&lt;p&gt;I wrote it like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Help me get what happened to JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 in this Solana tx 4kVvQfb4faVsGjwUoDa7Ez1RYSy6t4TdZ5uwVDt9Rdx8zsfbDqYHyx3YdRdah9YVCGd4GwgDiV7xPBeezRQwy1EU
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Effect
&lt;/h2&gt;

&lt;p&gt;I used qwen to summarize the process directly and posted it below, followed by what qwen generated.&lt;/p&gt;

&lt;h2&gt;
  
  
  Detailed Explanation of Solana MCP (Multi-Chain Processing) Call Process
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is Solana MCP
&lt;/h3&gt;

&lt;p&gt;Solana MCP (Multi-Chain Processing) is a tool system for analyzing and processing complex transactions on the Solana blockchain, particularly suitable for analyzing multi-hop transactions, arbitrage transactions, and cross-protocol interactions. Through MCP tools, users can gain deep insights into the detailed operations within transactions, including embedded instructions, cross-protocol interactions, and token exchange paths.&lt;/p&gt;

&lt;h3&gt;
  
  
  MCP Call Process
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Initial Transaction Identification
&lt;/h4&gt;

&lt;p&gt;When a user needs to analyze a Solana transaction, they first need to obtain the transaction signature (Transaction Signature). The transaction signature is a unique identifier used to locate a specific transaction on the blockchain.&lt;/p&gt;

&lt;p&gt;For example: &lt;code&gt;4kVvQfb4faVsGjwUoDa7Ez1RYSy6t4TdZ5uwVDt9Rdx8zsfbDqYHyx3YdRdah9YVCGd4GwgDiV7xPBeezRQwy1EU&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Obtaining Basic Transaction Information
&lt;/h4&gt;

&lt;p&gt;Call the &lt;code&gt;get_solana_transaction&lt;/code&gt; function to obtain basic transaction information, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Transaction status (success/failure)&lt;/li&gt;
&lt;li&gt;Block height&lt;/li&gt;
&lt;li&gt;Fee&lt;/li&gt;
&lt;li&gt;Transaction timestamp&lt;/li&gt;
&lt;li&gt;Participating accounts&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  3. Deep Instruction Analysis
&lt;/h4&gt;

&lt;p&gt;Use the &lt;code&gt;get_transaction_with_inner_instructions&lt;/code&gt; function to deeply analyze each instruction in the transaction, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Top-level instructions&lt;/li&gt;
&lt;li&gt;Inner instructions (also known as CPI - Cross-Program Invocations)&lt;/li&gt;
&lt;li&gt;Parameters and data for each instruction&lt;/li&gt;
&lt;li&gt;List of executing accounts&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  4. Protocol Identification and Classification
&lt;/h4&gt;

&lt;p&gt;The MCP tool will automatically identify the protocols and programs involved in the transaction, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Jupiter DEX (JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4)&lt;/li&gt;
&lt;li&gt;Serum DEX (CMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK)&lt;/li&gt;
&lt;li&gt;Orca Whirlpool (whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc)&lt;/li&gt;
&lt;li&gt;Raydium pools&lt;/li&gt;
&lt;li&gt;Token Program (TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  5. Token Exchange Path Analysis
&lt;/h4&gt;

&lt;p&gt;Track the path for transactions involving token exchanges, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Input token type and quantity&lt;/li&gt;
&lt;li&gt;Output token type and quantity&lt;/li&gt;
&lt;li&gt;Exchange route (route plan)&lt;/li&gt;
&lt;li&gt;Slippage settings&lt;/li&gt;
&lt;li&gt;Price impact&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  6. Value Flow Analysis
&lt;/h4&gt;

&lt;p&gt;The MCP tool tracks the flow of tokens between different protocols, identifying:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Arbitrage opportunities&lt;/li&gt;
&lt;li&gt;Price difference utilization&lt;/li&gt;
&lt;li&gt;Cross-protocol fund flows&lt;/li&gt;
&lt;li&gt;Fund aggregation and dispersion&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  7. Risk Assessment
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Check for security risks&lt;/li&gt;
&lt;li&gt;Identify potential malicious operations&lt;/li&gt;
&lt;li&gt;Analyze the economic rationality of the transaction&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Actual Case Analysis
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Case: Complex Jupiter Arbitrage Transaction
&lt;/h4&gt;

&lt;p&gt;Taking the transaction &lt;code&gt;4kVvQfb4faVsGjwUoDa7Ez1RYSy6t4TdZ5uwVDt9Rdx8zsfbDqYHyx3YdRdah9YVCGd4GwgDiV7xPBeezRQwy1EU&lt;/code&gt; as an example:&lt;/p&gt;

&lt;p&gt;This transaction executed a complex arbitrage operation through Jupiter DEX.&lt;/p&gt;

&lt;h5&gt;
  
  
  Jupiter DEX Operation Details
&lt;/h5&gt;

&lt;p&gt;This transaction executed two main exchange operations through Jupiter V6:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First Jupiter Route (Instruction 1)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Program: Jupiter V6&lt;/li&gt;
&lt;li&gt;Type: route&lt;/li&gt;
&lt;li&gt;Route Plan:

&lt;ul&gt;
&lt;li&gt;Use RaydiumClmmV2 pool, 100% conversion (inputIndex 0 → outputIndex 1)&lt;/li&gt;
&lt;li&gt;Use SolFiV2 pool, 100% conversion (inputIndex 1 → outputIndex 2)&lt;/li&gt;
&lt;li&gt;Use RaydiumClmm pool, 100% conversion (inputIndex 2 → outputIndex 3)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Input Amount: 71,500,000 lamports (0.0715 SOL)&lt;/li&gt;

&lt;li&gt;Expected Output: 2,683,896 (corresponding to outputIndex 3 token)&lt;/li&gt;

&lt;li&gt;Slippage: 0.05% (5 basis points)&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Second Jupiter Route (Instruction 2)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Program: Jupiter V6&lt;/li&gt;
&lt;li&gt;Type: route&lt;/li&gt;
&lt;li&gt;Route Plan:

&lt;ul&gt;
&lt;li&gt;Use Whirlpool pool, 100% conversion (inputIndex 0 → outputIndex 1)&lt;/li&gt;
&lt;li&gt;Use GoonFi pool, 100% conversion (inputIndex 1 → outputIndex 2)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Input Amount: 2,683,896&lt;/li&gt;

&lt;li&gt;Expected Output: 71,515,882&lt;/li&gt;

&lt;li&gt;Slippage: 0.01% (1 basis point)&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Jupiter Swap Events Record (swapEvents)&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Instruction 7&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Through CMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK (Serum DEX) AMM&lt;/li&gt;
&lt;li&gt;Input SOL: 71,500,000 lamports&lt;/li&gt;
&lt;li&gt;Output pumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn: 2,746,079,690&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Instruction 11&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Through SV2EYYJyRz2YhfXwXnhNAevDEui5Q6yrfyo13WtupPF AMM&lt;/li&gt;
&lt;li&gt;Input pumpCmXqMfrsAkQ5r49WcJnRayYRqmXz6ae8H7H9Dfn: 2,746,079,690&lt;/li&gt;
&lt;li&gt;Output USDC (EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v): 15,077,885&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Instruction 15&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Through HpNfyc2Saw7RKkQd8nEL4khUcuPhQ7WwY1B2qjx8jxFq AMM&lt;/li&gt;
&lt;li&gt;Input USDC: 15,077,885&lt;/li&gt;
&lt;li&gt;Output PYTH (27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4): 2,683,936&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Instruction 19&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Through whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc (Orca Whirlpool) AMM&lt;/li&gt;
&lt;li&gt;Input PYTH: 2,683,896&lt;/li&gt;
&lt;li&gt;Output USDC: 15,077,787&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Instruction 23&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Through goonERTdGsjnkZqWuVjs73BZ3Pb9qoCUdBUL17BnS5j AMM&lt;/li&gt;
&lt;li&gt;Input USDC: 15,077,787&lt;/li&gt;
&lt;li&gt;Output SOL: 71,510,809 lamports&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Complete exchange path as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SOL (0.0715) →
RaydiumClmmV2 → SolFiV2 → RaydiumClmm →
Pump.fun token (2,746,079,690) →
USDC (15.08) →
PYTH token (2.68) →
USDC (15.08) →
Orca Whirlpool →
USDC (15.08) →
GoonFi →
SOL (0.071510809)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Through this path, approximately 0.000010809 SOL in arbitrage profit was achieved.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages of MCP Tools
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Comprehensiveness&lt;/strong&gt;: Able to analyze every detail of the transaction, including inner instructions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ease of Use&lt;/strong&gt;: Provides structured output, making it easy to understand complex multi-protocol interactions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real-time&lt;/strong&gt;: Directly obtains data from the blockchain, ensuring accuracy and timeliness&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Protocol Support&lt;/strong&gt;: Supports mainstream Solana protocols, including DEXes, lending protocols, yield aggregators, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analysis Depth&lt;/strong&gt;: Not only shows what happened in the transaction, but also explains why it happened&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Application Scenarios
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Transaction Auditing&lt;/strong&gt;: Helps developers and users understand the execution process of complex transactions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Arbitrage Analysis&lt;/strong&gt;: Identifies and analyzes arbitrage opportunities&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Analysis&lt;/strong&gt;: Detects potential malicious transactions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Research Analysis&lt;/strong&gt;: Studies market behavior and protocol interaction patterns&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Educational Purposes&lt;/strong&gt;: Helps users understand the internal mechanisms of DeFi transactions&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Solana MCP is a powerful tool capable of deeply parsing complex multi-protocol transactions on the Solana chain. Through a systematic analysis process, users can clearly understand every aspect of the transaction, which is valuable for DeFi participants, protocol developers, and security researchers.&lt;/p&gt;

&lt;p&gt;The design of MCP tools makes analyzing complex cross-protocol interactions simpler and more understandable, contributing to the transparency and security of the Solana ecosystem.&lt;/p&gt;

</description>
      <category>solana</category>
      <category>mcp</category>
      <category>idl</category>
    </item>
    <item>
      <title>Introduction to Solana Instruction Parsing MCP</title>
      <dc:creator>晓道</dc:creator>
      <pubDate>Sun, 28 Sep 2025 11:45:14 +0000</pubDate>
      <link>https://dev.to/xiaodao/introduction-to-solana-instruction-parsing-mcp-1mk6</link>
      <guid>https://dev.to/xiaodao/introduction-to-solana-instruction-parsing-mcp-1mk6</guid>
      <description>&lt;p&gt;Yesterday, I released the Solana instruction parsing MCP I built recently on the internet. I noticed that many people liked and followed me, but not many actually used it. I feel this is still worth trying, and combined with AI, it can be very useful.&lt;/p&gt;

&lt;p&gt;The address is &lt;a href="https://solmcp.daog1.workers.dev/" rel="noopener noreferrer"&gt;solmcp&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction to Solana Instruction Parsing MCP
&lt;/h2&gt;

&lt;p&gt;The examples inside use MCP Inspector for calling. Why use this? AI can call MCP relying on AI's capabilities, the capabilities of MCP functions, looking at input and output.&lt;br&gt;
MCP has the ability to parse instructions in formats like anchor, shank, codama. The parsing data comes from over 1k IDL datasets I collected.&lt;/p&gt;

&lt;p&gt;The parsed tx inside comes from&lt;br&gt;
&lt;a href="https://solscan.io/tx/4mSCpNds15mvygBex3aCfyMyZ8JYyzTuNikeYT2LgADH5DZgz6jnMZkLuwhAmqUHRVu2LXgmcVxXzeRvXPesPb5a" rel="noopener noreferrer"&gt;4mSCpNds15mvygBex3aCfyMyZ8JYyzTuNikeYT2LgADH5DZgz6jnMZkLuwhAmqUHRVu2LXgmcVxXzeRvXPesPb5a&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Main functions: 4 functions:
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  get_solana_transaction
  analyze_solana_instruction
  analyze_instruction_data
  get_transaction_with_inner_instructions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Feature Showcase
&lt;/h3&gt;
&lt;h4&gt;
  
  
  analyze_solana_instruction (analyze based on instruction index in tx)
&lt;/h4&gt;

&lt;p&gt;Defined as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;  &lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;analyze_solana_instruction&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Deep-dive analysis of a specific instruction within a Solana transaction. Parses the instruction data, identifies the program and function called, extracts parameters, and provides security risk assessment.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;signature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Transaction signature (base58-encoded string, 88 characters)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="na"&gt;instruction_index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;number&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Zero-based index of the instruction within the transaction (0 for first instruction)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="na"&gt;rpc_endpoint&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;optional&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Solana RPC endpoint URL (defaults to mainnet-beta if not specified)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Input:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;signature: 4mSCpNds15mvygBex3aCfyMyZ8JYyzTuNikeYT2LgADH5DZgz6jnMZkLuwhAmqUHRVu2LXgmcVxXzeRvXPesPb5a
instruction_index: 6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
🔬 **Instruction Detailed Analysis**

**Instruction #6:**
- Program: Jupiter V6
- Program ID: JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4
- accountsInvolved: 38
- instructionName: route

**Instruction Parameters:**
- routePlan: [{"swap":{"__kind":"SolFiV2","isQuoteToBase":false},"percent":100,"inputIndex":0,"outputIndex":1},{"swap":{"__kind":"SolFiV2","isQuoteToBase":true},"percent":100,"inputIndex":1,"outputIndex":2}]
- inAmount: 249434750
- quotedOutAmount: 50066910
- slippageBps: 50
- platformFeeBps: 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  analyze_instruction_data (analyze based on program id and instruction data)
&lt;/h4&gt;

&lt;p&gt;Defined as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;  &lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;analyze_instruction_data&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Parse raw Solana instruction data to extract function names and parameters. Supports IDL-based parsing for known programs, with automatic fallback to generic instruction parsing for unknown programs.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;program_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;The program ID (public key) that this instruction calls&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="na"&gt;instruction_data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Raw instruction data as hex string (without 0x prefix) or base64 string&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="na"&gt;accounts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()).&lt;/span&gt;&lt;span class="nf"&gt;optional&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Array of account public keys involved in this instruction (for context)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="na"&gt;data_format&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;enum&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hex&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;optional&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hex&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Format of the instruction_data parameter ('hex' or 'base64')&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="na"&gt;idl_file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;optional&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Name of IDL file to use for parsing (searches in stored IDL collection)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Input:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;program_id: JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4
instruction_data: e517cb977ae3ad2a020000005f006400015f016401027e12de0e00000000def5fb0200000000320000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;🔍 **Instruction Data Analysis Report**

**Program Information:**
- Program ID: JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4
- Program Name: Jupiter V6

**Instruction Information:**
- Instruction Name: route
- Description: IDL parsing: route

**Instruction Parameters:**
- routePlan: [{"swap":{"__kind":"SolFiV2","isQuoteToBase":false},"percent":100,"inputIndex":0,"outputIndex":1},{"swap":{"__kind":"SolFiV2","isQuoteToBase":true},"percent":100,"inputIndex":1,"outputIndex":2}]
- inAmount: 249434750
- quotedOutAmount: 50066910
- slippageBps: 50
- platformFeeBps: 0

**Parsing Status:**
🔄 Using built-in parsing

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

&lt;/div&gt;



&lt;h4&gt;
  
  
  get_transaction_with_inner_instructions (Analyze internal instructions based on tx and program ID)
&lt;/h4&gt;

&lt;p&gt;Defined as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;  &lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;get_transaction_with_inner_instructions&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Retrieve a Solana transaction and recursively parse all inner instructions (CPIs). Returns a hierarchical view of instruction execution with optional filtering by specific program IDs.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;signature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Transaction signature (base58-encoded string, 88 characters)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="na"&gt;filter_program_ids&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;optional&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Array of program IDs to filter results - only instructions calling these programs will be included&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="na"&gt;rpc_endpoint&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;optional&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Solana RPC endpoint URL (defaults to mainnet-beta if not specified)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Input:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;signature: 4mSCpNds15mvygBex3aCfyMyZ8JYyzTuNikeYT2LgADH5DZgz6jnMZkLuwhAmqUHRVu2LXgmcVxXzeRvXPesPb5a
filter_program_ids: [JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will get:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
🔍 **Transaction Instruction Parameter Analysis**
**Program filter:** JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4,

**Basic Information:**
- Signature: 4mSCpNds15mvygBex3aCfyMyZ8JYyzTuNikeYT2LgADH5DZgz6jnMZkLuwhAmqUHRVu2LXgmcVxXzeRvXPesPb5a
- Status: ✅ Success
- Block: 369808306
- Fee: 0.00005693 SOL

**Instruction Parameter Details:**
**Instruction 1:**
- Program: Jupiter V6
- Program ID: JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4
- Instruction type: route
- Accounts involved: 38

**Parameters:**
- routePlan: [{"swap":{"__kind":"SolFiV2","isQuoteToBase":false},"percent":100,"inputIndex":0,"outputIndex":1},{"swap":{"__kind":"SolFiV2","isQuoteToBase":true},"percent":100,"inputIndex":1,"outputIndex":2}]
- inAmount: 249434750
- quotedOutAmount: 50066910
- slippageBps: 50
- platformFeeBps: 0

**Instruction 2:**
- Program: Jupiter V6
- Program ID: JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4
- Instruction type: swapEvent
- Accounts involved: 0

**Parameters:**
- amm: SV2EYYJyRz2YhfXwXnhNAevDEui5Q6yrfyo13WtupPF
- inputMint: So11111111111111111111111111111111111111112
- inputAmount: 249434750
- outputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
- outputAmount: 50079655

**Instruction 3:**
- Program: Jupiter V6
- Program ID: JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4
- Instruction type: swapEvent
- Accounts involved: 0

**Parameters:**
- amm: SV2EYYJyRz2YhfXwXnhNAevDEui5Q6yrfyo13WtupPF
- inputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
- inputAmount: 50079655
- outputMint: Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
- outputAmount: 50050803

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

&lt;/div&gt;



</description>
      <category>solana</category>
      <category>anchor</category>
      <category>shank</category>
      <category>codama</category>
    </item>
    <item>
      <title>使用 Lumen AI 简化 Git Commit 信息生成</title>
      <dc:creator>晓道</dc:creator>
      <pubDate>Sat, 14 Jun 2025 07:58:21 +0000</pubDate>
      <link>https://dev.to/xiaodao/shi-yong-lumen-ai-jian-hua-git-commit-xin-xi-sheng-cheng-439a</link>
      <guid>https://dev.to/xiaodao/shi-yong-lumen-ai-jian-hua-git-commit-xin-xi-sheng-cheng-439a</guid>
      <description>&lt;p&gt;作为一名开发者，参与开源项目时，编写清晰的 Git commit 信息可能是一项繁琐的任务，尤其是对英语非母语的开发者。&lt;a href="https://github.com/jnsahaj/lumen" rel="noopener noreferrer"&gt;Lumen&lt;/a&gt; 是一个利用 AI 自动生成 commit 信息的工具，大大简化了这一过程。本文将分享如何使用 Lumen、解决常见问题，并提供一个 Fish shell 脚本优化工作流。&lt;/p&gt;

&lt;h2&gt;
  
  
  快速上手
&lt;/h2&gt;

&lt;p&gt;Lumen 的核心功能是通过分析代码变更生成符合规范的 commit 信息。基本用法非常简单：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lumen draft
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;例如，修改了 &lt;code&gt;README.md&lt;/code&gt; 文件后运行：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lumen draft
feat&lt;span class="o"&gt;(&lt;/span&gt;README&lt;span class="o"&gt;)&lt;/span&gt;: Add &lt;span class="nb"&gt;test &lt;/span&gt;section
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;这会生成一条 commit 信息，但仅显示而未提交。如果想直接提交，可以结合 Git 命令：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lumen draft | git commit &lt;span class="nt"&gt;-F&lt;/span&gt; -
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;这将生成 commit 信息并直接提交。&lt;/p&gt;

&lt;h2&gt;
  
  
  解决问题
&lt;/h2&gt;

&lt;p&gt;运行 &lt;code&gt;lumen draft&lt;/code&gt; 时，可能会遇到以下错误：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;error: diff &lt;span class="o"&gt;(&lt;/span&gt;staged&lt;span class="o"&gt;)&lt;/span&gt; is empty
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;这是因为 Lumen 默认调用 &lt;code&gt;git diff --staged&lt;/code&gt;，而你尚未使用 &lt;code&gt;git add&lt;/code&gt; 添加文件到暂存区，导致 diff 为空。&lt;/p&gt;

&lt;h3&gt;
  
  
  解决方法
&lt;/h3&gt;

&lt;p&gt;修改 Lumen 源代码以使用 &lt;code&gt;git diff&lt;/code&gt;（而非 &lt;code&gt;git diff --staged&lt;/code&gt;）。具体步骤：&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;下载 Lumen 源代码（&lt;a href="https://github.com/jnsahaj/lumen" rel="noopener noreferrer"&gt;https://github.com/jnsahaj/lumen&lt;/a&gt;）。&lt;/li&gt;
&lt;li&gt;编辑 &lt;code&gt;src/command/mod.rs&lt;/code&gt; 文件，第 45 行左右，将 &lt;code&gt;Diff::from_working_tree(true)&lt;/code&gt; 改为 &lt;code&gt;false&lt;/code&gt;：
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gh"&gt;diff --git a/src/command/mod.rs b/src/command/mod.rs
index b51a8d1..c643a5b 100644
&lt;/span&gt;&lt;span class="gd"&gt;--- a/src/command/mod.rs
&lt;/span&gt;&lt;span class="gi"&gt;+++ b/src/command/mod.rs
&lt;/span&gt;&lt;span class="p"&gt;@@ -42,7 +42,7 @@&lt;/span&gt; impl CommandType {
             }
             CommandType::List =&amp;gt; Box::new(ListCommand),
             CommandType::Draft(context, draft_config) =&amp;gt; Box::new(DraftCommand {
&lt;span class="gd"&gt;-                git_entity: GitEntity::Diff(Diff::from_working_tree(true)?),
&lt;/span&gt;&lt;span class="gi"&gt;+                git_entity: GitEntity::Diff(Diff::from_working_tree(false)?),
&lt;/span&gt;                 draft_config,
                 context,
             }),
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;保存后重新编译运行，&lt;code&gt;lumen draft&lt;/code&gt; 即可基于工作目录的更改生成 commit 信息。&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  优化工作流：Fish Shell 脚本
&lt;/h2&gt;

&lt;p&gt;为避免 AI 生成的 commit 信息直接提交（可能包含错误），可以使用 &lt;a href="https://github.com/charmbracelet/gum" rel="noopener noreferrer"&gt;gum&lt;/a&gt; 工具添加确认步骤。以下是一个 Fish shell 函数，自动生成 commit 信息并提供确认选项：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function aic
    set RESULT (lumen draft)
    echo $RESULT
    echo "Committing..."
    gum confirm "是否提交代码？" &amp;amp;&amp;amp; git commit -a -m "$RESULT" || echo "已取消提交"
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  使用方法
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;确保已安装 &lt;code&gt;lumen&lt;/code&gt; 和 &lt;code&gt;gum&lt;/code&gt;。&lt;/li&gt;
&lt;li&gt;将上述函数添加到你的 Fish shell 配置文件（通常是 &lt;code&gt;~/.config/fish/config.fish&lt;/code&gt;）。&lt;/li&gt;
&lt;li&gt;修改代码后运行 &lt;code&gt;aic&lt;/code&gt;，查看生成的 commit 信息，确认后提交或取消。&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  总结
&lt;/h2&gt;

&lt;p&gt;Lumen 是一个强大的工具，能帮助开发者快速生成规范的 Git commit 信息。通过简单的代码修改，可以解决 &lt;code&gt;git diff --staged&lt;/code&gt; 的限制。结合 Fish shell 和 gum 工具，你可以进一步优化工作流，确保提交前能够检查 AI 生成的结果。这个方案特别适合非英语母语的开发者，提升效率的同时保持提交信息的质量。&lt;/p&gt;

</description>
      <category>ai</category>
      <category>lumen</category>
      <category>git</category>
      <category>commit</category>
    </item>
    <item>
      <title>用 Go 监控 PumpSwap 流动性：三步搞定</title>
      <dc:creator>晓道</dc:creator>
      <pubDate>Mon, 07 Apr 2025 02:10:22 +0000</pubDate>
      <link>https://dev.to/xiaodao/yong-go-jian-kong-pumpswap-liu-dong-xing-san-bu-gao-ding-16oc</link>
      <guid>https://dev.to/xiaodao/yong-go-jian-kong-pumpswap-liu-dong-xing-san-bu-gao-ding-16oc</guid>
      <description>&lt;p&gt;最近我基于 Pump.fun 的 pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA.json IDL，用我的 solana-anchor-go 项目写了个简单工具，实时监控 PumpSwap 的流动性事件（比如新池子创建），特别适合抢开盘或分析市场。我把过程浓缩成三步，代码清晰又实用。如果觉得不错，欢迎到 solana-anchor-go 点个 star 支持！&lt;/p&gt;

&lt;p&gt;前提准备&lt;br&gt;
环境：Go 1.18+，Solana RPC 节点（推荐 helius 申请个免费的账号，或者&lt;a href="https://api.mainnet-beta.solana.com%EF%BC%89%E3%80%82" rel="noopener noreferrer"&gt;https://api.mainnet-beta.solana.com）。&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;依赖：安装我的 solana-anchor-go：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;go install github.com/daog1/solana-anchor-go@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;IDL：PumpSwap 的 IDL 文件，在 github 仓库里面有（假设你已下载为 pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA.json）。&lt;/p&gt;

&lt;h2&gt;
  
  
  步骤 1：生成 IDL 的 Go 接口
&lt;/h2&gt;

&lt;p&gt;用 solana-anchor-go 把 pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA.json 转换为 Go 代码，生成 PumpSwap 的接口。&lt;/p&gt;

&lt;p&gt;运行以下命令：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;solana-anchor-go -src=pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;这会生成 generated/pump_amm包,包里面的内容和idl文件中的指令定义、账号、事件一一对应.比如 CreatePoolEventEventData（新池创建事件）。&lt;/p&gt;

&lt;h2&gt;
  
  
  步骤 2：监听 PumpSwap 事件
&lt;/h2&gt;

&lt;p&gt;PumpSwap 的程序 ID 是 pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA。我们用 Go 订阅它的日志。&lt;/p&gt;

&lt;p&gt;代码如下：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import (
    "context"
    "log"

    "github.com/gagliardetto/solana-go"
    "github.com/gagliardetto/solana-go/rpc"
    "github.com/gagliardetto/solana-go/rpc/ws"
)

func main() {
    // 连接 WebSocket
    client, err := ws.Connect(context.Background(), "wss://api.mainnet-beta.solana.com")
    if err != nil {
        log.Fatalf("连接失败: %v", err)
    }
    defer client.Close()

    // PumpSwap 程序 ID
    programID := solana.MustPublicKeyFromBase58("pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA")

    // 订阅日志
    sub, err := client.LogsSubscribeMentions(
        programID,
        rpc.CommitmentRecent,
        )
    if err != nil {
        log.Fatalf("订阅失败: %v", err)
    }
    defer sub.Unsubscribe()

    log.Println("开始监听 PumpSwap 事件...")

    // 接收日志
    for {
        logResult, err := sub.Recv(context.Background())
        if err != nil {
            log.Printf("接收失败: %v", err)
            continue
        }
        for _, logLine := range logResult.Value.Logs {
            log.Printf("新日志: %s", logLine)
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;运行后，它会实时打印 PumpSwap 的日志，比如 PoolCreatedEvent。&lt;/p&gt;

&lt;h2&gt;
  
  
  步骤 3：解析 PoolCreatedEvent
&lt;/h2&gt;

&lt;p&gt;从 IDL 看，PoolCreatedEvent 是我们要监控的流动性事件，包含字段如 mint（代币地址）和 initial_liquidity（初始流动性）。用生成的 pumpswap.go 解析日志。&lt;/p&gt;

&lt;p&gt;更新 for 循环：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for {
    logResult, err := sub.Recv(context.Background())
    if err != nil {
        log.Printf("接收失败: %v", err)
        continue
    }
    evts, err := pump_amm.DecodeEvents(logResult.Value.Logs)
    for _, ev := range evts {
        if ev.Name == "CreatePoolEvent" {
            trEv := ev.Data.(*pump_amm.CreatePoolEventEventData)
            fmt.Printf("creator %s pool %s tx:%s\n", trEv.Creator, trEv.Pool, logResult.Value.Signature)
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;完整代码 将 生成的 idl 解析代码和监听逻辑结合起来，保存为 app.go，然后：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;go run main.go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;输出示例：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2025/04/04 10:37:02 开始监听 PumpSwap 事件...
creator HwEfk69xeLu9MnLuqnrJEwn6iAkVg9QLqyVoLPdfSqGP pool Ed88ivvjJc2YqNQmyPXmwCjghhCe5kHa5wYAM5Z4Encs tx:EpytFhamRhk5QDdj85qYJ2yiirsg48gW6XuXrJiRjeqEGfSo1xK11NqL2TzBvXsSdVoJ832Kgx1pA7CyxNBGKHG
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;需要更多的事件类型和字段解析，可以在这个代码的基础上进行添加修改。&lt;/p&gt;

&lt;p&gt;总结&lt;br&gt;
其实写 solana 监听和 evm 监听没多大区别，主要是找对工具。&lt;/p&gt;

&lt;p&gt;solana-anchor-go 是一个挺强大的 golang solana 链交互工具，只要是 anchor 开发的 solana 应用有 idl 都可以生成应用代码进行链交互。&lt;/p&gt;

&lt;p&gt;这个工具根据我的应用需求进行了修复，发交易，解交易均没问题。目前 anchor 0.30.1 的 idl 都可以使用，anchor 以前的版本，可以按照，solana-anchor-go 的文档进行先转换，再使用。&lt;/p&gt;

&lt;p&gt;完整代码放在: &lt;a href="https://github.com/daog1/pumpgo" rel="noopener noreferrer"&gt;https://github.com/daog1/pumpgo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;solana-anchor-go 在：&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/daog1/solana-anchor-go" rel="noopener noreferrer"&gt;https://github.com/daog1/solana-anchor-go&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>go调用solidity合约新方法</title>
      <dc:creator>晓道</dc:creator>
      <pubDate>Sat, 21 Dec 2024 05:54:31 +0000</pubDate>
      <link>https://dev.to/xiaodao/godiao-yong-solidityhe-yue-xin-fang-fa-lp2</link>
      <guid>https://dev.to/xiaodao/godiao-yong-solidityhe-yue-xin-fang-fa-lp2</guid>
      <description>&lt;p&gt;上周在群聊吹牛，吹吹我写的golang 调用solana合约的东西。有人说他要学习go调用solidity的方法。我看了看我在登链的无abi调用合约的方法，写的python的，ethers的，solidity的，就是没写golang的，确实可以写写。&lt;/p&gt;

&lt;p&gt;那个群里人都说用chatgpt都会用abigen的方式生成go包的方式调用合约方法。&lt;br&gt;
所以我讲种不需要使用abigen生成go包的方法调用合约。&lt;/p&gt;

&lt;p&gt;我还是喜欢使用我的晓道fork版，&lt;a href="https://github.com/daog1/ethgo" rel="noopener noreferrer"&gt;https://github.com/daog1/ethgo&lt;/a&gt;&lt;br&gt;
fork自，&lt;a href="https://github.com/umbracle/ethgo" rel="noopener noreferrer"&gt;umbracle/ethgo&lt;/a&gt;&lt;br&gt;
好处我不讲，自己读代码。&lt;/p&gt;

&lt;p&gt;合约调用最早都是需要abi文件生成的方式，后面还是有了更简单方式，最早我是ethers里面看到叫&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A Human-Readable ABI&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;ethers是这么写的：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// A Human-Readable ABI; for interacting with the contract, we
// must include any fragment we wish to use
const abi = [
    // Read-Only Functions
    "function balanceOf(address owner) view returns (uint256)",
    "function decimals() view returns (uint8)",
    "function symbol() view returns (string)",

    // Authenticated Functions
    "function transfer(address to, uint amount) returns (bool)",

    // Events
    "event Transfer(address indexed from, address indexed to, uint amount)"
];

// This can be an address or an ENS name
const address = "0x70ff5c5B1Ad0533eAA5489e0D5Ea01485d530674";

// Read-Only; By connecting to a Provider, allows:
// - Any constant function
// - Querying Filters
// - Populating Unsigned Transactions for non-constant methods
// - Estimating Gas for non-constant (as an anonymous sender)
// - Static Calling non-constant methods (as anonymous sender)
const erc20 = new ethers.Contract(address, abi, provider);

// Read-Write; By connecting to a Signer, allows:
// - Everything from Read-Only (except as Signer, not anonymous)
// - Sending transactions for non-constant functions
const erc20_rw = new ethers.Contract(address, abi, signer);

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

&lt;/div&gt;



&lt;p&gt;ethgo 有点fork ethers的意思，所以也支持Human-Readable ABI 的方式。&lt;br&gt;
代码这么写&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;package main

import (
    "fmt"
    "math/big"

    "github.com/umbracle/ethgo"
    "github.com/umbracle/ethgo/abi"
    "github.com/umbracle/ethgo/contract"
    "github.com/umbracle/ethgo/jsonrpc"
)

func handleErr(err error) {
    if err != nil {
        panic(err)
    }
}

func main() {
    var functions = []string{
        "function totalSupply() view returns (uint256)",  //Human-Readable ABI 
    }

    abiContract, err := abi.NewABIFromList(functions)
    handleErr(err)

    // Matic token
    addr := ethgo.HexToAddress("0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0") 

    client, err := jsonrpc.NewClient("https://eth.llamarpc.com")
    handleErr(err)

    c := contract.NewContract(addr, abiContract, contract.WithJsonRPC(client.Eth()))
    res, err := c.Call("totalSupply", ethgo.Latest)  //call totalSupply
    handleErr(err)

    fmt.Printf("TotalSupply: %s", res["0"].(*big.Int))
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;原版代码在这里：&lt;a href="https://github.com/daog1/ethgo/blob/main/examples/contract-call-basic.go" rel="noopener noreferrer"&gt;https://github.com/daog1/ethgo/blob/main/examples/contract-call-basic.go&lt;/a&gt;&lt;br&gt;
我的那个fork 版，如果你发现什么问题，可以跟我说。&lt;br&gt;
我一般都用Human-Readable ABI 的方式调用，abigen这种太麻烦了，容易搞错。&lt;/p&gt;

</description>
      <category>solidity</category>
      <category>go</category>
    </item>
    <item>
      <title>solana 获取钱包token余额，及优化</title>
      <dc:creator>晓道</dc:creator>
      <pubDate>Tue, 17 Dec 2024 02:33:44 +0000</pubDate>
      <link>https://dev.to/xiaodao/solana-huo-qu-qian-bao-tokenyu-e-ji-you-hua-3enb</link>
      <guid>https://dev.to/xiaodao/solana-huo-qu-qian-bao-tokenyu-e-ji-you-hua-3enb</guid>
      <description>&lt;p&gt;这几天练习使用golang调用solana合约，切换一门语言，感觉不那么轻松，搞evm的时候，有ethereum的代码是go实现的，感觉golang 像是evm第一语言。&lt;br&gt;
早上的时候，看群友提问&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;需求&lt;br&gt;
1.想判断solana地址是否合法&lt;br&gt;
2.想判断合法地址下，是否持有三个token中的任意一个，即balance &amp;gt; 1&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;刚好做练习，所以简单写写，思路如下：&lt;br&gt;
用钱包地址和token地址算token的账号地址，再调用GetTokenAccountBalance&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lokey :=solana.MustPublicKeyFromBase58("HgJ5zad5N4pwKpAM8HQDA3g2r2H7EMLVN6S5HvHdiNyR") //钱包地址
tokenmint := solana.MustPublicKeyFromBase58("J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn") //token 地址
tokenacc, _, _ := solana.FindAssociatedTokenAddress(lokey, tokenmint) //算出token账号地址
outtbl, err = client.GetTokenAccountBalance(context.Background(), tokenacc,rpc.CommitmentFinalized)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;后面群友提出更高效的方案：&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;可以用 rpc getMultipleAccounts 一次请求几百个token账户，批量拿几次应该就够了，降低helius rpc的额度消耗，同时性能也好&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;相对来说群友这个方法更好，毕竟helius的rpc都是有限额的，一条能搞定，就不要搞3条&lt;/p&gt;

&lt;p&gt;这个思路上有一点点差异，这个是获取的账号数据，所以代码这么写：&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//获取token 账号代码和前面一样
out, _ := client.GetMultipleAccounts(context.Background(), lokey, tokenacc, tokenacc2, tokenacc3, tokenacc4)
for _, ov := range out.Value {
    if ov != nil {
    if ov.Owner.String() == "11111111111111111111111111111111" { 
            log.Debugf("acc %s,bl %d", ov.Owner.String(), ov.Lamports)
    } else {
            var ta token.Account
            err = bin.NewBinDecoder(ov.Data.GetBinary()).Decode(&amp;amp;ta)
            log.Debugf("acc %s,bl %d", ta.Owner.String(), ta.Amount)
    }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;我就随便发发，做做笔记，欢迎交流。&lt;/p&gt;

</description>
      <category>solana</category>
      <category>go</category>
    </item>
    <item>
      <title>solana是如何算seed地址</title>
      <dc:creator>晓道</dc:creator>
      <pubDate>Tue, 17 Dec 2024 02:27:22 +0000</pubDate>
      <link>https://dev.to/xiaodao/solanashi-ru-he-suan-seeddi-zhi-d6p</link>
      <guid>https://dev.to/xiaodao/solanashi-ru-he-suan-seeddi-zhi-d6p</guid>
      <description>&lt;p&gt;最近在用golang调用solana合约，发现没有rust和ts简单，以及一些小的失误，导致我算的seed地址和ts算的有些不一样，所以深入研究了一番。&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const PDA_MARKER = "ProgramDerivedAddress"
// Create a program address.
// Ported from https://github.com/solana-labs/solana/blob/216983c50e0a618facc39aa07472ba6d23f1b33a/sdk/program/src/pubkey.rs#L204
func CreateProgramAddress(seeds [][]byte, programID PublicKey) (PublicKey, error) {
    if len(seeds) &amp;gt; MaxSeeds {
        return PublicKey{}, ErrMaxSeedLengthExceeded
    }

    for _, seed := range seeds {
        if len(seed) &amp;gt; MaxSeedLength {
            return PublicKey{}, ErrMaxSeedLengthExceeded
        }
    }

    buf := []byte{}
    for _, seed := range seeds {
        buf = append(buf, seed...)
    }

    buf = append(buf, programID[:]...)
    buf = append(buf, []byte(PDA_MARKER)...)
    hash := sha256.Sum256(buf)

    if IsOnCurve(hash[:]) {
        return PublicKey{}, errors.New("invalid seeds; address must fall off the curve")
    }

    return PublicKeyFromBytes(hash[:]), nil
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;这段代码的意思是你seeds bytes 数组，进行了连接再加了"ProgramDerivedAddress"，就是原始的message,再调用sha256.Sum256就可以算出来hash地址，IsOnCurve这函数是判断hash是不是在是否在 ed25519 曲线上，如果不在会改变你的seeds的最后一个参数，也就是bumpSeed的值，这个值是从255开始的，递减。&lt;/p&gt;

&lt;p&gt;加密世界的message基本都是加料了的，算签名的也是&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;keccak256("\x19\x01"),
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;有代码还是好，读读代码总会知道。&lt;/p&gt;

&lt;p&gt;另外去改了两个bug，发个链接：&lt;br&gt;
&lt;a href="https://github.com/daog1/solana-anchor-go" rel="noopener noreferrer"&gt;https://github.com/daog1/solana-anchor-go&lt;/a&gt;&lt;br&gt;
这是一个根据anchor idl生成 go 调用代码的项目。&lt;br&gt;
哪天你遇到了，你会懂&lt;/p&gt;

</description>
      <category>solana</category>
      <category>go</category>
      <category>anchor</category>
    </item>
    <item>
      <title>vyper挺好玩的</title>
      <dc:creator>晓道</dc:creator>
      <pubDate>Sat, 09 Nov 2024 02:20:48 +0000</pubDate>
      <link>https://dev.to/xiaodao/vyperting-hao-wan-de-2kok</link>
      <guid>https://dev.to/xiaodao/vyperting-hao-wan-de-2kok</guid>
      <description>&lt;p&gt;最近看人在star &lt;a href="https://github.com/WTFAcademy/WTF-Vyper/" rel="noopener noreferrer"&gt;WTF-Vyper&lt;/a&gt; 也点进去看了看，还是挺好玩的。&lt;br&gt;
语法上接近python，更简洁一些，类型检查又比python严格。&lt;br&gt;
solidity支持的，vyper都支持。&lt;br&gt;
有个周边的工具&lt;a href="https://github.com/vyperlang/titanoboa" rel="noopener noreferrer"&gt;boa&lt;/a&gt;,用起来的体验比chisel好得多。&lt;br&gt;
boa是一个类似chisel的合约交互式解释器。&lt;br&gt;
chisel功能单一，好多事情干不了，有点近似于solidity的宏，但是很多事情干不了，连定义变量，变量名重复都不支持。&lt;br&gt;
boa却是建立在python的基础上，变量什么的都是python,上链才是evm这一套，所以体验好了不少。&lt;br&gt;
chisel还缺乏一个，导入sol文件也不行，boa却可以导入vy的文件。&lt;br&gt;
先观察着吧，目前我的这些代码还是构建在solidity的基础上。&lt;br&gt;
我弄弄这个也不是因为缺乏，就是好奇。&lt;/p&gt;

</description>
      <category>vyper</category>
      <category>evm</category>
      <category>boa</category>
    </item>
    <item>
      <title>最近的一些情况</title>
      <dc:creator>晓道</dc:creator>
      <pubDate>Mon, 14 Oct 2024 10:57:38 +0000</pubDate>
      <link>https://dev.to/xiaodao/zui-jin-de-xie-qing-kuang-3g04</link>
      <guid>https://dev.to/xiaodao/zui-jin-de-xie-qing-kuang-3g04</guid>
      <description>&lt;p&gt;最近感觉zed越来越好用了，emacs有时候遇到奇怪的问题，还是不好排查，还是把zed用起来。&lt;br&gt;
写代码搞代码补全，读代码，gd,gr，还是挺好用的。&lt;br&gt;
zed 支持gd ,gD,好像mac上gD还有bug，所以还得简单配置一下&lt;br&gt;
keymap.json&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[
  {
    "context": "Editor &amp;amp;&amp;amp; vim_mode == normal",
    "bindings": {
      "g r": "editor::FindAllReferences"
    }
  }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;新学会一快捷键，g+space,可以跳转搜索结果里面的文件，还真不好找，问ai知道的。&lt;/p&gt;

</description>
    </item>
    <item>
      <title>一些想法</title>
      <dc:creator>晓道</dc:creator>
      <pubDate>Sat, 13 Jul 2024 01:31:25 +0000</pubDate>
      <link>https://dev.to/xiaodao/xie-xiang-fa-44mi</link>
      <guid>https://dev.to/xiaodao/xie-xiang-fa-44mi</guid>
      <description>&lt;p&gt;最近全面使用emacs，不过我感觉我快捷键还是没背熟，太多了，我其实是个很懒的人，也不是太依赖工具。感觉使用代码片段功能挺好用，像我这样，会个7、8种编程语言的，有些语法细节真不是太熟，平时也不太关注语法，所以啊，代码片段太有用了。自己加了一些常用代码片段进去，写代码又快了。提升效率确实是方方面面的事情。&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
