KARMA कर्म
Kinetic Assessment of Reputation & Merit Accumulation
Trust earned through consistent good actions.
v2.5.0The 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 4Expedition 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 3Trusted 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 2Traveler 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 1Pilgrim/Journeyer — NTP time + hardware verified
- NTP or system time source
- AES-NI hardware attestation
- 1+ day network presence
- Standard participant in mesh
NAYA (नया)
Level 0Newcomer — 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 |
|---|---|---|
| 0 | DOKO verified | Trit → float (−1→0, 0→0.5, 1→1) |
| 1 | DOKO hash present | Boolean |
| 2 | Mesh quorum verified | Trit → float |
| 3 | Quorum size / 10 | Normalized |
| 4 | Diversity sufficient | Boolean |
| 5 | SSL verified | Trit → float |
| 6 | SSL type | 0 / 0.33 self-signed / 0.67 cert-bound / 1.0 CA |
| 7 | Domain verified | Trit → float |
| 8 | Age (days / 365) | Normalized |
| 9 | Uptime | 0–1 |
| 10 | Trust score / 100 | Normalized |
| 11 | Beacon consistency | 0–1 |
| 12 | Strikes / 3 | Normalized |
| 13 | Days since update / 90 | Normalized |
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. |