EIP-779 · Final · Meta · 2017-11-26
EIP-779: Hardfork Meta: DAO Fork
Documents the 2016 DAO Fork: an irregular state change at block 1,920,000 that moved the ether of The DAO and its child DAOs into a refund contract, without changing any protocol rules.
What problem does it solve?
In June 2016, an attacker exploited a bug in The DAO, a large investment contract, and began draining its ether into "child DAO" contracts. The child DAO rules locked those funds for a period, which gave the community time to respond. After public debate and a stake vote, Ethereum clients shipped a hard fork that returned the ether to DAO token holders.
EIP-779 was written in late 2017, after the fact. It records exactly what that fork did, so the DAO Fork has a Meta EIP like every other hard fork.
How it works
Unlike other hard forks, the DAO Fork changed no protocol rules. Opcodes, transaction format and block structure all stayed the same. It was a one-time irregular state change:
- List
L: the accounts were fixed using block 1,880,000. They were The DAO, itsextraBalanceaccount, every child DAO created by the DAO creator contract, and each child'sextraBalance. The full list is in the spec. - Transfer: at the start of block 1,920,000 on mainnet, the entire ether balance of every account in
Lmoved to a WithdrawDAO contract at0xbf4ed7b27f1d666546e30d74d50d173d20bca754. - Refunds: WithdrawDAO has a
withdraw()function. It takes a holder's DAO tokens and sends back one wei per token unit taken. A trustee address can withdraw only the leftover surplus. - Fork marker: blocks 1,920,000 through 1,920,009 must carry the ASCII string
dao-hard-forkin theirextraData. This let nodes on each side of the split quickly tell which chain a peer was following.
Sample code
Check the fork marker on a mainnet block (ethers v6):
import { JsonRpcProvider, toUtf8String } from "ethers";
const provider = new JsonRpcProvider(process.env.RPC_URL);
const block = await provider.getBlock(1_920_000);
console.log(block!.extraData); // 0x64616f2d686172642d666f726b
console.log(toUtf8String(block!.extraData)); // "dao-hard-fork"
Things to know
- This proposal is Final. It records an event that already happened (July 2016), so it did not propose new behavior.
- The fork was controversial. Nodes that refused it kept following the original, unforked chain, which became Ethereum Classic.
- The precedent led to later proposals to recover other lost funds by irregular state changes, such as EIP-999 (Withdrawn) and the general framework in EIP-867 (Stagnant). None were adopted, and the DAO Fork remains the only irregular state change on Ethereum mainnet.
- The DAO Fork came after Homestead (EIP-606), which is why this EIP lists it as required.