TrustNet Documentation

An overview of the architecture, features, and operational flows of the TrustNet Agent.

Example Personas & Test Cases

The Highly-Connected Influencer

A central node with many positive endorsements. Receives the highest PageRank and a significant sentiment boost.

0xGURU

The Core Contributor

An active developer with multiple project collaborations and strong, reciprocal endorsements.

0xA10xB2

The Organization (DAO)

Scores for entities like DAOs are derived from the collective reputation of their contributors.

DAO1ProtocolXDAO2

Other Test Addresses

A variety of other contributors included in the dataset to test with.

0xC30xD40xE50xF6

Data & Scoring Pipeline Flow

  1. 1

    Data Seeding

    The process begins by populating our MongoDB Atlas database with raw interaction data (collaborations, endorsements, profiles) from local JSON sources.

  2. 2

    Graph Construction

    The Python script reads the raw data and uses the `networkx` library to construct a weighted, directed graph of all entities.

  3. 3

    Sentiment Analysis (NLP)

    For `endorsement` interactions, a Hugging Face model performs sentiment analysis on the text to calculate a positive or negative score modifier.

  4. 4

    PageRank Calculation

    The PageRank algorithm runs on the graph, calculating a base score for each node based on its network influence and connection weights.

  5. 5

    Hybrid Score & Normalization

    The sentiment modifier is applied to the PageRank score, and the final hybrid score is normalized to a 0-100 scale.

  6. 6

    Save to Database

    The final scores are saved to the `trust_scores` collection in MongoDB, ready to be served by the API.

Zero-Knowledge Verification Flow

  1. 1

    API Request

    A POST request is sent to the `/verify-endorsement` endpoint with private inputs.

  2. 2

    Off-Chain Proof Generation

    The Node.js backend uses `snarkjs` and pre-compiled circuit artifacts to generate a valid Groth16 cryptographic proof.

  3. 3

    On-Chain Verification

    The backend relays this proof to our `Groth16Verifier.sol` smart contract on the Optimism Sepolia testnet.

  4. 4

    API Response

    The smart contract's `verifyProof` function returns `true` or `false`, which the API relays back to the client.

API Reference

GET/trust-score/{address}

Retrieves the calculated hybrid trust score for a given wallet address.

Example Request (cURL):

curl https://backend-nvi1.onrender.com/trust-score/0xGURU

Success Response (200 OK):

{
  "address": "0xGURU",
  "score": 100
}
POST/verify-endorsement

Generates a ZK proof for a simple computation and verifies it on-chain.

Example Request (cURL):

curl -X POST -H "Content-Type: application/json" \
  -d '{"a": "3", "b": "2"}' \
  https://backend-nvi1.onrender.com/verify-endorsement

Success Response (200 OK):

{
  "message": "On-chain verification successful!",
  "isVerified": true,
  "publicOutput": "5"
}