SMART CONTRACTS, DEFI & WEB3 SECURITY - Chapter 6, Exercise 2 Solution ========================================================== Why Refunding Many Small Contributions Cost Proportionally More PROBLEM ------- Using this chapter's own ConstitutionDAO refund problem and Chapter 2's own gas-fee material, explain specifically why refunding thousands of small individual contributions on-chain was more expensive, proportionally, than refunding a smaller number of large contributions would have been. SOLUTION -------- Chapter 2 established that a real, individual transaction has a roughly fixed real gas cost regardless of how much value it's actually moving - a standard ETH transfer costs the same real 21,000 gas whether it's sending $5 or $5,000. Gas cost scales with the number and complexity of operations performed, not with the dollar value being transferred. This chapter's own real figures show exactly why that fixed-per- transaction cost becomes a much bigger proportional problem for a small donation than a large one. This chapter states some contributors paid a real $70 in gas fees to donate or withdraw as little as $200 - a real 35% of the contribution's own value consumed purely by network fees. If that same real $70 gas cost had instead been attached to refunding a $20,000 contribution, it would represent a real, comparatively tiny 0.35% of that contribution's value instead. ConstitutionDAO's own real, median contribution was only about $217 (per this chapter), out of thousands of individual contributors overall - meaning the typical contributor was exactly the small-donor case where a roughly fixed per-transaction gas cost eats a real, large percentage of the refund. Refunding the same real $47 million total raised through a much smaller number of large contributions instead would have meant paying that same rough gas cost per transaction far fewer times overall, consuming a far smaller total percentage of the funds being refunded. ANSWER: Because gas cost is roughly fixed per transaction rather than scaling with the dollar amount transferred, thousands of small individual refunds each paid close to the same real gas cost as a single large refund would have - making the fee a genuinely large percentage of a small contribution (a real $70 fee on a $200 donation) but a comparatively tiny percentage of a large one, so refunding many small contributions was proportionally far more expensive in total than refunding fewer, larger ones would have been. ---- WHY THIS WORKS AS AN ANSWER This directly applies Chapter 2's own fixed-per-transaction gas cost principle to this chapter's own real ConstitutionDAO figures, with a concrete percentage comparison showing precisely why contribution size determines how painful a fixed gas fee actually is.