Skip to content

feat(api): implement on-chain reputation signal endpoint with Redis caching (Closes #332) - #358

Merged
jotel-dev merged 1 commit into
Nullifier-Systems:mainfrom
mysterio123865:feat/on-chain-reputation-signal-332
Jul 29, 2026
Merged

feat(api): implement on-chain reputation signal endpoint with Redis caching (Closes #332)#358
jotel-dev merged 1 commit into
Nullifier-Systems:mainfrom
mysterio123865:feat/on-chain-reputation-signal-332

Conversation

@mysterio123865

Copy link
Copy Markdown
Contributor

Implements the on-chain reputation signal API for Stellar accounts by computing trust metrics from trade history and caching results for improved performance.

What was implemented
Added GET /api/v1/reputation/:address endpoint to generate on-chain reputation metrics for a Stellar account.
Computes the following metrics from stored trade history:
total_trades
successful_claims
completion_rate
trusted status (requires 5+ trades and ≥90% successful releases)
Added validation for 56-character Stellar G-addresses, returning HTTP 400 for invalid addresses.
Preserved the existing requirePayment(..., "0.0005") middleware to maintain endpoint access requirements.
Implemented 60-second Redis caching with an automatic in-memory fallback when Redis is unavailable.
Included a cached field in the response to indicate whether the result was served from cache.
Updated the OpenAPI specification to document the new endpoint and response schema.

Testing
Added integration tests covering:
Reputation metric calculation
Trusted threshold logic
Address validation
Cache behavior
API response contract
Tests Passed:
reputation.test.ts – 6 passing
openapi.test.ts – 5 passing
Total: 11 passing

Closes #332

Wire GET /reputation/:address to trade history with validation, 60s Redis/memory cache, and integration tests (Closes Nullifier-Systems#332).

Co-authored-by: Cursor <cursoragent@cursor.com>
@jotel-dev
jotel-dev merged commit 3696782 into Nullifier-Systems:main Jul 29, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[HARD] On-Chain Trust & Reputation Signal Endpoint

2 participants