Skip to content

Instantly share code, notes, and snippets.

@draeder
Created April 12, 2026 06:34
Show Gist options
  • Select an option

  • Save draeder/ac0405667048fcec10b4c8408f1cc768 to your computer and use it in GitHub Desktop.

Select an option

Save draeder/ac0405667048fcec10b4c8408f1cc768 to your computer and use it in GitHub Desktop.

Convergent Extremal Coordinate Routing (CECR)

A decentralized routing model combining gossip-based membership convergence, extremal coordinate embedding, and XOR-based direct routing.


Overview

CECR is a hybrid routing system designed for peer-to-peer networks that:

  • Avoids full-mesh connectivity
  • Maintains stable routing under churn
  • Requires no central authority
  • Converges using gossip alone

It combines three mechanisms:

  1. Membership Convergence via gossip
  2. Extremal Coordinate Embedding using global min/max
  3. Hybrid Routing using:
    • normalized coordinate proximity
    • XOR distance (Kademlia-style)

Definitions

Let the global peer set be:

S = { id₁, id₂, ..., idₙ }

Where each id is a fixed-width identifier (e.g. SHA-1 hash).

Define:

m = min(S) M = max(S) N = |S|

Constraints:

M > m
N ≥ 2


Coordinate System

Each peer is mapped into a normalized 1D coordinate space:

p(i) = (i - m) / (M - m)

Range:

0 ≤ p(i) ≤ 1


Distance Metric (Coordinate Space)

Distance between peers:

d_ratio(i, j) = |p(i) - p(j)| = |i - j| / (M - m)


XOR Metric (Routing Backbone)

Define XOR distance:

d_xor(i, j) = i XOR j

Routing decision:

next_hop = argmin_k (k XOR target)


Gossip-Based Membership Convergence

Peer set:

S = set of peer IDs

Canonical hash:

H(S) = Hash(sort(S))

Peers converge to:

m = min(S)
M = max(S)
N = |S|


Broadcast Strategy

Fan-out:

f(N) = ceil(log2(N))


Stability Model

Between membership changes:

p(i) is constant

Only changes when:

  • new global min/max joins
  • existing min/max leaves

Bounded Drift

Using stale extrema:

p̃(i) = (i - m̃) / (M̃ - m̃)

Error is bounded and small:

|p̃(i) - p(i)| ≤ ε


Hybrid Routing Strategy

Local routing:

minimize d_ratio(i, target)

Global routing:

minimize d_xor(i, target)


Design Properties

  • Decentralized
  • Convergent
  • Stable
  • Scalable (O(log N))
  • Fault tolerant

Summary

CECR creates a shared coordinate system over a dynamic peer set while preserving routing correctness via XOR distance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment