Background wallpaper
← BackPRODUCTION

Consumer Score Engine

Distributed scoring pipeline for DeFi user behavior analysis

Updated October 16, 20252 min read
Tech Stack:
PythonKafkaNeo4jRedisscikit-learn

Overview

High-performance data pipeline processing across multiple chains to generate user scores. Built with microservices architecture featuring Apache Kafka for event streaming, Neo4j for graph relationships, and ML-powered scoring.

Proprietary system powering ConsumerFi's user acquisition and ConsumerGraph inputs.

$data pipeline architecture

┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ Blockchain │─────▶│ Kafka │─────▶│ Score │ │ Events │ │ Streams │ │ Engine │ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │ │ │ ▼ ▼ ▼ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ Social │ │ Neo4j │ │ Redis │ │ APIs │ │ Graph │ │ Cache │ └──────────┘ └──────────┘ └──────────┘

scoring/calculate_user_score.py
from scoring import ScoreEngine

async def calculate_user_score(user_address: str) -> dict:
    # Real-time data aggregation from multiple sources
    on_chain = await fetch_blockchain_activity(user_address)
    social = await fetch_social_reputation(user_address)
    defi = await fetch_defi_behavior(user_address)
    network = await fetch_network_effects(user_address)

    # ML-powered scoring across 4 dimensions
    scores = {
        "on_chain": score_on_chain_activity(on_chain),      # 0-100
        "social": score_social_reputation(social),          # 0-100
        "defi": score_defi_behavior(defi),                  # 0-100
        "network": score_network_effects(network),          # 0-100
    }

    # Weighted composite score with risk assessment
    composite = (
        scores["on_chain"] * 0.30 +
        scores["social"] * 0.20 +
        scores["defi"] * 0.35 +
        scores["network"] * 0.15
    )

    # Cache result for sub-100ms retrieval
    await redis.setex(f"score:{user_address}", 3600, composite)

    return {"score": composite, "breakdown": scores}

Links:

  • Proprietary system developed for ConsumerFi
  • Case studies available for institutional clients