Article is online

How a Wallet Script Burned 1.77 BTC as Fees and Gave Miners 97% of a Block's Fees

How a Wallet Script Burned 1.77 BTC as Fees and Gave Miners 97% of a Block's Fees

Table of Contents




You might want to know


1. How can a Bitcoin transaction accidentally convert the entire input value into miner fees?


2. What protections (if any) exist to recover funds mistakenly paid as fees to a mining pool?



Main Topic


On August 12 (block height 962,142), a single Bitcoin block confirmed 4,700 transactions. Among them were four transactions originating from the same address that effectively turned their entire input amounts into miner fees, for a combined total of 177,153,578 satoshis (1.7715 BTC). Using the BTC price at the time of confirmation (about $64,180 per BTC), this equated to roughly $113,700 evaporated as fees. Those four transactions alone accounted for 97.4% of the block's total fee revenue (1.8189 BTC), leaving the remaining 4,695 transactions to share just about 2.6% of the fees.



The block was mined by SpiderPool, which collected a total reward of 4.9439 BTC for that block, comprised of the block subsidy and the transaction fees. The anomalous four transactions therefore delivered an outsized portion of the pool's earnings for that single block.



Examining the structure of the four transactions reveals why the funds were lost. Each of the four had a single input and a single output. The lone output was an OP_RETURN output with zero value. In Bitcoin, transaction fees are not specified in a separate field; they are simply the difference between total inputs and total outputs. When the only output is a zero-value OP_RETURN (and there is no change output returning leftover funds to the sender), the entire input becomes the fee. Because wallet software typically does not treat that situation as an explicit error, a script or automated process that constructs such a transaction may not trigger an obvious warning, and the mistake can be broadcast and mined as a normal transaction.



Chain analysis shows these four transactions were dependent on one another in UTXO sequence, and the amounts burned increased across them. The sequence of spent UTXOs shows the following burn amounts in satoshis (approximate USD in parentheses at time of confirmation): 174,592 sat (~$112), 1,799,921 sat (~$1,155), 14,835,180 sat (~$9,520), and then the large 160,343,885 sat (~$102,900). Prior to these burns, an earlier grouping transaction consolidated 12 small UTXOs into a single 1.6034 BTC UTXO while paying a normal low fee (858 sat, about $0.55). That consolidation step was perfectly ordinary, but the subsequent automated step that spent the consolidated UTXO produced the zero-value OP_RETURN outputs that converted most of the balance into fees.



Industry reporting and on-chain signs point to an automated wallet script misusing RBF (Replace-By-Fee) behavior as the proximate cause. The four offending transactions had their nSequence set to 0xfffffffd, which marks them RBF-eligible under common Bitcoin Core defaults. However, the use of RBF marks alone is not the root cause. The core issue was the transaction output structure: with no change output provided and the only non-dust output as a zero-value OP_RETURN, the fee becomes equal to the entire input amount. Wallets and scripts that assemble transactions must ensure change outputs are present when appropriate, or risk sending the entire input amount to miners.



This class of mistake has precedent. In April 2025 there was a reported incident that lost 0.75 BTC because a second RBF attempt consumed a large UTXO without sending change back. In June 2024 an automated consolidation error in a centralized wallet reportedly destroyed 254.28 BTC in fees. Those events together show a recurring operational risk when automation, consolidation scripts, and RBF semantics are combined without robust safeguards.



From a miner or pool perspective, the incident is financially beneficial. SpiderPool's block reward plus fees for block 962,142 totaled roughly $317,000 equivalent, with more than one third of that coming from transactions that effectively donated funds to the miner. Miners are under no obligation to refund mistakenly paid fees; refunds are purely voluntary and historically rare. While there have been exceptional cases where mining pools publicly asked victims to identify themselves and provided refunds, such actions are goodwill gestures rather than enforced remedies.



Why doesn't wallet software prevent this? Bitcoin's fee model means that fees are implicit. Wallets typically calculate necessary inputs and outputs, include a change output back to the sender, and set an appropriate fee. However, when a script programmatically builds transactions — especially when it uses OP_RETURN outputs for metadata or marking — it's easy to omit a change output by mistake or to construct an output that is zero value. Automated scripts may not surface a warning that the resulting fee equals the full input amount, so the transaction proceeds and is confirmed like any other.



Mitigations include stronger validation in wallet software and scripts to detect zero-value transactions with large inputs, explicit checks that change outputs are present, and user prompts when a constructed transaction would consume a full UTXO as fees. Best practices for developers include unit and integration testing of consolidation scripts, staged dry runs, and including per-transaction sanity checks that compare intended fees against reasonable thresholds. For operators of custodial or bulk-wallet systems, multi-step confirmation and manual review for large-value consolidation operations can avoid catastrophic loss.



In short, the August 12 event is a reminder of the operational hazards in on-chain automation. A modest bug or omission in a consolidation or fee-replacement script can transform tens or hundreds of thousands of dollars into miner fees with no on-chain recourse. The balance of responsibility lies with wallet developers, service operators, and script authors to build safeguards that prevent high-severity errors from slipping into production.



Key Insights Table











AspectDescription
IncidentFour transactions converted all inputs to fees, burning 177,153,578 sat (1.7715 BTC).
Share of block feesThose four transactions made up 97.4% of the block's fee income (1.8189 BTC).
CauseAutomated wallet/script error producing a zero-value OP_RETURN output and no change output, combined with RBF-marked transactions.
MinerSpiderPool mined block 962,142 and collected the fees; refunds are voluntary and rare.
PrecedentSimilar incidents include April 2025 (0.75 BTC) and June 2024 OKX consolidation loss (254.28 BTC).


Afterwards...


This event reinforces the need for comprehensive safeguards around automation and consolidation scripts. Organizations and developers should implement explicit checks that detect unusually large implicit fees, require confirmation for any transaction that would burn a significant portion of inputs, and avoid constructing transactions where the only non-dust output is OP_RETURN unless intentional. On the policy and tooling side, wallet libraries and UI clients can do more to warn users and block questionable transactions by default.



Finally, while miners sometimes return mistakenly paid funds as an act of goodwill, there is no on-chain mechanism to force a refund. The practical lesson is that operational discipline, stronger defaults in wallet software, and careful testing of automation are the reliable defenses against losing funds to accidental fee burns.


Last edited at:2026/8/14
#BTC

Claude AI

AI Smart Editor