/building-a-cryptocurrency:coin-consensus-and-finalityfrom building-a-cryptocurrency
Guides selection of consensus mechanisms for cryptocurrency chains: proof-of-work, proof-of-stake, Gasper, BFT, DAG designs, finality types, and validator economics.
Ships in building-a-cryptocurrency. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Part 3 of 8 of the Building a Cryptocurrency reference (plugin
building-a-cryptocurrency), covering §3 — proof of work, proof of stake, Sybil resistance, fork choice and what finality actually means. Sibling skills:coin-what-it-is-and-the-three-architectures(§1 — the replicated-state-machine definition and the Bitcoin / Ethereum / Monero reference architectures),coin-cryptographic-primitives(§2 — the hashes, signatures, key derivation and commitment schemes a chain is built from),coin-building-a-utxo-chain(§4 — the UTXO ledger model, script, transaction validation and what a fork of Bitcoin actually involves),coin-building-an-account-chain(§5 — the account/world-state model, the EVM, gas, and building a chain with smart contracts),coin-privacy-features(§6 — ring signatures, stealth addresses, confidential amounts and zero-knowledge approaches),coin-networking-and-tokenomics(§7–§8 — peer-to-peer gossip and propagation, then issuance, fees, supply schedules and incentive design),coin-security-and-the-build-guide(§9–§10 — what actually loses money, and the ordered guide to building and launching a chain),Section numbers are shared across the whole set: a reference written as §N →
skillpoints into that sibling skill. This is an engineering reference, not investment, legal or tax advice — deploying a chain that handles real value carries securities, AML/KYC and consumer-protection obligations that are a question for counsel in your jurisdiction.
Consensus is the heart of a cryptocurrency. It solves the problem of distributed agreement in a network where anyone can join, no one is trusted, and participants may be adversarial. The consensus mechanism determines how blocks are produced, how conflicts are resolved, and how the network resists attacks.
Carried forward from the document's opening SCOPE AND DISCLAIMER: creating a cryptocurrency is a legitimate software engineering exercise with well-documented open-source reference implementations, but deploying one that handles real value carries serious legal, financial and security responsibilities. Consult counsel regarding securities law, AML/KYC requirements and consumer protection regulations in your jurisdiction before launching anything that distributes tokens to the public. Choosing a consensus mechanism is where that exposure begins — it fixes who earns the issuance and who can censor.
Mining is Sybil-resistant leader election by burned energy. Miners compete to find a nonce that makes the hash of the block header fall below a difficulty target. The first miner to find a valid hash gets to propose the next block and receives the block reward (new coins plus transaction fees). The energy expenditure — not identity — is what makes rewriting history expensive: to reorganize the chain, an attacker must redo the work for all blocks they want to replace, faster than the honest network produces new ones.
Block hash = SHA256d(version || prev_block || merkle_root
|| timestamp || bits || nonce)
Valid if: block_hash < target
(where target is derived from the 'bits' field)
Difficulty retargets every N blocks to maintain target block time
One correction to the source here. The source writes the first line nested, as
SHA256d(SHA256d(...)). But SHA-256d is itself double SHA-256 (§2 →
coin-cryptographic-primitives), so that nesting is four SHA-256 passes, and anyone implementing it
literally would compute a proof-of-work hash no Bitcoin node agrees with. Bitcoin applies
SHA-256d once, to the 80-byte serialized block header — which is what is written above. The
remaining lines are reproduced as the source has them.
Difficulty adjustment. The network periodically retargets the difficulty to keep the block interval near the target, regardless of how much mining power joins or leaves. Bitcoin retargets every 2,016 blocks (~2 weeks) to hold 10-minute blocks. If blocks are coming too fast, difficulty increases; too slow, it decreases. This is a simple feedback loop, but it is essential — without it, the block interval would be chaotic. (Computed from those two figures: 2,016 × 10 min = 20,160 minutes ≈ 14 days, which is the ~2 weeks the source states.)
Probabilistic finality. PoW has no explicit finality — there is always a mathematical possibility that a longer chain could be found. But each block on top of your transaction raises the cost of rewriting history exponentially. Conventionally, 6 confirmations (blocks) is treated as settled for Bitcoin, but the right number depends on the value at risk and the attacker's hashpower. For small payments, 1–3 may suffice; for enormous settlements, wait longer.
| Value at risk | Confirmations the source suggests |
|---|---|
| Small payments | 1–3 blocks may suffice |
| Conventional Bitcoin settlement | 6 confirmations, treated as settled |
| Enormous settlements | Wait longer than 6 — judge against attacker hashpower |
The 51% attack reality. A miner controlling >50% of hashrate can reorganize the chain, double-spend, and censor transactions. But they cannot steal keys, create coins out of thin air, or change the consensus rules. For small PoW chains, the security budget (what honest miners earn) may be small enough that an attacker can rent or buy majority hashrate economically.
| Can a >50% attacker do this? | Answer |
|---|---|
| Reorganize the chain | Yes |
| Double-spend | Yes |
| Censor transactions | Yes |
| Steal keys | No |
| Create coins out of thin air | No |
| Change the consensus rules | No |
Monero, 2025 — a worked example of a rented majority. A project called Qubic paid miners more than the block reward to mine XMR, achieving an estimated 28–35% hashrate share and producing a 6-block reorganization. The lesson the source draws: selfish mining can degrade a chain well below the 51% threshold — you do not need a majority to hurt a chain, and 28–35% was enough to produce a reorg the length of Bitcoin's conventional settlement depth.
Your choice determines who can mine and how decentralized your network is. ASIC resistance is an arms race — Monero has changed its PoW algorithm multiple times to defeat ASICs.
| Algorithm | Used by | Hardware profile | Consequence |
|---|---|---|---|
| SHA-256d | Bitcoin | Dominated by ASICs | Mining is industrial, but the network is very secure because the hardware cost of attack is enormous |
| RandomX | Monero | CPU-optimized, designed so that ASICs are uneconomic | Keeps mining decentralized on commodity hardware |
| Ethash | Old Ethereum, now deprecated | Memory-hard | A middle ground |
Instead of burning energy, validators bond capital (stake). The network selects a block proposer proportional to their stake (or randomly among stakers). Misbehavior is punished by slashing — the network destroys part of the validator's stake for provable offenses like double-signing (equivocation). Being offline is also penalized (inactivity leaks), though less severely.
Ethereum's Gasper (post-Merge) has two components:
| Component | What it does |
|---|---|
| LMD-GHOST | Fork choice — follow the heaviest subtree of attestations |
| Casper FFG | Finality — a checkpoint finalizes after 2/3 of staked ETH attests, giving explicit finality after two epochs, ~13 minutes |
Validators stake 32 ETH, attest to blocks each epoch, and occasionally propose blocks. This is the most battle-tested PoS design, but it is also complex — the spec is hundreds of pages.
The nothing-at-stake problem. In PoW, mining on a losing chain wastes real energy. In PoS, signing on multiple forks costs nothing (unless caught and slashed). The solution is slashing — make the cost of equivocation larger than the potential gain. Ethereum's slashing destroys a significant portion of the validator's stake and ejects them from the validator set.
Validator economics. PoS creates a tension between decentralization (many small validators) and efficiency (fewer, larger validators). Ethereum requires 32 ETH per validator, which is a barrier. Liquid staking (Lido, Rocket Pool) lets users stake smaller amounts through intermediaries, but this concentrates stake with a few large operators — a real centralization concern.
Tendermint/CometBFT, HotStuff, and similar designs give instant finality: once a block is committed, it is final — no reorganizations. The trade-off is that they work well with small validator sets (dozens to low hundreds) but degrade with thousands. If more than 1/3 of validators are offline or malicious, the chain halts. These designs are popular for application-specific chains (Cosmos SDK) where the validator set is known and managed.
DAG-based and leaderless designs. Several newer cryptocurrencies use directed acyclic graph structures where transactions reference multiple previous transactions, enabling parallel processing. These are real but less battle-tested than the three main families.
Derived from the §3 prose above; every cell traces to a sentence in this section.
| PoW | PoS | BFT (Tendermint/CometBFT, HotStuff) | DAG / leaderless | |
|---|---|---|---|---|
| Sybil resistance | Burned energy | Bonded capital (stake) | Known, managed validator set | Not stated in §3 |
| Leader selection | First to find a valid nonce | Proportional to stake, or random among stakers | Validator set voting | Leaderless |
| Finality | Probabilistic — no explicit finality | Explicit — Casper FFG after two epochs, ~13 min | Instant — no reorganizations once committed | Not stated in §3 |
| Misbehavior penalty | Wasted energy on a losing chain | Slashing; inactivity leaks for being offline | Not stated in §3 | Not stated in §3 |
| Scale profile | Global, open participation | Global, but 32 ETH per validator is a barrier | Dozens to low hundreds; degrades with thousands | Parallel processing of transactions |
| Liveness failure | Chain continues; reorgs possible | Not stated in §3 | Halts if >1/3 of validators are offline or malicious | Not stated in §3 |
| Maturity | Most proven | Most battle-tested PoS design, but complex | Popular for application-specific chains (Cosmos SDK) | Real but less battle-tested |
What "finality" actually means here. Three distinct guarantees, and they are not interchangeable:
| Finality model | Guarantee | Where it comes from |
|---|---|---|
| Probabilistic | No explicit finality; each additional block raises the cost of rewriting history exponentially | PoW — settled by convention at 6 confirmations for Bitcoin |
| Explicit | A checkpoint is finalized once 2/3 of staked ETH attests — ~13 minutes, two epochs | PoS via Casper FFG |
| Instant | Once committed, final; no reorganizations | BFT-style consensus |
Synthesis of §3 above with the consensus decision framing the source states in §1; no claim here goes beyond what those two sections say.
coin-what-it-is-and-the-three-architectures,
and the reason this section exists): decentralization, security and scalability pull against each
other, and every design picks a point on that triangle.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
8 skills in this plugin
/coin-building-an-account-chainUse when deciding between shipping an ERC-20 token, a new account-model chain, or an L2 rollup, and when designing or reviewing account state, EVM data locations, gas budgets, call semantics, or a fungible token contract. Covers the account world-state model, the EVM stack machine and its storage costs, the EIP-1559 gas system, the ERC-20 interface and its integration hazards. Part 5 of the Building a Cryptocurrency reference./coin-building-a-utxo-chainUse when designing or implementing a UTXO-based chain, modelling transaction inputs and outputs, writing or auditing Bitcoin Script locking and unlocking scripts, deciding which address formats a wallet or node must support, or forking Bitcoin. Covers the UTXO ledger model, block structure and chain linkage, the coinbase transaction and its maturity rule, Script validation, and the four Bitcoin address types. Part 4 of 8 of the Building a Cryptocurrency reference./coin-cryptographic-primitivesUse when choosing a hash function, signature scheme, address format or key-derivation path for a chain, when building Merkle proofs or SPV inclusion checks, or when reviewing a nonce, seed-phrase or multisig design for hazards. Covers hash properties and current status, ECDSA against Schnorr, EdDSA and ring signatures, Merkle trees and the Merkle-Patricia trie, and BIP-32/39/44/380 key derivation. Part 2 of the Building a Cryptocurrency reference./coin-networking-and-tokenomicsUse when designing or debugging the peer-to-peer layer of a chain — DNS seeds, peer exchange, inv and getdata gossip, compact block relay, mempool and relay policy — or when setting issuance, supply caps, tail emission, fee markets, token distribution and the security budget. Covers the policy versus consensus distinction and the trade-offs of each distribution method. Part 7 of 8 of the Building a Cryptocurrency reference./coin-privacy-featuresUse when adding sender, receiver or amount privacy to a chain, choosing among ring signatures, stealth addresses and confidential transactions, sizing an anonymity set, planning a move to full-chain membership proofs, or weighing mandatory privacy against exchange delisting and EU AMLR exposure. Covers the Monero reference design end to end: stealth address derivation and view-key scanning, ring size 16, Pedersen commitments with Bulletproofs+ range proofs, FCMP++, Dandelion++, subaddresses and RandomX. Part 6 of 8 of the Building a Cryptocurrency reference./coin-security-and-the-build-guideUse when auditing a chain or a contract for the failures that actually drain funds, choosing between an ERC-20 token, an L2 rollup and a new blockchain, picking the language, consensus, signature, wallet and explorer stack for a custom chain, or working a pre-mainnet launch checklist. Covers the 2025-2026 loss data, the design principles and key-management rules that prevent most bugs, and the three build paths with their timelines. Part 8 of 8 of the Building a Cryptocurrency reference.npx claudepluginhub the-vibey-project/vibey --plugin building-a-cryptocurrency