Skip to content

[FE-26] Reputation Scores & On-Chain Verification Badges #1015

@mftee

Description

@mftee

⚠️ Depends on: [BE-28] Wallet Linking, [BE-21] Reviews Backend — the on-chain verification check and reputation API must exist. [CONTRACT-01] — Reputation contract must be deployed.

Overview

The Soroban reputation contract computes a 0–1000 composite score from on-chain ratings, but this score is never displayed to users. There are also no on-chain verification badges visible in the UI. This issue surfaces blockchain-based reputation data across the platform.

Technical Details

1. On-Chain Reputation Score Display

Add to Carrier Public Profile (/carriers/[id]):

  • Below the existing star rating section, add an "On-Chain Reputation" card:
    • Reputation score (0–1000): displayed as a gauge/progress bar (e.g., 750/1000)
    • On-time rate: percentage (e.g., "94% on-time")
    • Total on-chain ratings: count
    • "Verified on Stellar Blockchain" badge with an external link to Stellar Expert for the contract
    • If the carrier has no wallet linked: show "On-chain reputation not available"

Backend endpoint needed (add to CarriersController):
GET /carriers/:id/reputation — queries the Soroban reputation contract's get_score function for the carrier's walletAddress, returns { score, onTimeRate, totalRatings }. If the carrier has no wallet, return { unavailable: true }.

2. Verification Badges

Create a reusable <VerifiedBadge /> component (frontend/components/reputation/verified-badge.tsx):

  • Props: type ('email' | 'wallet' | 'carrier'), tooltip (optional)
  • Email verified: gray envelope icon + "Email Verified"
  • Wallet verified: Stellar logo icon + "On-Chain Verified"
  • Carrier verified (by admin): blue shield icon + "Verified Carrier"
  • Show in: user menu dropdown, carrier profile cards, bid cards, shipment detail party info

3. Trust Score Panel (Shipper Dashboard — Carrier Selection Context)

On the bids tab of a shipment detail page (from [FE-06]), add a "Trust Score" summary to each bid card:

  • DB rating: average stars from GET /carriers/:id/reviews
  • On-chain score: from GET /carriers/:id/reputation
  • Verified badges: email / wallet / carrier
  • Overall trust label: "High Trust" (score > 700 + verified) / "Moderate" / "Unverified"
  • This helps shippers make informed bid acceptance decisions

Acceptance Criteria

  • Carrier public profile shows the on-chain reputation card with score, on-time rate, and rating count
  • If the carrier has no wallet, the card shows "On-chain reputation not available"
  • GET /carriers/:id/reputation queries the Soroban contract and returns the score
  • <VerifiedBadge /> renders correctly for all three badge types with correct icons
  • Verification badges appear in the user menu and on carrier profile cards
  • Trust Score summary appears on bid cards in the shipment detail bids tab
  • "High Trust" / "Moderate" / "Unverified" label is derived correctly from the score + badge combination

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions