“You have to know the past to understand the present.”
Carl Sagan
Ethereum wasn’t even one year old when the DAO hack happened. Even in its infancy, the hack gave the mega brains running the show a $150 million-headache and caused the community to wonder how decentralized Ethereum really was. It also gave us Ethereum Classic. I missed the insanity of the early years, and felt like I should give myself a history lesson. So here is. What was the Ethereum DAO hack? How did it happen... why did it happen... and that's about it. I've got meme coins to buy at the top.
Let's start with some generalisations. A DAO (Decentralized Autonomous Organisation) is an alternative to the traditional ways of governance and hierarchy that have led to the cultural, professional, financial and economic imbalance we know and love today. In a DAO, centralized power brokers resplendent in their thirst for power are replaced by code. Instead of ridiculous people and incompetent management, a self-executing smart contract takes care of business.
We’ve all worked for people who should have been replaced by a smart contract.
Hold up... a DAO is a smart contract and a smart contract is a DAO?
Not quite. You still need people to program the thing, to define the rules of the organization, decide and vote on where the money, ideas and decisions go. These are written into the smart contract. And back then... hunting season for the hackers ensued.
...Is a smart contract sentient?
No. It’s a piece of code sitting in untouchable splendour like some kind of dead French King. Smart contracts work on IF / Then principles. You know, if... Imagine you place a bet with friend on who's going to win the FA Cup, or the Superbowl... Or the Stanley Cup, I don't know, people watch Ice Hockey. Instead of an intimidating bookie with a cut-throat razor, we get a smart contract to execute the payments to your friend when you recklessly predict Blackburn Rovers to win 8-0.
THE DAO SMART CONTRACT
The DAO (not A DAO, THE DAO) was a financial tool, a decentralized investment fund without third party brokers shovelling their cut into retail investment in London. Investors put ETH into the smart contract and projects in the Ethereum ecosystem could bid for investment from it. The DAO community would then vote on which projects to invest in.
"The price of not having another DAO hack is eternal vigilance.”
Vitalik Buterin
Two (as it would turn out, very ineffective) preventative measures were written into The DAO (I don't know why I'm using italics anymore.) smart contract. The first was to stop a 51% hack, the second allowed you to remove your Ethereum from The DAO if you didn’t agree with the projects put forward for investment. This worked by creating a copy of The DAO – a child DAO – to which you could remove your ETH, burn your tokens to The DAO, and have ownership of your ETH in the new DAO.
Clear as mud? Great.
Let's go on.
Here's the fun part. Once investors had moved funds out of The DAO into the child DAO, a time mechanism was used to stop the funds being moved on again. Gavin Wood told Dutch media the time lock was 39 days, most sources say 28 days. Who knows? Details...details. Vitalik?
The DAO was launched on 30th April 2016. It quickly became the largest crowd funding project in history.
2016!
Remember that next time someone says “We’re early.”
HOW MUCH MONEY WAS INVESTED IN THE DAO?
$152 million was invested in The DAO, or 14% of the Ethereum in circulation at the time. Gulp.
WHAT WAS THE PROBLEM WITH THE ETHEREUM DAO SMART CONTRACT?
There were issues.
Which is not what you want to hear when 14% of the total supply of anything is locked up in a place where code is the king and the wills of the people mean nothing.
Oh God... Was it... a bug?
Yes.
Crap.
In The dao? Shit. What was the bug called?
The recursive call bug.
Catchy.
Yes.
And people knew about it?
It was flagged by the Ethereum community, yes. But Stock.it, the creators of The DAO said there was nothing to worry about.
Yeah, well, they would.
WHAT WAS THE DAO HACK BUG?
Firstly it’s important to remember it wasn’t a problem with Ethereum. The problem lay with the smart contract code. The DAO hack bug exploited a weakness in the smart contract which allowed investors to remove their ETH.
To be in The DAO investors had to buy a token that gave ‘entry’. Once part of The DAO, if anyone wanted to remove their investment, this token would be burned AFTER the ETH had been removed. And there lay the point of failure, the three of clubs in the house of cards.
Knowing this, a programmer could interrupt the sequence, confuse the fuck out of the smart contract, tell it to give the ETH back and then, just before it burnt the token (but after it had moved the ETH), tell it to remove the ETH again.
It would go like this:
“Hey smart contract, move my money.”
“Hello hacker, smart contract here, let me check the balance. All present and correct. I see your token is still here too, I’ll move your ETH to the child DAO right away. Then I’ll burn your token.”
Smart contract has a cigarette break before burning token.
“Hey smart contract, move my money.”
“Hello hacker, smart contract here, let me check the balance. All present and correct. I see your token is still here too, I’ll move your ETH to the child DAO right away. Then I’ll burn your token.”
Or, in smart code language…
for(uint32 i=0; i < 1000000; i++) {
sha3('some data'); // costly computation
}
DarkDAO.splitDAO(...); // render the transaction invalid"
The hacker then repeated the process until the cows came home, or $150 million had been drained away.
Whichever came first.
Gavin Wood makes it sound like a Monty Python sketch.
HOW MUCH WAS STOLEN IN THE ETHEREUM DAO HACK?
On the 17th June a hacker exploited the bug and started draining funds from the smart contract.
Merde alors.
Once they realised what the hell was happening, all Sockit could do was watch from the side-lines as the hacker stole 3.6 million ETH, worth about $50 million at the time.
Ethereum was trading at around 20 dollars back then. Today it’s nearer $3000
You could buy France.
Don’t piss off a smart contract.
HOW DID ETHEREUM STOP THE DAO HACK?
When I said all they could do was watch from the side-lines, that’s not completely true. In order to slow transactions, Slockit asked the Ethereum community to spam the network in a 2016 version of a Yuga Labs gas war. It stemmed the flow, and was perhaps partly why the hacker stopped draining funds.
Of course the hacker may have just got bored, or intimidated by the vast sums of money they were now stealing. Either way, there was still $100 million left and an advertised blueprint on how to steal it.
Like a bad movie, two days later more bad actors started using the same hack to drain the rest.
The Ethereum community was now very upset. A group of white hat hackers improved the hack (I don’t know how) and drained the $100 million themselves into another, second child DAO.
So now you had The DAO, a child DAO with $50 million sitting in it, and a second child DAO with $100 million furnishing its coffers.
And if you remember, a time lock.
Aha!
Blockchain is fun, isn’t it?
27 days ladies and gentlemen. The clock was ticking.
The community came together in search of a solution. Three options were proposed:
Let the hacker get away with it.
Soft-fork Ethereum and freeze 14% of the total supply indefinitely.
Hard-fork the motherfucker. Force the smart contract to release the ETH, returning the original investment back to the investors and create a new Ethereum.
The decision was put to a vote. Exchanges ceased trading as Vitalik and the Ethereum community wrestled with inner torment and decentralization and the technicalities of how exploiting a loop hole for millions of dollars is actually in-keeping with the philosophy of the blockchain.
And the world of smart contract programming held its collective breath.
When the results were in, it was a landslide victory. 88% in favour.
On July 20th 2016, during mining for 1920000th block, Ethereum hard-forked.
Three days after the hard-fork, the alternative chain, which was really the original chain, was listed on one of the world’s biggest exchanges.
It was called Ethereum Classic.
Meanwhile, the new and improved Ethereum continued on its new, merry way.
The day The DAO died.