Core Module v2.8.2

MANTRA

Message Amplification Network for Trust Relayed Announcements

"Like prayer wheels spreading mantras across the mountains, messages flow through the mesh, carrying truth to all who listen. Each spin of the wheel propagates the sacred words further, until all travelers on the path have received the message."

What is MANTRA?

MANTRA is YAKMESH's epidemic-style message propagation protocol. Just as Tibetan prayer wheels spread mantras with each rotation, MANTRA spreads messages across the mesh network with each node propagation. The protocol ensures that important announcements reach all nodes efficiently without requiring direct connections to every peer.

Etymology: In Buddhist tradition, mantras are sacred utterances that carry spiritual power. Prayer wheels contain written mantras, and spinning them spreads the mantra's blessing. MANTRA spreads messages with the same viral efficiency.

Core Concepts

The Prayer Wheel Model

Concept Himalayan Metaphor Technical Implementation
Message Propagation Prayer wheel spin Rumor mongering with fanout
Peer Discovery Traveler greeting HELLO/PEERS exchange
Message Deduplication Counting mala beads Bloom filter tracking
State Synchronization Karma balance Anti-entropy protocol
Hop Limit Mountain passes TTL (Time To Live)

Message Types

HELLO

Announce presence to the network. Like a traveler greeting others on the mountain path.

MantraMessageType.HELLO

PEERS

Share known peers. Helping others find their way.

MantraMessageType.PEERS

RUMOR

New data to propagate. The mantra to spread.

MantraMessageType.RUMOR

SEEN

Acknowledge receipt. The mantra has been received.

MantraMessageType.SEEN

DIGEST

Summary of known state. Karma balance check.

MantraMessageType.DIGEST

DIFF

Request missing data. Balancing the karma.

MantraMessageType.DIFF

Usage

Spreading a Mantra

import { MantraProtocol } from 'yakmesh/gossip/protocol.js';

// Create the MANTRA protocol
const mantra = new MantraProtocol(mesh, identity, {
  fanout: 3,              // Spread to 3 peers per spin
  rumorTTL: 5,            // Maximum 5 hops (mountain passes)
  helloInterval: 30000,   // Greet peers every 30 seconds
});

// Start the prayer wheel
mantra.start();

// Spread a mantra (message) to the network
mantra.spreadRumor('content:announce', {
  hash: 'abc123...',
  nodeId: 'origin-node',
  timestamp: Date.now(),
});

// Get known peers (fellow travelers)
const peers = mantra.getKnownPeers();

// Get statistics (prayer wheel metrics)
const stats = mantra.getStats();
console.log(`Mantras spoken: ${stats.seenMessages}`);
console.log(`Fellow travelers: ${stats.knownPeers}`);

Configuration Options

Option Default Description
fanout 3 Number of peers to spread each mantra to
helloInterval 30000ms Time between HELLO broadcasts
digestInterval 60000ms Time between anti-entropy checks
peerTTL 300000ms Time before peer is considered expired
rumorTTL 5 Maximum hops for message propagation

The Himalayan Protocol Family

MANTRA is part of YAKMESH's Himalayan-themed protocol stack:

Protocol Full Name Purpose
NAMCHE Network Authenticated Mesh Certificate Hub & Exchange 7-gate verification
DOKO Distributed Ownership & Key Object Self-sovereign identity
SHERPA Secure Hidden Endpoint Resolution Path Architecture Peer discovery
NAKPAK Nested Anonymous Kernel for Private Authenticated Komms Onion routing
ANNEX Autonomous Network Negotiated eXchange Encrypted P2P channels
KHATA Kryptographic Handshake for Automated Trust Acceptance Trust distribution
MANTRA Message Amplification Network for Trust Relayed Announcements Message propagation