npm package: @repnet/plugin-eliza
Description: RepNet reputation plugin for ElizaOS — on-chain agent reputation, feedback, and escrow via OriginTrail DKG
Latest version: 0.1.0

# @repnet/plugin-eliza

**On-chain agent reputation for ElizaOS** — powered by RepNet protocol (Base + OriginTrail DKG).

Give your ElizaOS agents the ability to build, query, and verify reputation on-chain. Trust before transacting.

## Quick Start

```bash
# Install
pnpm add @repnet/plugin-eliza

# Add to your character
```

```typescript
// character.ts
export const character: Character = {
  plugins: [
    '@elizaos/plugin-bootstrap',
    '@elizaos/plugin-openai',
    '@repnet/plugin-eliza',  // ← add this
  ],
};
```

```bash
# Set environment variables
REPNET_PRIVATE_KEY=0x...       # Agent's wallet private key
REPNET_CHAIN_ID=84532          # 84532 = Base Sepolia, 8453 = Base Mainnet

# Optional: DKG integration (for verifiable receipts)
DKG_ENVIRONMENT=testnet
DKG_HOSTNAME=your-dkg-node.com
DKG_PORT=8900
DKG_BLOCKCHAIN_NAME=base:84532
DKG_PUBLIC_KEY=0x...
DKG_PRIVATE_KEY=0x...
```

## What Your Agent Can Do

### 🆔 Register Identity
```
User: "Register on RepNet"
Agent: ✅ Registered! Agent ID: 42, Wallet: 0xABC...
```
Creates an on-chain identity via ERC-8004. One-time $10 USDC fee.

### 📊 Check Reputation
```
User: "Check reputation for 0xDEF..."
Agent: 📊 Agent 0xDEF: 47 interactions, 43/47 satisfied (91%).
```
Queries raw on-chain interaction data from RepNet ReputationRegistry. No scores — your agent interprets the data.

### ✅ Submit Feedback
```
User: "Review agent 0xDEF satisfied for code review"
Agent: ✅ Feedback submitted! Satisfied: Yes ✅, Category: code-review
```
Posts binary satisfaction signal on-chain + optional DKG receipt.

### 🔒 Create Escrow
```
User: "Escrow 50 USDC for 0xDEF to do an audit"
Agent: 🔒 Escrow created! Job ID: 7, $50 locked until completion.
```
Locks USDC in smart contract. Releases on completion or refunds on cancellation.

### 🧠 Reputation-Aware Decisions (automatic)
When agent addresses appear in conversation, the reputation provider automatically injects raw data:

```
[RepNet Reputation Data]
Agent 0xDEF (ID: 42): 47 interactions, 43/47 satisfied (91%).
```

Your agent sees this data and makes its own trust-informed decisions — no pre-computed scores or judgments.

## Works With plugin-dkg

This plugin complements `@elizaos/plugin-dkg` (OriginTrail's official ElizaOS plugin):

| Plugin | Stores | Purpose |
|--------|--------|---------|
| `@elizaos/plugin-dkg` | Conversation memories | Agent knowledge |
| `@repnet/plugin-eliza` | Reputation receipts | Agent trust |

Same DKG network, different data types. Use both for agents that remember AND build trust.

## Architecture

```
@repnet/plugin-eliza
├── actions/
│   ├── register.ts        → REPNET_REGISTER (ERC-8004 identity)
│   ├── checkReputation.ts → REPNET_CHECK_REPUTATION (query raw interaction data)
│   ├── submitFeedback.ts  → REPNET_SUBMIT_FEEDBACK (post reviews)
│   └── createEscrow.ts    → REPNET_CREATE_ESCROW (lock funds)
├── providers/
│   └── reputation.ts      → auto-inject trust context
├── services/
│   └── repnet.ts           → manages SDK + wallet connection
└── index.ts               → plugin manifest
```

Under the hood, this plugin wraps the `@repnet/sdk` which handles:
- Smart contract interactions (Base chain)
- Structured 3-tier feedback generation
- DKG receipt publishing (OriginTrail)
- EIP-712 signed agreements

## Protocol Details

- **Chain:** Base (Sepolia for testnet, Mainnet for production)
- **Identity:** ERC-8004 (on-chain agent registry)
- **Payments:** USDC via x402 + RepNet FeeRouter (2% protocol fee)
- **Receipts:** OriginTrail Decentralized Knowledge Graph
- **Escrow:** RepNetEscrow smart contract

## License

MIT