The DAO and the fork
In 2016 a flaw drained a third of all the ether raised for a single project. The response settled, in public, what “code is law” actually means.
The DAO was an investment fund with no managers. Participants contributed ether, received voting tokens, and the collective would vote on where to deploy capital. It raised a very large share of the ether then in circulation during a crowdsale in spring 2016.
The flaw
The withdrawal function sent funds to the caller before updating its record of what that caller was owed. An attacking contract could accept the payment and, during that acceptance, call withdraw again — repeatedly, against a balance the contract had not yet decremented.
The pattern had been described publicly, and concerns about the specific code had been raised before the attack. The exploit began in June 2016 and drained roughly 3.6 million ether into a subsidiary contract subject to a delay before the attacker could remove it. That delay is the only reason there was time to debate a response.
The argument
Ethereum's community had to choose within weeks, in public, with the money visible on-chain.
- Do nothing. The contract executed exactly as written. Intervening would prove that outcomes can be reversed when enough important people dislike them, destroying the property that made the platform worth using.
- Intervene. A theft of that scale, this early, would end the project. The rules are what participants agree they are, and they agreed this was a theft.
What happened
The majority adopted software that reassigned the drained ether to a recovery contract. Those who refused continued on the unaltered chain, which became Ethereum Classic. Both networks exist today. Everyone holding ether at the fork held a balance on both — see forks.
What it actually established
Nothing technical prevented the change. What prevents changes ordinarily is that enough independent participants refuse to run software containing them. On this occasion enough agreed, so the change happened. Immutability means it is very hard to alter history because people will not cooperate — a real and valuable guarantee, and a categorically different one from impossible.
It also established that the bar is extremely high. Ethereum has not done anything comparable since, through exploits of similar and larger scale. The precedent did not become a habit, which is the outcome its defenders hoped for and its critics doubted.
What changed in practice
- Reentrancy guards became standard, and the checks-effects-interactions ordering became the first thing taught to contract developers.
- Professional auditing became an industry rather than an afterthought.
- Time delays on large withdrawals became a common design, precisely because the delay in The DAO is what made any response possible.
- The phrase "code is law" largely left serious usage, surviving mainly as a slogan on the chain that kept it.