Skip to content

Proposal: Revamp karma calculation to use both domains and public keys #71

@Rinse12

Description

@Rinse12

Domain-Based Karma: Proposal

Goal

Change karma tracking from signer address (public key) to domain address (e.g., user.eth). Karma follows the domain owner, including through key rotations.

Definition

Karma refers to author.subplebbit.postScore and author.subplebbit.replyScore:

  • postScore = sum of (upvotes - downvotes) on all posts (depth=0 comments)
  • replyScore = sum of (upvotes - downvotes) on all replies (depth>0 comments)

All author.subplebbit properties follow the same domain-based logic:

  • postScore - aggregated by domain
  • replyScore - aggregated by domain
  • firstCommentTimestamp - earliest comment attributed to domain (including retroactive)
  • lastCommentCid - most recent comment attributed to domain
  • banExpiresAt - already supports domain (no change needed)
  • flair - already supports domain (no change needed)

All Scenarios with Timelines

Scenario 1: Basic Domain Usage

Timeline:

T1: Signer A posts with public key only → A, NULL    → earns 50 karma (upvotes)
T2: Signer A posts with public key only → A, NULL    → earns 50 karma (upvotes)
    (Signer A has 100 karma at this point, queried by signer)

T3: Signer A posts with user.eth → A, user.eth → earns 50 karma (upvotes)

Result after T3:

  • Query karma for user.eth → 150 (T1: 50 + T2: 50 + T3: 50, retroactive merge of T1 & T2)
  • Query karma for Signer A (public key only) → 0 (no post-domain public-key-only comments yet)

Scenario 2: Key Rotation

Timeline:

T1: Signer A posts with public key only → A, NULL       → earns 50 karma
T2: Signer A posts with user.eth        → A, user.eth   → earns 50 karma
    (user.eth now has 100 karma: T1 retroactive 50 + T2 50)

T3: user.eth ENS record changes to point to Signer B

T4: Signer B posts with user.eth        → B, user.eth   → earns 50 karma

Result after T4:

  • Query karma for user.eth → 150 (T1: 50 + T2: 50 + T4: 50, includes A's pre-domain T1)
  • Query karma for Signer A (public key only) → 0
  • Query karma for Signer B (public key only) → 0

Scenario 3: Mixed Usage (Same Signer)

Timeline:

T1: Signer A posts with public key only → A, NULL      → earns 50 karma
    (Query signer A karma at this point → 50)

T2: Signer A posts with user.eth        → A, user.eth  → earns 50 karma (FIRST domain usage)
    (T1 is NOW retroactively attributed to user.eth)
    (Query signer A karma at this point → 0, because T1 moved to domain)

T3: Signer A posts with public key only → A, NULL      → earns 50 karma
    (This is AFTER first domain usage, so it stays with signer)

T4: Signer A posts with user.eth        → A, user.eth  → earns 50 karma

T5: Signer A posts with public key only → A, NULL      → earns 50 karma
    (This is AFTER first domain usage, so it stays with signer)

Final Result:

  • Query karma for user.eth → 150 (T1: 50 retroactive + T2: 50 + T4: 50)
  • Query karma for Signer A (public key only) → 100 (T3: 50 + T5: 50)

Key insight: T1 was "claimed" by domain at T2. T3 and T5 are NOT claimed because they happened AFTER Signer A first used a domain.


Scenario 4: Multiple Domains (Same Signer)

Timeline:

T1: Signer A posts with public key only → A, NULL      → earns 50 karma
T2: Signer A posts with alice.eth       → A, alice.eth → earns 50 karma (FIRST domain usage overall)
T3: Signer A posts with public key only → A, NULL      → earns 50 karma
T4: Signer A posts with bob.eth         → A, bob.eth   → earns 50 karma (FIRST bob.eth usage)
T5: Signer A posts with public key only → A, NULL      → earns 50 karma

Decision: First domain used (alice.eth at T2) claims all pre-domain karma (T1).

Result:

  • Query karma for alice.eth → 100 (T1: 50 retroactive + T2: 50)
  • Query karma for bob.eth → 50 (T4: 50 only, no retroactive since alice.eth was first)
  • Query karma for Signer A (public key only) → 100 (T3: 50 + T5: 50, post-first-domain comments)

Scenario 5: Domain Transfer/Sale

Timeline:

T1: Signer A posts with popular.eth → A, popular.eth → earns 1000 karma (over time)

T2: Signer A sells popular.eth to Signer B (off-chain transaction)

T3: Signer B posts with popular.eth → B, popular.eth → earns 50 karma

Result after T3:

  • Query karma for popular.eth → 1050 (T1: 1000 + T3: 50, buyer inherits all previous karma)
  • This is accepted risk (same as Twitter handle sales)

Scenario 6: Domain Expires/Lost

Timeline:

T1: Signer A posts with user.eth → A, user.eth → earns 100 karma (over time)
T2: Domain user.eth expires (not renewed)
T3: Signer C buys user.eth
T4: Signer C posts with user.eth → C, user.eth → earns 50 karma

Result after T4:

  • Query karma for user.eth → 150 (T1: 100 + T4: 50, new owner inherits all previous karma)
  • Same as intentional transfer

Scenario 7: Retroactive Domain Claim (Long History)

Timeline:

T1-T100: Signer A posts with public key only over 2 years → earns 1000 karma total

T101: Signer A buys user.eth and posts with it → A, user.eth → earns 50 karma

Result:

  • Query karma for user.eth → 1050 (T1-T100: 1000 retroactive + T101: 50)
  • Query karma for Signer A (public key only) → 0 (all pre-domain karma moved to domain)

Scenario 8: Stop Using Domain

Timeline:

T1: Signer A posts with public key only → A, NULL      → earns 50 karma
T2: Signer A posts with user.eth        → A, user.eth  → earns 50 karma (FIRST domain usage)
T3: Domain user.eth expires (Signer A doesn't renew)
T4: Signer A posts with public key only → A, NULL      → earns 50 karma
T5: Signer A posts with public key only → A, NULL      → earns 50 karma

Result:

  • Query karma for user.eth → 100 (T1: 50 retroactive + T2: 50, frozen at this point)
  • Query karma for Signer A (public key only) → 100 (T4: 50 + T5: 50, post-domain comments)
  • If Signer B later buys user.eth and posts → inherits 100 + their new posts

Scenario 9: Pseudonymity Mode

Timeline:

Subplebbit has pseudonymityMode: "per-author"

T1: Signer A posts with user.eth → Alias X created, linked to A → earns 50 karma
T2: Signer A posts with user.eth → Uses same Alias X             → earns 50 karma

T3: user.eth rotates to Signer B

T4: Signer B posts with user.eth → NEW Alias Y created, linked to B → earns 50 karma

Result:

  • Query karma for Alias X → 100 (T1: 50 + T2: 50, isolated to this alias)
  • Query karma for Alias Y → 50 (T4: 50, isolated to this alias)
  • Domain karma doesn't aggregate across aliases (pseudonymity preserved)

Scenario 10: Ban Interaction

Timeline:

T1: Signer A posts with spammer.eth → A, spammer.eth
T2: Mod bans spammer.eth
T3: Signer A tries to post with public key only → ???

Current behavior: Both signer AND domain are tracked for bans.

  • T3 would be blocked because Signer A is associated with banned spammer.eth

Keep this behavior - prevents ban evasion


Scenario 11: Signer Uses Domain, Then Different Domain

Timeline:

T1: Signer A posts with public key only → A, NULL      → earns 50 karma
T2: Signer A posts with alice.eth       → A, alice.eth → earns 50 karma (FIRST domain usage)
T3: Signer A posts with public key only → A, NULL      → earns 50 karma
T4: Signer A posts with bob.eth         → A, bob.eth   → earns 50 karma
T5: Signer A posts with public key only → A, NULL      → earns 50 karma

Result: (Same as Scenario 4)

  • Query karma for alice.eth → 100 (T1: 50 retroactive + T2: 50, first domain claims pre-domain)
  • Query karma for bob.eth → 50 (T4: 50 only, no retroactive)
  • Query karma for Signer A (public key only) → 100 (T3: 50 + T5: 50, post-first-domain comments)

Scenario 12: Two Signers, One Used Domain Before Other

Timeline:

T1: Signer A posts with user.eth        → A, user.eth → earns 50 karma (A's FIRST domain usage)
T2: Signer A posts with public key only → A, NULL     → earns 50 karma

T3: user.eth rotates to Signer B

T4: Signer B posts with public key only → B, NULL     → earns 50 karma (B hasn't used domain yet!)
T5: Signer B posts with user.eth        → B, user.eth → earns 50 karma (B's FIRST domain usage)
T6: Signer B posts with public key only → B, NULL     → earns 50 karma

Result:

  • Query karma for user.eth → 200 (T1: 50 + T4: 50 retroactive from B + T5: 50)
  • Query karma for Signer A (public key only) → 50 (T2: 50, post-domain for A)
  • Query karma for Signer B (public key only) → 50 (T6: 50, post-domain for B)

Scenario 13: Signer Never Uses Domain

Timeline:

T1: Signer A posts with public key only → A, NULL → earns 50 karma
T2: Signer A posts with public key only → A, NULL → earns 50 karma

Result:

  • Query karma for Signer A (public key only) → 100 (T1: 50 + T2: 50, all comments)
  • No domain involved, works same as current behavior

Scenario 14: Query Timing Edge Case

Timeline:

T1: Signer A posts with public key only → A, NULL → earns 50 karma

Query at this moment (before any domain usage):

  • Query karma for Signer A (public key only) → 50
T2: Signer A posts with user.eth → A, user.eth → earns 50 karma (FIRST domain usage)

Query after T2:

  • Query karma for Signer A (public key only) → 0 (T1 was retroactively claimed by domain)
  • Query karma for user.eth → 100 (T1: 50 retroactive + T2: 50)

Note: This is a "karma shift" - queries return different results after domain usage


Scenario 15: Same Domain Used by Original Signer Again After Rotation

Timeline:

T1: Signer A posts with user.eth → A, user.eth → earns 50 karma
T2: user.eth rotates to Signer B
T3: Signer B posts with user.eth → B, user.eth → earns 50 karma
T4: user.eth rotates BACK to Signer A
T5: Signer A posts with user.eth → A, user.eth → earns 50 karma

Result:

  • Query karma for user.eth → 150 (T1: 50 + T3: 50 + T5: 50)
  • Both signers contributed to same domain over time

Scenario 16: Signer Posts With Domain Before ENS Resolves to Them

Timeline:

T1: Signer A owns user.eth and posts → A, user.eth (50 karma)
T2: Signer B tries to post with user.eth (but B doesn't own it)

This should fail during signature verification - ENS resolution would show user.eth points to A, not B. B cannot claim user.eth.


Scenario 17: Domain Changes During Comment Processing

Timeline:

T1: Signer A owns user.eth
T2: Signer A submits comment with user.eth
T3: While comment is pending, user.eth rotates to Signer B
T4: Comment is processed

Question: Is the comment attributed to user.eth or rejected?

  • Should depend on signature verification at processing time
  • If ENS resolves to B at T4, A's comment should be rejected (signature mismatch)

Scenario 18: firstCommentTimestamp Across Key Rotation

Timeline:

T1 (Jan 1): Signer A posts with public key only → A, NULL      → earns 50 karma
T2 (Jan 5): Signer A posts with user.eth        → A, user.eth  → earns 50 karma (FIRST domain usage)
T3 (Feb 1): user.eth rotates to Signer B
T4 (Mar 1): Signer B posts with user.eth        → B, user.eth  → earns 50 karma

What is firstCommentTimestamp for user.eth?

  • Should be T1 (Jan 1) - the earliest comment attributed to domain
  • Even though T1 was a public-key-only comment, it's retroactively claimed by domain

Scenario 19: lastCommentCid Across Key Rotation

Timeline:

T1: Signer A posts with user.eth → A, user.eth → cid=Qm1 → earns 50 karma
T2: user.eth rotates to Signer B
T3: Signer B posts with user.eth → B, user.eth → cid=Qm2 → earns 50 karma

What is lastCommentCid for user.eth?

  • Should be Qm2 - the most recent comment attributed to domain (from Signer B)

Scenario 20: Negative Karma

Timeline:

T1: Signer A posts with public key only → A, NULL      → earns -50 karma (downvoted)
T2: Signer A posts with user.eth        → A, user.eth  → earns +100 karma (FIRST domain usage)

Result:

  • Query karma for user.eth → 50 (T1: -50 retroactive + T2: +100)
  • Negative karma is inherited too when retroactive merge happens

Scenario 21: Votes on Old Comments After Domain Claim

Timeline:

T1: Signer A posts with public key only → A, NULL     → cid=Qm1 → 0 votes initially
T2: Signer A posts with user.eth        → A, user.eth → cid=Qm2 → earns 50 karma (FIRST domain usage)
T3: Someone upvotes Qm1 (the old public-key-only comment) → Qm1 now has +1 karma

Result:

  • Query karma for user.eth → 51 (T1/Qm1: 1 retroactive + T2/Qm2: 50)
  • Even though the vote on Qm1 came after domain claim, the comment is attributed to domain

Scenario 22: Comment Purged/Removed

Timeline:

T1: Signer A posts with public key only → A, NULL      → earns 50 karma
T2: Signer A posts with user.eth        → A, user.eth  → earns 50 karma (FIRST domain usage)
    (At this point, user.eth has 100 karma: T1 retroactive + T2)
T3: Mod removes/purges T1 comment

Result after T3:

  • Query karma for user.eth → 50 (only T2: 50, T1 was removed)
  • Removed/purged comments don't count toward karma

Scenario 23: Active User Count (Out of Scope)

Current behavior: subplebbit.stats counts active users by authorSignerAddress
Question: Should this change to count by domain when present?

Decision: Out of scope for this proposal. Keep counting by signer for now. Can revisit later.


Decisions

  1. Multiple domains (Scenario 4/11): First domain used claims all pre-domain karma
  2. No new table: Derive firstUsedAt from comments via MIN(timestamp) query
  3. Schema change: Add authorDomainAddress column to comments table only

Final Rules Summary

Rule 1: Domain Karma Calculation

When querying karma for domain D:

  1. Find all signers who ever used domain D
  2. For each signer S:
    • Find firstUsedAt = MIN(timestamp) WHERE authorSignerAddress=S AND authorDomainAddress=D
    • Include: All comments with authorDomainAddress=D
    • Include: Public-key-only comments by S with timestamp <= firstUsedAt
  3. Sum karma across all included comments

Rule 2: Signer (Public Key Only) Karma Calculation

When querying karma for signer S without domain:

  1. Find firstDomainUsedAt = MIN(timestamp) WHERE authorSignerAddress=S AND authorDomainAddress IS NOT NULL
  2. If no domain ever used: Include all public-key-only comments by S
  3. If domain was used: Include only public-key-only comments with timestamp > firstDomainUsedAt

Rule 3: Multiple Domains

When signer uses multiple domains:

  • First domain used (by timestamp) claims all pre-domain karma
  • Subsequent domains only get their explicit domain comments
  • Public-key-only comments after first domain usage go to signer karma

Rule 4: Pseudonymity Mode

Alias karma is isolated - no domain aggregation within pseudonymity mode.


Updated Scenario Results

# Scenario Domain Karma Signer (Public Key Only) Karma
1 Basic usage All signer's karma (retroactive) 0
2 Key rotation All from all signers who used domain 0 for each signer
3 Mixed usage Pre-domain + domain posts Post-domain public-key-only only
4 Multiple domains First domain gets pre-domain Post-first-domain public-key-only
5 Domain transfer Buyer inherits all -
6 Domain expires New buyer inherits -
7 Retroactive claim All historical 0
8 Stop using domain Frozen Post-domain public-key-only
9 Pseudonymity Alias isolated -
10 Bans Domain + signer both banned -
11 Switch domains First domain gets pre-domain Post-first-domain public-key-only
12 Two signers, one used domain first All pre-domain from both signers Post-domain public-key-only
13 Never uses domain - All karma
14 Query timing Karma shifts after first domain use -

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions