Skip to main content

Portable on-chain reputation decay with Hedera HCS anchoring for Web3 social apps

Project description

solmate-reputation

Portable 5-dimension reputation scoring with time-based decay and Hedera HCS anchoring. Built for Web3 social apps.

PyPI License: MIT

Extracted from Sol Mate Trust API. No ORM or framework dependencies — bring your own storage.

Install

pip install solmate-reputation

Usage

from solmate_reputation import ReputationDimensions, ReputationEngine, EventType, HCSAnchor, apply_decay

# Scoring
engine = ReputationEngine()
score = ReputationDimensions()  # starts at 50/100 per dimension

score = engine.apply_event(score, EventType.MEETUP_COMPLETED)
# reliability +5, meetup_completion +5, response_rate +2

score = engine.apply_event(score, EventType.NO_SHOW)
# reliability -15, meetup_completion -10

print(score.composite)  # 0-100 weighted composite

# Time decay
from datetime import datetime, timedelta
last_active = datetime.utcnow() - timedelta(days=14)
score = apply_decay(score, last_active)
# -2pt on reliability/response_rate/meetup_completion (2 weeks)

# HCS anchoring (optional — no-ops if not configured)
hcs = HCSAnchor(topic_id="0.0.1234567")
hcs.anchor_reputation_event(
    user_id="user-123",
    event_type="meetup_completed",
    dimension_deltas={"reliability": 5, "meetup_completion": 5},
    composite_before=60.0,
    composite_after=63.2,
)

Event Types

Event reliability safety response_rate meetup_completion consent
MEETUP_COMPLETED +5 +2 +5
NO_SHOW -15 -10
HARASSMENT_REPORT -20 -10
STAKE_SLASHED -20 -10
STAKE_REFUNDED +3 +3
CONSENT_CONFIRMED +5

Composite Score

composite = reliability × 0.30 + safety × 0.30 + response_rate × 0.15
          + meetup_completion × 0.15 + consent × 0.10

Decay

Decay applies -1pt/week to reliability, response_rate, meetup_completion for inactive users. Floor at 10.

from solmate_reputation import bulk_decay

def save_score(user_id, score):
    db.update(user_id, score)

bulk_decay(
    users=[(u.id, u.score, u.last_active) for u in db.query(...)],
    on_update=save_score,
    days_inactive_threshold=7,
)

HCS Anchoring

Set environment variables or pass directly:

HEDERA_ACCOUNT_ID=0.0.9876
HEDERA_PRIVATE_KEY=your-ed25519-hex
HEDERA_TOPIC_ID=0.0.1234567
HEDERA_NETWORK=testnet  # or mainnet

HCSAnchor no-ops gracefully when not configured.

License

MIT — extracted from Sol Mate Trust API. Built for EasyA × Consensus Miami 2026.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

solmate_reputation-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

solmate_reputation-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file solmate_reputation-0.1.0.tar.gz.

File metadata

  • Download URL: solmate_reputation-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for solmate_reputation-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fee5f3da629b2c4a6b6e1deb7d83baa476e9e8ddbab8c273f4b566aa39f26cac
MD5 03b7b62c86195f3cab757ec189962a1e
BLAKE2b-256 2298e6c49c84133270e12ede16d7ce336266a7105f2d3c01f256b4ba83d12be4

See more details on using hashes here.

File details

Details for the file solmate_reputation-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for solmate_reputation-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c5fa6c637ec5e00abfd10fdab2e5653dd4de8177144f488d44345fb75856571
MD5 3c05e93bf24e729f2b35f77f398927c2
BLAKE2b-256 219c5fea29f84d4b12a6c65c32c62b42fdd309a73d16d69db2b9e25a29b87697

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page