Lightning never strikes in the same place twice? No way! After a Bug in the multisig contract of Parity caused Ethereum users to lose around $30 million in July, history repeats itself; another bug freezes ether with a value of $150-300 million on November 7.
As often with Ethereum, it is not so easy to understand what just happened. Parity announced on its blog that they discovered a critical bug. They found a vulnerability in the “Parity Wallet library contract of the standard multi-sig contract.” All users, which used this contract to store digital assets since July 20, are profoundly affected.
If we dig deeper into the story, it gets adventurous. There has been a library contract, which could be transformed into a standard multisig wallet and get possessed by any user. One person did this, by accident, and activated the “suicide” function of the contract. The mishap wiped out the whole code of the library, which turned every single multisig contract which used the library unusable.
In other words, every single digital asset, be it ether, be it some token, can’t be moved. How much value is affected, cannot be said for certain. A list estimates around 500,000 ether, some social media chatter mentions one million ether. According to Parity, the circulating numbers can’t be confirmed. But it’s not the worst bet to say that at least $100 million and at worst more than $300 million are destroyed. A significant part of it is the Polkadot funds, which have been collected by Parity itself.
What exactly happened? And how, and why? The precise explanation is bold. Christoph Jentzsch of Slock.it helped via Twitter to understand what happened on November 7 with Parity.
Kannst du erklären, wie das passiert ist, Christoph? War die Library als Contract auf der Blockchain?
— Christoph Bergmann (@BTC_de_Blog) November 7, 2017
With the programming language Solidity, you can write smart contracts for Ethereum. One of these contracts is the multisig contract, which allows for defining the rule that funds on the contract can only be transferred if a given number of parties signs a transaction. Thanks to the flexibility of Ethereum’s smart contract system, you can customize these contracts way more freely than with Bitcoin. For example, the standard multisig contract of the main client Geth allows you to define a threshold of an amount, which can be transferred daily, and only when it is exceeded, a second party is needed to co-sign.
So far, so good. However, the Parity wallet created a library contract for the multisig contract. Like other libraries you know from other software, this helps to reduce complexity in the application by referring to a shared library of code. In itself, it is not a bad idea. But Parity made this library itself a contract on the Ethereum blockchain. And like every contract, it has a state, which can only be altered under given rules.
The problem was that these rules had a bug. The bug allowed any user to deploy a certain function which made him the possessor of the contract. As such, he was able to change the state. So did the user devops199, according to himself, by accident. This was the first part of the disaster.
The second part begins with that Ethereum contracts can have a “suicide” function. This enables them to kill itself, which has its merits, for example, when the contract is broken or just no longer needed, and you want to purge it from the blockchain. However, it can also have devastating consequences. Devops199 activated the suicide function on the Parity multisig library contract. As he says, just for fun, and without the intention of destroying anything. So the suicide function wiped the whole code inside the library contract.
The users needed some time to realize what had happened. The state of the multisig contracts, with which Parity users stored assets, is unaffected. It still contains the whole fund. However, when you try to change the state of these contracts, they refer to the library contracts to execute a function, like a transfer. And since the library contract has no longer any content, the multisig contracts are unable to execute any function. Every single asset, which has been stored with the Parity multisig contract, is frozen.
The only option to recover the funds would be a hard fork which changes the state of the library contract; if this is possible without creating another Ethereum Classic or doing severe harm to Ethereum’s reputation, is doubtful. Hence, some in the community are for such a hard fork; some are against. Maybe Ethereum has to bite the bullet, this time, and perhaps this is part of a blockchain’s coming of age.