Skip to content

reputation system implementation#111

Open
Glam26 wants to merge 1 commit into
SudiptaPaul-31:mainfrom
Glam26:blockchain-based
Open

reputation system implementation#111
Glam26 wants to merge 1 commit into
SudiptaPaul-31:mainfrom
Glam26:blockchain-based

Conversation

@Glam26

@Glam26 Glam26 commented Jun 24, 2026

Copy link
Copy Markdown

I have successfully implemented the decentralized reputation system
according to your requirements. Here's a breakdown of the implementation:

1. Smart Contract (Soroban)

• Created a new Rust smart contract project under contracts/reputation .
• Implemented add_points , deduct_points , get_score , and get_actions
functions in contracts/reputation/src/lib.rs .
• The contract immutably stores the user's score and a history of actions
tied to their Stellar Wallet Address using env.storage().persistent() .
• Emits events ( env.events().publish(...) ) so off-chain services can
index reputation changes seamlessly.
• Unit Testing: Wrote comprehensive unit tests ( src/test.rs ) mapping out
reputation accrual and deduction flows, which successfully pass via cargo
test .

2. Backend Sync & Storage

• Database Schema: Created scripts/add-reputation.sql with tables for
reputation (caching total score) and reputation_actions (audit log of
point changes). Integrated it into scripts/run-migrations.ts .
• Database Service: Added lib/reputation.ts containing functions (
addReputationPoints , getReputation , etc.) to interact with Neon Postgres
safely using transactions and upserts. Includes utility for evaluating
badges like Gold, Silver, Bronze.
• Indexer/Sync Service: Built scripts/reputation-indexer.ts representing
a backend worker that polls the Soroban contract using the Stellar SDK (
server.getEvents ) and syncs verified on-chain occurrences into our
PostgreSQL database for instant frontend reads.

3. API & Frontend Integration

• API Endpoint: Created app/api/reputation/[walletAddress]/route.ts to
return the synced reputation score, calculated badge tier, and recent
actionable feed without hitting the blockchain directly (ensuring fast load
times).
• UI Components: Updated app/profile/page.tsx to switch from mock data to
real-time reputationData fetched via the API endpoint. The UI dynamically
generates visual badges (Newcomer, Bronze, Silver, Gold) and displays a
feed of +points earned for snippets shared or verified.

4. Code Quality & Error Handling

• Complete error handling flows integrated across the API boundaries and UI
(such as fallback 0 scores, loading states, and exception boundaries).
• Authored Jest-based tests for backend algorithms and API logic in
lib/reputation.test.ts and app/api/reputation/route.test.ts .

All components are now correctly wired and ready to be compiled onto the
Stellar testnet with the fast PostgreSQL synced indexer in place. Let me
know if you would like me to adjust any of the reputation thresholds or
layout structures!
───────────────────

closes #108

@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

@Truphile is attempting to deploy a commit to the Sudipta 's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 24, 2026

Copy link
Copy Markdown

@Glam26 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Blockchain-Based Contributor Reputation Score

2 participants