Snap Protocol Solana

by agentzeny

182 downloads
Not rated
GitHub

About

# SNAP — Shield Network Agent Payments Private agent-to-agent payments on Solana using zero-knowledge proofs. [![GitHub stars](https://img.shields.io/github/stars/agentzeny/snap-public?style=social)](https://github.com/agentzeny/snap-public/stargazers)…

Details

Author
agentzeny
Downloads
182
Categories
Other

- Shielded pool with cryptographic commitments and Groth16 proofs
- Poseidon hash in a depth‑10 Merkle tree for privacy
- Protocol fee of 0.25% per deposit/withdrawal
- Mainnet pools for 0.1 SOL, 1 USDC, and 10 USDC
- SDK, Solana Agent Kit plugin, and LangChain tool integrations
- Relayer service for gas‑abstracted private withdrawals

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Snap Protocol Solana
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install the snap-solana-sdk npm package along with @solana/web3.js and @coral-xyz/anchor. Use the SNAPClient class to make deposits and withdrawals. A deposit creates a secret note, which is sent to the recipient via a private channel; the recipient then generates a zero-knowledge proof and calls withdraw_zk or withdraw_zk_relayed to claim the funds. Run the examples with npx tsx examples/basic-payment.ts or npx tsx examples/agent-to-agent.ts.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "snap protocol solana": {
            "snap": {
                "command": "npx",
                "args": [
                    "tsx",
                    "snap-mcp-server.ts"
                ],
                "env": {
                    "SNAP_RPC_URL": "https://api.mainnet-beta.solana.com",
                    "SNAP_POOL_ADDRESS": "B8SyffZKt8LABKogWjH9rZcjY5PV2hyYRCbTxxbcrpFf"
                }
            }
        }
    }
}

McpServers

{
    "snap": {
        "command": "npx",
        "args": [
            "tsx",
            "snap-mcp-server.ts"
        ],
        "env": {
            "SNAP_RPC_URL": "https://api.mainnet-beta.solana.com",
            "SNAP_POOL_ADDRESS": "B8SyffZKt8LABKogWjH9rZcjY5PV2hyYRCbTxxbcrpFf"
        }
    }
}

SNAP — Shield Network Agent Payments

Private agent-to-agent payments on Solana using zero-knowledge proofs.

GitHub stars
snap-solana-sdk
snap-langchain-tools
License: MIT
Solana

> SNAP is live on Solana mainnet. See the security docs for the protocol's threat model and trust assumptions.

What SNAP Does

SNAP lets AI agents pay each other without on-chain observers learning who paid whom. Deposits enter a shielded pool under a cryptographic commitment. Withdrawals leave the pool with a Groth16 proof that shows the recipient is entitled to the funds without revealing which deposit is being claimed.

How It Works

1. Agent A deposits SOL plus a commitment into the pool.
2. Agent A sends a secret note to Agent B through a private channel.
3. Agent B reconstructs the Merkle path and generates a Groth16 proof.
4. Agent B withdraws SOL with withdraw_zk or withdraw_zk_relayed.
5. Observers can see the pool activity, but they cannot link the withdrawal to a specific deposit.

Quick Start

Install the SDK and its peer dependencies:

npm install snap-solana-sdk @solana/web3.js @coral-xyz/anchor

Minimal private payment:

import { Connection, Keypair, PublicKey, clusterApiUrl } from "@solana/web3.js";
import { SNAPClient } from "snap-solana-sdk";

async function main() {
const connection = new Connection("https://your-rpc-url.com", "confirmed");
const sender = Keypair.generate();
const recipient = Keypair.generate();
const pool = new PublicKey("B8SyffZKt8LABKogWjH9rZcjY5PV2hyYRCbTxxbcrpFf");

const snapA = new SNAPClient(connection, sender);
const snapB = new SNAPClient(connection, recipient);

const note = await snapA.deposit(pool, 0.1);
const serialized = SNAPClient.serializeNote(note);
await snapB.withdraw(pool, SNAPClient.deserializeNote(serialized), recipient);
}

void main();

If you want a runnable walkthrough from this repo, use:

npx tsx examples/basic-payment.ts
npx tsx examples/agent-to-agent.ts
npx tsx examples/relayed-withdrawal.ts

Architecture

| Component | Description |
|-----------|-------------|
| Solana Program | Anchor program with deposit, withdraw_zk, and withdraw_zk_relayed |
| ZK Circuit | circom Groth16 circuit using Poseidon and a depth-10 Merkle tree |
| SDK | snap-solana-sdk for note handling, proof generation, and client API |
| Agent Kit Plugin | Solana Agent Kit v2 plugin with snap_create_pool, snap_deposit, snap_withdraw, and snap_withdraw_private |
| LangChain Tools | snap-langchain-tools — StructuredTool wrappers for LangChain/LangGraph agents |
| Relayer | Express service for gas-abstracted private withdrawals |

Mainnet

> Pool denominations are 0.1 SOL, 1 USDC, and 10 USDC. See THREAT_MODEL.md for trust assumptions.

| Field | Value |
|-------|-------|
| Program ID | 9uePoqdgaXpqFLQM2ED1GGQrwSEiqe3r6tW1AfsnrrbS |
| Pool — 0.1 SOL | B8SyffZKt8LABKogWjH9rZcjY5PV2hyYRCbTxxbcrpFf |
| Pool — 1 USDC | 5LeuHrPBgHNhgbCy996MEjcsBk5gNHhVj6AiuuCHZ8od |
| Pool — 10 USDC | ECuHf8kgiWfmL3Q6id4WGBQWvuukhzqvF5vsxuPAKZBv |
| Network | Solana mainnet-beta |
| Protocol fee | 0.25% |

Project Structure

├── programs/           # Solana program (Rust/Anchor)
├── circuits/           # circom ZK circuit
├── sdk-package/        # snap-solana-sdk npm package
├── agent-kit-tool/     # Solana Agent Kit plugin
├── relayer/            # Express relay service
├── agents/             # Demo agent scripts
├── examples/           # Minimal end-to-end examples
├── scripts/            # Deployment and quickstart scripts
├── docs/               # Troubleshooting, circuit, and compliance docs
└── tests/              # Integration tests

Development

# Build the Solana program
anchor build

Run validator-backed tests

PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH" anchor test --skip-build

Build and test the SDK package

cd sdk-package && npm install && npm run build && npm test

Security

Known risks, protocol limits, and security documentation are in FINDINGS.md, docs/CIRCUIT_SPEC.md, docs/THREAT_MODEL.md, docs/COMPLIANCE.md, and docs/GOVERNANCE.md.

License

MIT

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.