feat(solana): Karma Solana SDK — verifiable execution, evidence bundles, x402 payments - #103
Merged
Merged
Conversation
Adds packages/karma_solana/ — a standalone Python SDK that plugs Karma's verifiable execution (signed receipts + evidence bundles) into the Solana agent ecosystem (x402, Agent-to-Agent payments, on-chain settlement). Package structure: - verifier.py — KarmaSolanaVerifier: full verify→upload→settle pipeline - transaction_builder.py — Solana tx construction (Memo + SPL Transfer) - evidence_store.py — Arweave/IPFS/Mock content-addressed storage backends - x402.py — SolanaX402Hook: x402 Agent-to-Agent SPL payments - pyproject.toml — Standalone pip install karma-solana - examples/ — Full 8-step E2E demo (solana_integration.py) - tests/ — 22 tests covering verifier, evidence, settlement Security: - api_key stored as _api_key (private), excluded from __repr__ - Keypair signing uses keypair.secret() (32-byte seed, not full 64-byte) - Float→atomic conversion uses Decimal for precision safety - Memo payload size validation (566-byte SPL limit) - No secret material logged or exposed in error messages Tested: 22/22 pass, demo validated 8-step E2E pipeline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
packages/karma_solana/— a standalone Python SDK that plugs Karma's verifiable execution into the Solana agent ecosystem.KarmaSolanaVerifier— Full verify → upload → settle pipelineSolanaTransactionBuilder— SPL Memo + SPL Transfer transaction constructionArweaveUploader/IPFSUploader— Decentralized evidence storageSolanaX402Hook— x402 Agent-to-Agent SPL token paymentsArchitecture
Why
pip install "bnbagent[karma]")BNB Chain vs Solana
router.settle()pip install "bnbagent[karma]"pip install karma-solanaQuickstart
Security Audit ✅
api_keystored as_api_key(private), excluded from__repr__keypair.secret()(32-byte seed, not full 64-byte)Decimalfor precision safetyChecklist
pyproject.toml—pip install karma-solanaRelated
Note
Medium Risk
Introduces a new SDK that signs and submits Solana transactions (memos and SPL transfers) and handles evidence uploads, so bugs could affect on-chain settlement/payment behavior despite being largely additive and test-covered.
Overview
Adds a new
packages/karma_solanaPython SDK that connects Karma’s off-chain verification (POST /v1/verify) to Solana settlement by hashing evidence bundles, uploading them to Arweave/IPFS (with a mock store for tests), and recording the verdict on-chain via an SPL Memo.Includes a
SolanaTransactionBuilderfor memo + SPL token transfer transactions and anSolanaX402Hookthat executes and cryptographically signs/verifies x402 (HTTP 402) payments on Solana. Ships with a full demo script, packaging config (pyproject.toml), and a focused test suite covering hashing determinism, verification flows, and evidence-store integration.Reviewed by Cursor Bugbot for commit e7714ee. Bugbot is set up for automated code reviews on this repo. Configure here.