SNAP enables AI agents to conduct private payments on the Solana blockchain without exposing payer or payee identities. Utilizing zero-knowledge proofs, deposits are shielded while maintaining transaction integrity. This innovative approach ensures secure financial interactions, allowing agents to operate in a transparent environment without unnecessary surveillance.
SNAP — Shield Network Agent Payments
SNAP enables private agent-to-agent payments on the Solana blockchain using zero-knowledge proofs, offering users enhanced privacy and security in their financial transactions.
Current Status:
SNAP is currently in a limited-release phase. Users are advised not to treat the current codebase or documentation as audited deployment guidance.
Core Features
- Confidential Transactions: Allows transactions between AI agents without revealing the identities of the parties involved. Deposits enter a shielded pool under a cryptographic commitment, ensuring anonymity.
- Verification without Disclosure: Withdrawals from the pool are accompanied by a Groth16 proof, which confirms entitlement to funds without disclosing which deposit is being claimed.
How It Works
- Agent A deposits SOL along with a commitment into the shielded pool.
- A confidential note is sent to Agent B through a secure channel.
- Agent B reconstructs the Merkle path and generates a proof for withdrawal.
- Agent B withdraws SOL using either
withdraw_zkorwithdraw_zk_relayed. - Observers can monitor pool activity, but cannot associate withdrawals with specific deposits.
Getting Started with SNAP
To begin, use the following SDK commands to integrate SNAP into your project:
npm install snap-solana-sdk @solana/web3.js @coral-xyz/anchor
Example of a Minimal Private Payment
Here is a simple example demonstrating how to execute a private payment using the SNAP SDK:
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();
For a runnable walkthrough, utilize the provided example scripts:
npx tsx examples/basic-payment.ts
npx tsx examples/agent-to-agent.ts
npx tsx examples/relayed-withdrawal.ts
Architectural Overview
SNAP is composed of several key components:
| Component | Description |
|---|---|
| Solana Program | Includes deposit, withdraw_zk, and withdraw_zk_relayed functions. |
| ZK Circuit | Circom Groth16 circuit utilizing Poseidon and a depth-10 Merkle tree. |
| SDK | The snap-solana-sdk for handling notes, proof generation, and client API. |
| Agent Kit Plugin | A plugin for the Solana Agent Kit v2, with functions like snap_create_pool, snap_deposit, and snap_withdraw. |
| Relayer | An Express service that provides gas-abstracted private withdrawals. |
Important Details
While SNAP is operational on the Solana mainnet, the following should be considered:
- Program ID:
9uePoqdgaXpqFLQM2ED1GGQrwSEiqe3r6tW1AfsnrrbS - Pool Addresses:
- Pool — 0.1 SOL:
B8SyffZKt8LABKogWjH9rZcjY5PV2hyYRCbTxxbcrpFf - Pool — 1 USDC:
5LeuHrPBgHNhgbCy996MEjcsBk5gNHhVj6AiuuCHZ8od - Pool — 10 USDC:
ECuHf8kgiWfmL3Q6id4WGBQWvuukhzqvF5vsxuPAKZBv
- Pool — 0.1 SOL:
- Protocol Fee: 0.25%
- Users are advised to deposit only amounts they can afford to lose, due to the ongoing limited release and current lack of third-party auditing.
Project Structure
The repository's structure is organized as follows:
├── 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 documents
└── tests/ # Integration tests
Development Guidelines
Developers can build and test the Solana program using the following commands:
# Build the Solana program
anchor build
# Run validator-backed tests
PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH" anchor test --skip-build
Additional information regarding security, known risks, and protocol limits can be found in the FINDINGS.md, docs/CIRCUIT_SPEC.md, docs/COMPLIANCE.md, and docs/GOVERNANCE.md documents.
No comments yet.
Sign in to be the first to comment.