Blog/Ravencoin's KAWPOW Consensus Flaw: How a Single Unchecked Header Field Put Four Days of Transactions at Risk
Incident ReportRavencoin·RVN

Ravencoin's KAWPOW Consensus Flaw: How a Single Unchecked Header Field Put Four Days of Transactions at Risk

A critical gap in Ravencoin's KAWPOW proof-of-work validation allowed an attacker to insert invalid blocks from height 4,487,776, splitting the network and threatening to reverse nearly four days of transactions. Major mining pools deployed an emergency patch and began rebuilding a clean chain from the last known-good block while exchanges suspended RVN flows to limit double-spend exposure.

Protocol
Ravencoin
Chain
RVN
Total loss
Price −17% (ATL)
Published
11 August 2026
Editorial Disclaimer

This article is published for educational and informational purposes only. It does not constitute legal, financial, or investment advice. Nothing in this article should be relied upon as the sole basis for any decision relating to the security, investment value, or legal standing of any protocol or digital asset.

This is a preliminary analysis based on publicly available reporting and open-source code review. An official post-mortem has not yet been published by the affected protocol at time of writing. Any code samples included are illustrative reconstructions for educational purposes only and do not represent confirmed exploit code. This article will be updated when authoritative technical disclosure is available.

Information published on any code vulnerabilities must not be used to attack, test, or probe any protocol or system without explicit authorisation from its owner. Use of this content is subject to our Terms of Service and Privacy Policy.

What Happened

On August 7, 2026, an attacker exploited a critical consensus-layer flaw in Ravencoin's KAWPOW proof-of-work algorithm to insert a sequence of invalid blocks into the live chain beginning at height 4,487,776. Because the malformed blocks passed all validation checks that nodes had been performing up to that point, the majority of the network accepted them as canonical — splitting Ravencoin into two competing chains and threatening to unwind every transaction confirmed since approximately August 4, a window covering nearly four days of on-chain activity.

The attack was not a smart-contract exploit or a bridge hack. It targeted the lowest layer of the protocol stack: the consensus rules that govern which blocks are valid and which are not. By crafting a block whose KAWPOW header declared a different height than the block actually occupied, the attacker bypassed a validation path that Ravencoin's node software had never enforced. The network's honest majority of miners did not detect the anomaly in time to reject it at the protocol level, so the corrupted chain continued to grow.

Timeline snapshot. First invalid block: height 4,487,776, August 7, 2026, approximately 15:44 UTC. Exchange suspension notices (Upbit, Bitget): August 8. Emergency patch deployed by 2Miners and RavenMiner: August 9–10. CoinDesk coverage and public disclosure: August 11. RVN price fell roughly 17–19% to an all-time low as the reorg risk became widely understood.

Major mining pools — 2Miners and RavenMiner together commanding a majority of the network's hash rate — responded by halting work on the corrupted chain and beginning to construct a replacement chain from block 4,487,775, the last block confirmed before the exploit. They deployed an emergency hotfix that rejected any block whose declared height in the KAWPOW header did not match the block's actual position in the chain, a check the original codebase had simply omitted.

Multiple exchanges suspended RVN deposits and withdrawals as a precaution, citing the risk that transactions appearing fully confirmed on the exploited chain could be reversed if the honest replacement chain overtook it. Upbit and Bitget were among the first to issue suspension notices, warning users that seemingly final confirmations were not reliable while the two chains competed. The potential scope of reversal — nearly four days of transactions — made this one of the deepest threatened reorganizations in Ravencoin's history.

Root Cause Analysis

Ravencoin switched from its original X16R proof-of-work algorithm to KAWPOW in May 2020, adopting the same algorithm used by Ergo and several other GPU-mineable chains. KAWPOW extends the ProgPoW design by incorporating the block height directly into the mining seed, making each block's valid proof-of-work cryptographically dependent on where that block sits in the chain. The design intent is straightforward: a block mined with the seed for height 4,487,900 cannot be replayed at height 4,487,776, because the underlying hash would not satisfy the difficulty target for the wrong position.

The problem is that this guarantee only holds if the node verifying the block also checks whether the height embedded in the KAWPOW header matches the block's actual chain position. Ravencoin's validation code computed the expected seed and verified the proof-of-work hash correctly — but it read the height value from the block header itself rather than from the node's own knowledge of where the block would sit. An attacker who supplied a block with a manipulated nHeight field could therefore satisfy the KAWPOW proof-of-work check using a height of their choosing, while the node would never compare that declared height against the chain's actual tip.

Core flaw. The KAWPOW seed derivation used header.nHeight— a value controlled by the block producer — instead of the independently known chain height. Because the two were never compared, a block with a forged height field passed consensus validation.

The following illustrative reconstruction shows the vulnerable validation pattern in Ravencoin's C++ node code. This is a simplified representation based on the open-source Ravencoin codebase and community technical disclosures; the exact lines in the affected release may differ, and an official post-mortem had not been published at the time of writing. We will update this section when the maintainers release authoritative details.

// VULNERABLE — height taken from the header itself (attacker-controlled)
bool CheckKAWPOW(const CBlockHeader& header, const Consensus::Params& params) {
    // nHeight is read directly from the block header field.
    // If an attacker sets header.nHeight to an arbitrary value, the seed
    // computation proceeds with that value — and there is no check that
    // header.nHeight equals the actual expected chain position.
    uint64_t seed = compute_kawpow_seed(header.nHeight);

    return verify_kawpow(
        header.GetHash(),
        seed,
        header.nBits
    );
}

// No comparison between header.nHeight and the node's own chain height.
// The node would need to pass expectedHeight as a parameter and assert:
//   if (header.nHeight != expectedHeight) return false;

The patched version, as deployed by pool operators via the emergency hotfix and later formalised by the Ravencoin development team, adds a single mandatory check before proceeding with the KAWPOW verification. The node computes the height at which the block is expected to appear — based on the validated chain tip it has already accepted — and rejects any block whose header height field does not match that expected value.

// PATCHED — declared height compared against independently known chain position
bool CheckKAWPOW(
    const CBlockHeader& header,
    int expectedHeight,            // derived from the node's validated chain tip
    const Consensus::Params& params
) {
    // Reject immediately if the header's declared height doesn't match
    // where this block must actually sit in the chain.
    if (header.nHeight != (uint64_t)expectedHeight) {
        return error("CheckKAWPOW: header height %d does not match "
                     "expected chain height %d", header.nHeight, expectedHeight);
    }

    uint64_t seed = compute_kawpow_seed(header.nHeight);

    return verify_kawpow(
        header.GetHash(),
        seed,
        header.nBits
    );
}

A second, separate bug identified during the incident response involved an integer overflow in Ravencoin's asset transfer logic. Asset amounts stored as 64-bit integers could be manipulated to wrap around under certain arithmetic operations, potentially allowing the creation of asset balances that exceeded the intended supply cap. This vulnerability appears to have been present independently of the KAWPOW flaw and was patched alongside it, though published reports do not indicate whether it was actively exploited during this incident.

The KAWPOW height-validation gap had been present in Ravencoin's codebase since the algorithm's introduction in 2020. Its discovery in 2026 is consistent with a pattern seen across proof-of-work chains: consensus-layer validation logic tends to receive less adversarial scrutiny than smart-contract code, and subtle omissions in header field verification can go undetected across multiple releases until an attacker specifically looks for them. Community technical write-ups confirmed the fix rule: reject blocks where the declared and actual heights differ.

Incident Response

The initial response came not from the Ravencoin core development team but from mining pool operators. 2Miners and RavenMiner, which together represented a majority of the network's hash rate, identified the anomaly, isolated the point of divergence at block 4,487,775, and deployed a custom patched build that enforced the height-matching rule. They then began mining a clean replacement chain from that checkpoint, effectively refusing to extend the exploited chain further.

A checkpoint was hardcoded at block 4,487,775 in the patched node builds. Hardcoded checkpoints are a blunt instrument — they introduce a degree of centralisation into what is meant to be a permissionless chain — but they serve a clear purpose in an active incident: they make it impossible for nodes running the patched software to reorganise past the known-good state, preventing an attacker from using accumulated work on the exploited chain to later overwrite the recovery chain once the honest majority has rebuilt sufficient proof-of-work depth above the checkpoint.

Recovery mechanics. Because the replacement chain had to accumulate proof-of-work equivalent to nearly four days of blocks before it could overtake the corrupted chain in cumulative difficulty, the reorganisation was expected to take additional time even with majority hash rate behind it. Transactions confirmed on the exploited chain between block 4,487,776 and the reorganisation point were at risk of being reversed. Some of those transactions would re-enter the mempool and eventually confirm on the replacement chain; others would not, depending on whether their inputs remained unspent after the reorg.

Exchanges that had continued processing RVN deposits and withdrawals during the incident window faced potential double-spend exposure. Upbit and Bitget suspended RVN flows within roughly 24 hours of the exploit becoming public, but exchanges that acted more slowly may have credited user accounts for deposits that would later disappear from the canonical chain. The Ravencoin development team and pool operators communicated directly with major exchange security teams to coordinate timing for the transition to the replacement chain.

The Ravencoin core team subsequently released a formal software update incorporating the patched KAWPOW validation logic and the asset-overflow fix. Node operators were advised to upgrade immediately. The team also issued guidance on the expected timeline for the replacement chain to accumulate sufficient proof-of-work to make further reorganisation economically infeasible, which represented the practical point at which transactions on the clean chain could be considered final.

Lessons Learned

The Ravencoin incident illustrates a class of vulnerability that is easy to overlook precisely because it lives below the application layer. Most security reviews of blockchain systems focus on smart contracts, bridge logic, oracle integrations, and governance mechanisms. Consensus-layer code — the rules that define what constitutes a valid block — is often treated as settled infrastructure that does not require ongoing adversarial review. This incident demonstrates that assumption is wrong.

The KAWPOW height-validation gap was not a complex logical flaw requiring deep protocol knowledge to understand. Once identified, it is obvious: a field controlled by the block producer should never be used as an authoritative input to a validation function without being independently verified against the node's own state. The fact that this check was absent for six years — across multiple audits, forks, and upgrades — reflects how rarely consensus-layer code is subjected to the same adversarial mindset applied to higher-level application logic.

This was not Ravencoin's first consensus incident. In 2020, a separate inflation bug allowed an attacker to mint approximately 315 million RVN tokens beyond the protocol's intended supply cap. That incident also exploited a gap in the chain's validation logic rather than an application-layer contract. Repeated consensus-layer incidents on the same chain suggest that the codebase may benefit from a dedicated, adversarial audit of its core validation routines as a standalone engagement — separate from broader security reviews of wallet software, APIs, or higher-level tooling.

For proof-of-work chains that have adopted custom mining algorithms, the relevant attack surface extends to every field in the block header that participates in seed derivation or difficulty calculation. Any such field that is read from the attacker-controlled header rather than derived from trusted chain state is a potential manipulation point. Audits should explicitly enumerate these fields and verify that each one is either independently validated against chain state before use, or is provably impossible to forge given the difficulty target.

The incident also highlights the coordination demands placed on ecosystem participants during a consensus-layer emergency. Mining pools, exchanges, wallet providers, and node operators all need to act in concert — and quickly — when the chain itself is compromised.As CoinDesk reported, the network's recovery depended on pool operators being both technically capable of deploying a custom patch under time pressure and willing to coordinate that deployment with other major pools simultaneously. Chains that lack established relationships between their development team and large mining entities face a materially harder recovery path in equivalent scenarios.

Finally, the four-day reorg window underscores the importance of deep-reorganisation risk frameworks for exchanges and custodians listing proof-of-work assets. Most exchange confirmation requirements are calibrated for orphan-block risk — the natural occasional occurrence of short chain splits of one or two blocks — not for adversarial reorgs spanning thousands of blocks. A production incident policy that treats reorgs deeper than six blocks as requiring manual review would have flagged the Ravencoin situation immediately, rather than allowing automated deposit crediting to continue during a window when canonical finality was genuinely in question.

Share
Want to talk to our security team?
Book a free 30-minute call with a Deep Guard engineer to discuss your protocol's security needs.
Book a call
Get security insights in your inbox
New incident reports and research delivered when we publish. No spam.
Back to all posts