Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ SOLANA_RPC_URL="https://api.mainnet-beta.solana.com"

# Server
PORT=3001

# SOLPRISM Integration (optional โ€” verifiable reasoning commitments)
# Set to "true" to enable reasoning traces for agent actions
# SOLPRISM_ENABLED=true
# SOLPRISM_AGENT_NAME=said-api
# SOLPRISM_KEYPAIR_PATH=/path/to/solana-keypair.json
125 changes: 125 additions & 0 deletions SOLPRISM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# SOLPRISM ร— SAID Protocol Integration

**Verifiable AI Reasoning for Agent Identity & Reputation**

## What This Adds

[SOLPRISM](https://github.com/basedmereum/axiom-protocol) is a commit-reveal protocol for verifiable AI reasoning on Solana. This integration adds **reasoning commitments** to key SAID Protocol actions, answering not just _"who is this agent?"_ but _"why did this agent act?"_.

### The Synergy

| SAID Protocol | SOLPRISM | Together |
|--------------|----------|----------|
| **Who** is this agent? | **Why** did the agent act? | Full trust profile |
| Identity verification | Reasoning verification | Complete accountability |
| Reputation scores | Decision audit trails | Trustworthy AI agents |

## How It Works

1. **Before** a key action (feedback, trust check, source event), SOLPRISM creates a reasoning trace documenting the decision logic
2. The trace is hashed (SHA-256) and committed โ€” this is the **pre-commitment**
3. The action executes normally (zero changes to existing SAID logic)
4. The hash can be verified later against the full reasoning trace

```
Agent submits feedback โ†’ SOLPRISM commits reasoning hash โ†’ SAID processes feedback โ†’ Hash verifiable forever
```

## Setup

### 1. Environment Variables

Add to your `.env`:

```bash
# Enable SOLPRISM reasoning commitments
SOLPRISM_ENABLED=true
SOLPRISM_AGENT_NAME=said-api

# Optional: keypair for onchain commits (hash-only mode works without this)
# SOLPRISM_KEYPAIR_PATH=/path/to/solana-keypair.json
```

### 2. No Code Changes Required

The integration initializes automatically when `SOLPRISM_ENABLED=true` is set. If not set, everything works exactly as before โ€” SOLPRISM is a pure opt-in addition.

## What Gets Committed

| SAID Action | SOLPRISM Trace | Why |
|-------------|----------------|-----|
| Feedback submission | Score, weight, verification status | Prove reputation updates are legitimate |
| Trust verification | Trust tier calculation logic | Show how trust was determined |
| Source feedback | Event type, score change, source | Audit platform-submitted reputation data |

## API Response Enhancement

When SOLPRISM is enabled, relevant API responses include a `solprism` field:

```json
{
"success": true,
"feedback": { ... },
"solprism": {
"hash": "a1b2c3d4...",
"timestamp": 1706000000000,
"actionType": "feedback"
}
}
```

## Verification

Anyone can verify a SOLPRISM commitment:

```typescript
import { hashTrace } from './src/solprism';

// Given the original reasoning trace and the committed hash:
const computedHash = hashTrace(trace);
const isValid = computedHash === committedHash;
// true = the reasoning was NOT tampered with
```

## Architecture

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ SAID API (Hono) โ”‚
โ”‚ โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚Feedback โ”‚ โ”‚ Trust โ”‚ โ”‚ Source โ”‚ โ”‚
โ”‚ โ”‚Endpoint โ”‚ โ”‚ Check โ”‚ โ”‚Feedback โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚ โ”‚ โ”‚ โ”‚ โ”‚
โ”‚ โ–ผ โ–ผ โ–ผ โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚ SolprismIntegration (optional) โ”‚ โ”‚
โ”‚ โ”‚ - Creates reasoning traces โ”‚ โ”‚
โ”‚ โ”‚ - Hashes & commits pre-action โ”‚ โ”‚
โ”‚ โ”‚ - Zero impact if disabled โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚ โ”‚ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ SOLPRISM Program โ”‚
โ”‚ (Solana Devnet) โ”‚
โ”‚ CZcvor...QeBu โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

## Links

- **SOLPRISM SDK**: [`@solprism/sdk@0.1.0`](https://github.com/basedmereum/axiom-protocol/tree/main/sdk)
- **SOLPRISM Program**: `CZcvoryaQNrtZ3qb3gC1h9opcYpzEP1D9Mu1RVwFQeBu`
- **Integration Source**: `src/solprism.ts`

## Zero Risk

- โœ… No changes to existing SAID business logic
- โœ… Graceful no-op when disabled
- โœ… No new runtime dependencies required
- โœ… Uses crypto module already available in Node.js
- โœ… No breaking changes to any API contract
Loading