Skip to content

Repository files navigation

Graphite

Transaction intent verification for Solana AI agents.

Graphite sits between an AI agent's intent and the wallet's execution. It verifies that a constructed transaction actually does what was declared — with a falsifiable confidence score, staying accurate as protocols evolve.

Phase 1 + 1.5 — COMPLETE (v0.1.0-alpha)

Core verification engine (Rust):

  • 8-layer verification pipeline: Account Resolution → Transaction Construction → Risk → Confidence → Policy → Unknown Protocol Mode
  • 11 seed protocol manifests (10 + legacy Memo) (System, SPL Token, Token-2022, Stake, Raydium AMM V4, Squads V4, Jupiter V6, Orca Whirlpools, Meteora DLMM, Memo)
  • Risk Engine: 5 P0 patterns (Drainer, AuthorityHijack, HiddenTransfer, UnexpectedCpi, FakeSwap)
  • Unknown Protocol Mode with hard confidence ceiling
  • Benchmark: 18 cases, 100% precision/recall, ~25μs avg latency

Consumer surfaces:

  • TypeScript SDK + Go SDK (full VerificationResult round-trip)
  • CLI (Rust, feature-gated)
  • Python AI Layer (advisory-only, separate process — P1 compliance)
  • Solana Agent Kit integration — code complete with real SAK v2 imports (pending live devnet testing)

630 Rust tests passing (630 Rust + 9 Go + 7 Python), 0 clippy warnings.

Quick Start

Run the Solana Agent Kit demo

# 1. Start Graphite Core
cd graphite-core && cargo run --release --bin graphite -- server --port 7331

# 2. Start AI Layer (separate process)
cd python-ai-layer && python3 intent_parser.py --serve --port 8081

# 3. Run the demo (dry-run)
# SAK integration rebuilt with real solana-agent-kit v2 (pending live devnet test — Phase 2)
npx tsx demo.ts "Swap 0.5 SOL for USDC"

The demo shows the full flow:

  1. AI Layer parses "Swap 0.5 SOL for USDC" → ProposedIntent
  2. Graphite Core verifies the Jupiter V6 swap → VerificationResult (approved)
  3. Agent would execute via agent.methods.trade() (dry-run shows the path)

It also demonstrates the security property — a malicious CPI route is blocked by Graphite (fail-closed per Constitution P12).

Run the benchmark

cd graphite-core
cargo run --release --bin graphite -- benchmark

Documentation

License

MIT — Copyright Victor Stanley

About

Semantic transaction verification for AI agents on Solana.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages