freecoding.school100% FREE · NO SIGNUP
Proof PeaksISSUE #35 of 38

ouroboros · provably secure pos

ZeekaVSThe Collision
Zeeka saysOuroboros uses VRF-based slot leadership weighted by stake — the first PoS protocol with rigorous security proofs under honest-majority assumptions.

Ouroboros is Cardano's family of provably secure PoS protocols. Time is divided into slots; for each slot, every staker computes a VRF over the slot index and their key. If the VRF output falls below a stake-weighted threshold, they are eligible to be a slot leader. Honest-majority security proofs assume less than 50% adversarial stake.

Practical variants (Praos, Genesis) added adaptive corruption resistance and bootstrap-without-checkpoints. The demo runs 10,000 VRF-weighted slot draws across five stakers with different stakes and shows the win frequencies approximate stake fractions — the security model in action.

Power-ups you unlock

The Collision attacks — common mistakes

Boss battleRun 10000 VRF-weighted slot draws across 5 stakers and confirm wins approximate stake fractions.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre id="o"></pre>
<script>
// Ouroboros: VRF output below stake-weighted threshold = slot leader.
const stakers = [
  { id:'A', stake:50 }, { id:'B', stake:20 }, { id:'C', stake:15 }, { id:'D', stake:10 }, { id:'E', stake:5 }
];
const total = stakers.reduce((s,x)=>s+x.stake, 0);
const H = (sk, slot)=>{ let h=2166136261>>>0; for(const c of (sk + ':' + slot)){ h^=c.charCodeAt(0); h=Math.imul(h,16777619); } return (h>>>0) / (2**32); };
const wins = Object.fromEntries(stakers.map(s => [s.id, 0]));
for(let slot = 0; slot < 10000; slot++) for(const s of stakers){
  if(H(s.id, slot) < s.stake / total) wins[s.id]++;
}
document.getElementById('o').textContent = [
  '10000 slots, VRF-weighted leader selection:',
  ...stakers.map(s => '  ' + s.id + ' stake=' + String(s.stake).padStart(2) + '%  won ' + String(wins[s.id]).padStart(4) + ' slots (' + (100*wins[s.id]/10000).toFixed(1) + '%)'),
  'wins ≈ stake → secure under honest majority of stake'
].join('\n');
</script></body></html>
▶ Open the interactive comic issue
‹ Avalanche · Metastable ConsensusAlgorand · Pure Pos · Vrf Committees ›