The DAO

Decentralized Autonomous Organization

Bitcoin implements decentralized currency, and Ethereum implements decentralized contracts. Some people think that since decentralization is so good, why not change everything to decentralization? Someone put forward the slogan: let's decentralize everything.

DAO ( Decentralized Autonomous Organization ) was born under this background. In traditional societies, organizations are established on the basis of certain legal documents. For example, there may be a charter to regulate the behavior of the organization, and sometimes it may be registered with the government. Then DAO is to write the rules and regulations of the organization in the code, and maintain the normal execution of the rules and regulations through the consensus agreement of the blockchain.

In May 2016, a DAO dedicated to crowdfunding investments appeared , and its name was The DAO . DAO is a general concept. Any decentralized autonomous organization can be called DAO. The DAO refers to the specific DAO. Its working principle is a bit like a crowdfunding investment fund. It is essentially a fund running on Ethereum. smart contract. If you want to participate in The DAO, you can send Ether to this smart contract, and then you can exchange it for The DAO tokens. When it is necessary to decide which project to invest in, it is decided by everyone's vote. The more tokens in hand, the greater the weight of the vote, and finally the income is distributed according to the rules and regulations formulated in the smart contract.

The working principle is a bit like DAC (Decentralized Autonomous Corporation) decentralized autonomous company. Generally speaking, DAC is for profit purposes, while DAO can be for non-profit purposes, such as some kind of public welfare. Although DAC has the word company, in the real world, it does not have the legal person status that a company should have, and generally speaking, it does not have such positions as chairman and CEO.

When The DAO started crowdfunding in May 2016, it received a lot of attention at the time, because there had never been such a democratic investment fund before, and it raised $150 million worth of Ethereum in one month. At that time, the media were predicting how great the influence of The DAO would be in the next few years. Some people even said that the influence of The DAO would even surpass that of Ethereum itself in 3 to 5 years. Unfortunately, The DAO only survived for a total of 3 months.

THE DAO'S PROBLEM

If you are an investor in The DAO, how do you get back your income? For example, if you participate in The DAO, you invest a sum of ETH and exchange it for some The DAO tokens. What should I do if the previously invested Ethereum is exchanged?

This is achieved through splitting in The DAO's fund, called: split DAO. The method of splitting is not only to get back your own income, but also a way to establish sub-funds. After the split, you will get a child DAO.

The design concept is this. The DAO investment project relies on the tokens in everyone's hands to vote. What if a small number of people have different investment ideas from others. This small group of people can separate from The DAO by splitting it up and set up their own sub-fund called child DAO. During the split, the tokens in their hands will be withdrawn, exchanged for the corresponding amount of Ether, and the corresponding Ether will be transferred to the sub-fund, and then they can invest in the projects they want to invest in. An extreme example of splitting is when a single investor sets up a sub-fund, and then in the sub-fund, he can invest all the money in himself. This is the only way for investors to get back their investment and income. Before the split, there was a 7-day debate period. After the split, there was a 28-day lock-up period. This 28-day lock-up period gave time for remediation in subsequent accidents.

There is nothing wrong with the concept of splitting, and it is a further manifestation of the democratic system. The democratic system does not mean that the absolute minority must obey the majority, but that it also respects the right of the minority to choose. There is nothing wrong with the idea of ​​​​splitting, so what is the problem?

The problem lies in the implementation of split DAO

The picture above is the code of split DAO. Starting from the withdrawRewardFor statement, first return the money to the person who called this function, then reduce the total amount in The DAO by the corresponding amount, and then clear the caller's account to 0. As mentioned in the previous section, the correct operation is to clear the account to 0 first, and then transfer. The hacker used this vulnerability to carry out a re-entry attack, and transferred away 50 million US dollars of Ethereum, almost one-third of the Ethereum.

This incident caused a lot of panic in the Ethereum community and caused a big plunge in the currency price. The Ethereum community has had a heated discussion about this, what to do?

Community opinion is split into two factions:

One faction believes that in order to roll back the transaction, the established sub-fund has a 28-day lock-up period, so the hacker has no way to take away the ether for the time being, and there is still time to take remedial measures

The other school believes that there is no need to take any remedial measures, because the hacker's behavior is not illegal, and code is law. In the open letter of the suspected hacker, the hacker claimed that he did nothing wrong, but only used the feature in the code. Since the code can allow me to withdraw money repeatedly, I have not violated any laws. This party believes that the transaction should not be rolled back. The most important feature of the blockchain is that it cannot be tampered with. If something goes wrong, it will be rolled back. How can it be called tamper-proof? And the problem this time is only an application on Ethereum. There is no problem with the code of Ethereum itself. If every smart contract has a problem and rolls back, it will be messed up!

The development team of Ethereum supports remedial measures, mainly because the impact of this matter is too great. The number of Ethereum raised by The DAO has accounted for more than ten percent of the total circulation of Ethereum at that time. too big to fail, too big to fail. So how to remedy it now?

(1) For example, start a fork from the block before the block where the hacker stole the Ethereum, and make the fork chain longer. Is this okay?

If this is the case, not only the hacker’s transaction is rolled back, but all transactions on the block are rolled back. There are many legitimate transactions here that will affect a large number of people who trade normally, so this is not acceptable.

(2) The Ethereum team has formulated a two-step plan. The first step is to lock the account of the hacker. The second step is to try to return the stolen Ethereum and return the money on The DAO Fund.

The first step is how to lock these accounts. The Ethereum team released a software upgrade, which added a rule that no transactions can be made with accounts related to The DAO fund. Many miners have upgraded their software. This is a soft fork. The software upgrade adds a judgment rule. The blocks dug out by the new miners are recognized by the old miners. The old miners can continue to dig in this block later. The blocks dug out by the old miners, The new miner may not approve it. If the block contains the transaction of The DAO account, the new account will not approve it, which will only cause a temporary fork to the system.

Unfortunately, there is a problem with the upgraded software, which is to determine whether the transaction related to The DAO should not charge gas fees. If not, there may be malicious attackers who continue to issue illegal transactions and refuse service (deny of service), wasting resources of miners, anyway, the cost is very low for attackers. This upgrade of Ethereum does not charge gas fees, and the miners can't stand it after being denied of service, and they reuse the software before the upgrade. So the soft fork plan failed.

At this time, the situation is severe. After the establishment of the sub-fund, there is a 28-day lock-up period, and then hackers can withdraw the money. The soft fork plan failed, and there is not much time left. Since the Ethereum team wanted to be soft, since it couldn’t work, it came to a hard fork, and designed a hard fork plan. Through software upgrades, all funds in The DAO account were forcibly transferred to another new smart contract. The new smart contract has only one function, which is to refund the money . The DAO tokens were bought with Ethereum, and now the tokens can be returned to Ethereum.

Why is this a hard fork? The essence of this approach is to use the method of software upgrade to forcibly re-book the account. The original transfer must have a legal signature. For example, if I want to transfer the money in your account, I need your signature. There is no legal signature for the transfer. All the funds on The DAO must be forcibly transferred to the new smart contract regardless of whether the person agrees or not. When the 1.92 millionth block is dug, the transaction will be automatically executed. The blocks dug out by new miners are not recognized by old miners, so it is a hard fork

As a result, the community was completely divided into two factions. The Ethereum team also wrote a smart contract to vote, using the ether in their hands to vote. The results showed that most people supported the hard fork, so the vast majority of miners upgraded the software. In the end, the hard fork was successful without any accidents. Hackers are still not profitable in stealing ether.

ETH and ETC 

But the story is not over. Opponents believe that not many people participated in the voting. Besides, is the result of the voting necessarily correct? For example, there are many poor people in China who can’t afford medical care, and there are also many super rich people. If a vote is launched to decide whether to distribute the money of the rich to those who are in urgent need of life-saving money, is it feasible?

The old chain has not died, and miners continue to dig on it, and the computing power has dropped significantly, less than one-tenth of the original, and the difficulty of mining has been greatly reduced. The coin mined on the old chain is called ETC ( Ethereum Classic, Classic Ethereum) , and it has been listed and traded on the exchange. Some people dig because of speculation, and some people dig out of belief. They insist on this pure and pure concept of decentralization, thinking that the old chain is the authentic Ethereum, and those who engage in hard forks They are engaging in revisionism.

At the beginning of the hard fork, some problems were brought about, such as replay attacks. It is also legal to put legal transactions on the new chain on the old chain. Conversely, legal transactions on the old chain can also be placed on the new chain. implemented. Later, chainID was added to the two chains to solve it.

Why are all accounts in The DAO targeted, not just the account corresponding to the hacker?

If only the hacker's account is frozen, since the bug in the contract cannot be fixed, everyone can become a hacker and continue to steal, so all accounts related to The DAO must be frozen.

References

Teacher Xiao Zhen from Peking University "Blockchain Technology and Application" open class

Guess you like

Origin blog.csdn.net/LDDlove_java/article/details/127480573