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

gasper · lmd-ghost + ffg

ZeekaVSThe Collision
Zeeka saysGasper combines LMD-GHOST (pick the head by latest-message weight) with Casper FFG (finalize via supermajority votes) — Ethereum’s production consensus.

Gasper is the union of two protocols. LMD-GHOST (Latest-Message-Driven GHOST) is the fork choice: each validator's most recent attestation counts as one vote toward that branch, and the head is the heaviest subtree by latest votes. Casper FFG is the finality gadget on top: 2/3 supermajorities at checkpoint boundaries finalize blocks below the fluid head.

The two roles complement each other. LMD-GHOST picks WHERE to attest right now; FFG decides what is permanently IRREVERSIBLE. The demo shows them in tandem: the head shifts based on recent attestation weight, while a finalization marker advances along the chain whenever two consecutive epochs justify.

Power-ups you unlock

The Collision attacks — common mistakes

Boss battleShow how LMD-GHOST picks the current head while FFG marks a deeper block as finalized.

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>
// Gasper: LMD-GHOST picks the head from latest-message weight; FFG finalizes via 2/3 votes.
const blocks   = ['B32', 'B64', 'B96', 'B128', 'B160'];   // checkpoints
const ffgVotes = [100, 80, 75, 60, 90];                   // % stake voting per checkpoint
const lmdW     = [10, 18, 22, 28, 35];                    // latest-message weight per branch
const justified = ffgVotes.map(v => v >= 67);
const finalized = justified.map((j,i) => j && i+1 < justified.length && justified[i+1]);
const head     = blocks[lmdW.indexOf(Math.max(...lmdW))];
const lastFin  = finalized.lastIndexOf(true);
const finalBlk = lastFin >= 0 ? blocks[lastFin] : 'genesis';
document.getElementById('o').textContent = [
  'LMD-GHOST head:  ' + head + '   (heaviest by latest messages: weight ' + Math.max(...lmdW) + ')',
  'FFG finalized:    ' + finalBlk + '   (last consecutive justification)',
  'two roles: LMD-GHOST picks the FLUID head; FFG decides what is IRREVERSIBLE'
].join('\n');
</script></body></html>
▶ Open the interactive comic issue
‹ Casper Ffg · The Finality GadgetSingle-Slot Finality · The Endgame ›