KARMA कर्म

Kinetic Assessment of Reputation & Merit Accumulation

Trust earned through consistent good actions.

v2.5.0

The Wheel of Cause and Effect

In Buddhist philosophy, karma represents the universal law of cause and effect— every action creates ripples that shape future outcomes. Good actions accumulate merit; harmful actions diminish it.

The KARMA protocol embodies this principle: trust is EARNED through consistent good behavior, multiple independent sources strengthen karmic standing, and bad actions cause trust to decay. Time and consistency build toward higher levels.

Overview

KARMA (Kinetic Assessment of Reputation & Merit Accumulation) provides multi-level trust assessment for the Yakmesh network. Unlike simple binary trust, KARMA combines multiple verification sources to create a nuanced understanding of node reliability and integrity.

Protocol Family

Protocol Himalayan Name Purpose
Gossip MANTRA Epidemic message propagation
Broadcast STUPA Priority-based broadcasting
Consensus LAMA Distributed agreement
Time MANI Temporal synchronization
Trust KARMA Reputation management
Mesh MANDALA Network topology

Karma Levels

KARMA classifies nodes into levels representing their spiritual journey toward network trust. Each level unlocks greater privileges and responsibilities:

SIRDAR (सिरदार)

Level 4

Expedition Leader — Atomic time + full hardware attestation

  • Atomic clock time source verified
  • AES-NI hardware attestation passed
  • 30+ days consistent network presence
  • 3+ endorsements from other SIRDARs

SATHI (साथी)

Level 3

Trusted Companion — GPS + hardware verified

  • GPS with PPS time source
  • AES-NI hardware attestation passed
  • 14+ days network presence
  • 2+ endorsements from higher tiers

PATHIK (पथिक)

Level 2

Traveler on Path — PTP time + hardware verified

  • IEEE 1588 PTP time source
  • AES-NI hardware attestation
  • 7+ days network presence
  • 1+ endorsement from higher tier

YATRI (यात्री)

Level 1

Pilgrim/Journeyer — NTP time + hardware verified

  • NTP or system time source
  • AES-NI hardware attestation
  • 1+ day network presence
  • Standard participant in mesh

NAYA (नया)

Level 0

Newcomer — Unverified, observer status

  • System time only
  • No hardware attestation
  • New to network
  • Limited privileges, building trust

Core Components

KarmaTrustModel

The main trust assessment engine—the wheel of cause and effect:

import { KarmaTrustModel, KARMA_TIER } from 'yakmesh/security/trust-tier';

// Initialize the karma system
const karma = new KarmaTrustModel({
  minAgeForSirdar: 30 * 24 * 60 * 60 * 1000, // 30 days for SIRDAR
  minAgeForSathi: 14 * 24 * 60 * 60 * 1000,  // 14 days for SATHI
  autoPromoteEnabled: true,                   // Auto-promotion when earned
});

// Get a node's karma tier
const { tier, tierInfo, score } = karma.getTrustLevel(nodeId);
console.log(`${nodeId}: ${tierInfo.name} (${tierInfo.nepali})`);
console.log(`Karma Score: ${score}/100`);

// Listen for karma tier changes
karma.on('tierChanged', ({ nodeId, previous, current }) => {
  if (current > previous) {
    console.log(`${nodeId} has advanced to ${KARMA_TIER[current]}!`);
  } else {
    console.log(`${nodeId}'s karma has decreased.`);
  }
});

KarmaEvidence

Records the spiritual ledger of a node's actions:

// Record evidence from various sources
const evidence = karma.getEvidence(nodeId);

// DOKO verification (identity)
evidence.recordDokoVerification({
  passed: true,
  gatesChecked: 7,
  dokoHash: 'abc123...'
});

// Mesh quorum verification
evidence.recordMeshQuorum({
  valid: true,
  validProofs: 5,
  verifiers: ['node1', 'node2', 'node3', 'node4', 'node5'],
  diversity: { subnets: 4, asns: 3 }
});

// SSL verification
evidence.recordSSL({
  valid: true,
  certType: 'ca-signed',
  issuer: 'DigiCert'
});

// Recompute karma level
karma.computeTrustLevel(nodeId);

Evidence Sources

Source Weight Description
DOKO Required Cryptographic identity verification via NAMCHE gates
Mesh Quorum High Multiple independent nodes attest to validity
SSL Certificate Medium CA-signed certificate proves domain control
Domain Ownership Medium DNS-based proof of domain control
Beacon Consistency Time-based Regular presence over 7+ days

Configuration

const config = {
  // Time requirements
  minAgeForGold: 0,                           // Immediate if mesh verified
  minAgeForPlatinum: 7 * 24 * 60 * 60 * 1000, // 7 days for ENLIGHTENED
  
  // Beacon consistency
  minBeaconConsistency: 0.8,                  // 80% uptime for ENLIGHTENED
  beaconCheckWindow: 7 * 24 * 60 * 60 * 1000, // 7 day window
  
  // Mesh verification
  minQuorumForGold: 3,                        // Minimum verifiers
  minDiversityForGold: 3,                     // Different subnets
  
  // SSL requirements
  requireSSLForPlatinum: true,
  acceptSelfSignedSSL: true,                  // For DOKO-bound certs
  
  // Trust decay (negative karma over time)
  trustDecayEnabled: true,
  trustDecayPeriod: 30 * 24 * 60 * 60 * 1000, // After 30 days inactive
  
  // Auto-promotion
  autoPromoteEnabled: true,
  promotionCheckInterval: 60 * 60 * 1000,     // Check hourly
};

Integration with Other Protocols

LAMA

Karma levels weight attestation significance in consensus

STUPA

Broadcast acceptance thresholds based on sender karma

MANTRA

Gossip prioritization favors higher-karma nodes

MANI

Time source quality can contribute to karma

NPU Trust Level Prediction

predictTrustLevel() feeds a 14-feature evidence vector into the karma-trust ONNX model, returning softmax probabilities over [UNTRUSTED, SEEKING, AWAKENED, ENLIGHTENED]. The NPU prediction is a "second opinion" — the authoritative trust level is always the rule-based calculateTrustLevel().

14-Feature Input Vector

# Feature Source
0DOKO verifiedTrit → float (−1→0, 0→0.5, 1→1)
1DOKO hash presentBoolean
2Mesh quorum verifiedTrit → float
3Quorum size / 10Normalized
4Diversity sufficientBoolean
5SSL verifiedTrit → float
6SSL type0 / 0.33 self-signed / 0.67 cert-bound / 1.0 CA
7Domain verifiedTrit → float
8Age (days / 365)Normalized
9Uptime0–1
10Trust score / 100Normalized
11Beacon consistency0–1
12Strikes / 3Normalized
13Days since update / 90Normalized

NPU vs CPU

The NPU path returns a full softmax probability distribution across all four levels. The CPU fallback uses the rule-based engine and approximates probabilities (0.85 for the predicted level, 0.05 for each other). Both receive identical 14-feature vectors.

Backward Compatibility

For existing codebases using the original naming, legacy exports are maintained:

// Legacy imports still work
import { HybridTrustModel, TrustLevel, TrustEvidence } from 'yakmesh/security/hybrid-trust';

// These map to the new KARMA names
// HybridTrustModel → KarmaTrustModel
// TrustLevel → KarmaLevel
// TrustEvidence → KarmaEvidence

// Level aliases
// BRONZE → SEEKING
// GOLD → AWAKENED
// PLATINUM → ENLIGHTENED

Version History

Version Changes
v3.0.0 NPU-accelerated predictTrustLevel() with 14-feature karma-trust ONNX model (softmax over 4 levels). CPU rule-based fallback preserved as authoritative.
v2.5.0 Initial KARMA trust model. Trit-based evidence, 4 levels, backward compat aliases.