A simple explanation of how mt.gox lost everyone’s coins

or how you shouldn’t trust things that aren’t canonical

Nic M
2 min readFeb 27, 2014

There’s been a lot of talk over the last few days about mt.gox and how things got fucked. Accompanied by confusion and misinformation (blaming the Bitcoin protocol) so I’d like to explain my understanding of how things went down.

A quick primer on transaction mutability

When you create a Bitcoin transaction it is given a hash, we’ll use ‘XXXXX’ for simplicity. The hash lets you look up the transaction and get details about it such as: “has transaction XXXXX been confirmed?”

Now, after a transaction has been broadcast but before it’s confirmed into the blockchain you’re allowed to modify some meta info about it without effecting the important stuff like it’s value, but when you do this the hash changes! So “has transaction XXXXX been confirmed?” becomes the wrong question to ask. The transaction’s hash is NOT canonical.

The heist

Someone very smart or very lucky or some glorious combination spotted that mt.gox WERE using the transaction hash to lookup and confirm the status. Consider the following flow:

  • User requests Bitcoin withdraw and transaction XXXXX is created.
  • User modifies a small detail on the transaction, so the hash changes but the transaction is still successful.
  • User submits a claim to mt.gox, saying that transaction XXXXX failed.
  • Mt.gox (with no human intervention) detects that XXXXX does not exist as a successful transaction so funds are re-sent.
  • Profit.

Update: mt.gox just filed for bankruptcy protection.

--

--

Nic M

Make it work. Make it work every time. Make it work every time fast.