6 ms·
Simple Contracts are Better Contracts: the Meltdown of the DAO
- sandworm101 10y agoHow many of the TheDAO Curator members are lawyers? Contracts are agreements that are meant to be legally enforceable. The enforcer has always been the King, a local governmental authority and a third party. The very concept of a contract assumes the neutral third party. That third party is to interpret the contract, identify potential scoundrels, nullify illegal contracts and generally make sure everyone isn't playing games. Smart contracts seek to sidestep that ancient structure by replacing the neutral third party with an inflexible machine. Good luck with that. Contract language is also meant as a manifestation of intent. Smart contracts seek a perfect manifestation, dismissing all notions of imperfect knowledge or misunderstanding. Typos rarely matter in real contracts. Intent can trump language where appropriate. But in smart contracts typos are everything. Good luck with that too.
- wolfgke 10y ago> Contract language is also meant as a manifestation of intent. I challenge you to create a formalization of the intent and create a better programming language for smart contracts that includes intent. I could imagine quite well that intent could be formalized to some kind of "firewall" or "sandbox" rules for the smart contract, i.e. that if the execution of the smart contract violates these rules, it will, for example, be canceled by the system.
- sandworm101 10y agoI would counter with the concept that any valid interpretation of intent must come from one with cultural understanding. Machines do not have cultural understanding. They cannot identify language/intent clearly in violation of cultural norms. Before attempting the intent code, I'd first need to see a machine capable of understanding why Shylock's pound of flesh was an illegal contract.
- jsprogrammer 10y agoMachines don't understand. They simply compute. It is up to the programmer to have them perform the appropriate computations.
- naasking 10y agoThe fact that machines don't understand doesn't entail they can't understand given a suitable model for what constitutes "understanding". We simply lack such a model.
- jsprogrammer 10y agoWe can define words to mean whatever we want. The machines under consideration are algorithmic, defined by simple logical rules that allow the next state to be derived from the previous. Any understanding within a model comes from the algorithm, not the machine.
- jcoffland 10y agoIf the machine knows Asimov's three laws of robotics then it will know that Shylock's pound of flesh cannot be had.
- mrob 10y agoAsimov's Three Laws aren't a replacement for the whole system of human values. His robot stories are full of robots doing strange things that conflict with human intuition but are aligned with the Three Laws. Asimov himself recognized that the laws were not sufficient, and added the Zeroth Law as a workaround: "A robot may not harm humanity, or, by inaction, allow humanity to come to harm." But this law is vague and difficult to interpret. The Laws of Robotics are not a formal specification of ethical behavior. From the point of view of a fiction author this is no problem. The ambiguities allow for more exciting stories. But when real human lives are at stake, it's a serious problem. "Friendly AI" is a non-starter if we can't even define what "friendly" means.
- dclowd9901 10y agoIntent is simply the will of the party manifest. If each party presents their will, there is no misunderstanding. Conflicts of will can be treated like merge conflicts and resolved in the meat space.
- tdaltonc 10y agoI'll make a prediction about where this is going longterm. Smart contracts will take off despite their rigidity but we will start writing them to include common law arbitration protocols. The arbiters will initially be 1 or more human but as the block chain begins to evolve it's own common law(s), fuzzy machine arbiters will emerge to fill the "incompleteness".
- sandworm101 10y ago>>... to include common law arbitration protocols. That's a great example of the sort of ambiguity that an arbitrator must deal with. Do you mean to refer to "the common law" as in the body of law descending from the brits, or do you mean the common law principals of precedent and authority? Or do you mean only the concept of precedent by which past decisions under similar fact patterns are used to inform decisions regarding new fact patterns. I have some assumptions based on your choice of language and my best guesses as to your cultural background, but good luck finding a machine capable of such understanding. If we crack that, then much of our culture is moot and the robots can be left to run things.
- jrpt 10y agoYou're being pedantic. Contracts explicitly specify the arbitrator, such as AAA or JAMS. More info at http://arbitrationnation.com/arbitrationnation-roadmap-when-should-you-choose-jams-aaa-or-cpr-rules/ http://arbitrationnation.com/arbitrationnation-roadmap-when-...
- sandworm101 10y agoYes but that is a flesh-and-blood arbitrator. We are talking about coding the arbitration process into a machine. Being pedantic is exactly what happens when one tries to express cultural norms in the exact terms used by mechanisms.
- jrpt 10y agoIf you could capture the entire logic in code, it wouldn't be arbitration, it'd just be a feature of the smart contract. The way you'd encode an arbitration clause into a smart contract is making the arbitrator an oracle. That makes it a part of the smart contract, but it's still resolved by an external arbitrator.
- arcticfox 10y agoIt seems simple enough to include a fallback mechanism to human judgment in times of extreme error. Maybe requiring 90+% consensus from members, or something like that. Obviously, TheDAO didn't have that, and explicitly precludes any fallback to traditional systems in its documentation.
- TheSpiceIsLife 10y agoand explicitly precludes any fallback to traditional systems in its documentation. Which is, of course, nonsense. You can't document your way outside the law. Not in any country I'd want to live or conduct business in anyway. If enough of any one persons money is involved you can bet there are lawyers right now trying to working out who to sue.
- wyager 10y agoNothing wrong in principle with having a mechanical third party. You just have to actually write your contracts correctly.
- gamblor956 10y agoTypos rarely matter in real contracts. Intent can trump language where appropriate. But in smart contracts typos are everything. Good luck with that too. The City of Cleveland and Frank McCourt would like to have a word with you about your novel theory. In real contracts, typos--like an errant comma--can be significant and completely change the meaning of the language. Cleveland lost the original Browns because of a typo; McCourt lost the Dodgers in part because of a typo.
- sandworm101 10y agoIn those cases the court found the intent manifest in the language. These were sophisticated parties with legal advice. Even if they court didn't see intent, it is within the courts' power to force such persons to follow the language if for nothing else than to serve as example to other negligent contract drafters. A court will only grant that which is asked for. So for a typo to matter, one of the two parties before the court must be claiming that is isn't a typo.
- kolinko 10y agoThere are also cases of people selling cars (and other stuff) ultra cheap on ebay, because they misplaced a comma when specifying a price. It was obvious that the price was supposed to be $20k, not $20.000, and yet the seller lost.
- sandworm101 10y agoPrices for the sale of consumer goods are subject to some special rules, mostly to prevent bait-and-switch advertising. But actual typos happen all the time and are corrected. There are a great many instances of airline websites getting prices horribly wrong. These contracts are not normally honoured and wouldn't be enforced by a court (40,000$ tickets for 50$ sort of things). Much depends on the specific facts and whether the price is obviously a mistake.
- Mikhail_Edoshin 10y agoI once read a story told by a young U.S. lawyer who happened to come from one of West European countries and thus had a specific cultural background. They were in the middle of finishing a deal and when he was re-reading the contract, he noticed that he made a typo and turned $1.5M they were to pay at some stage into $15M. And the contract was already signed! In horror he went to the business owner and confessed. It was a revelation to him when the owner took it very lightly and told him something like: "It's OK, I'll just phone them and we'll have this fixed." (And it wouldn't stand a chance in court either, because a simple calculation would show this couldn't possibly be a right sum for a sane person to pay for whatever the contract was about.)
- alkimie2 10y ago(I'm not a member of The Dao, although I do have some Ether. I switched from engineering to law in the early 90's.) I'm sure there are some lawyers who got involved--I was tempted to get some experience with the concept early on. I decided not to primarily because the basic concept of crowdsourcing decisions where the ownership interest determines who has most of the voting power and the major holders are likely to be new at it strikes me as, frankly, a silly idea. But even if all the participants were lawyers or represented by lawyers there are still going to be bugs. Pick up any set of service terms for just about anything and there will be logical flaws. It's just human nature. There is no such thing as a perfect contract. To me the most interesting thing about this episode is that The Dao included limitations imposing an time lock on withdrawal that gave the community some time to consider what to do and the pros and cons re the whales in the Ethereum community doing a hard fork in the name of justice.
- sandworm101 10y agoI don;t think lawyers could help with bugs, but their absence could be telling. Most of the lawyers I know wouldn't go anywhere near this sort of thing. A board of directors, or any other governing body, without any lawyers makes me suspect those that were asked fled the project. Or that the organizers deliberately didn't approach any lawyers because they knew what they would say. Anyone with a background in contracts, specifically dealing with contracts gone sour, would see red flags all over this concept.
- pash 10y ago> Contracts are agreements that are meant to be legally enforceable. You have hit on an important point, but like most commentators here and elsewhere, you seem entirely to have failed to recognize its significance. In the American and English tradition of common law, a contract is an agreement made with the intention that it be subject to legal enforcement [0]. Not every agreement is meant to give its parties recourse to legal remedy, and hence not every agreement is a contract. That is, not every agreement is subject to contract law [1]. It is of little significance that people in the Ethereum community (or in the broader crypto-asset community) have taken to calling their programs "smart contracts"; the name signifies nothing. In the main, and particularly in the case of the DAO, it has been made clear, ad nauseum, that these programmatic agreements are not meant to be subject to legal enforcement; in short, it has been emphasized from the start, and at every intermediate step, that smart contracts are not contracts in the legal sense. Indeed, the major motivation for the development of programmatic agreements (i.e., "smart contracts"), has been to supplant enforcement de jure by enforcement de machina. The law allows for agreements that do not have the force of law behind them, and naturally the law says little about such agreements. For this reason alone, absent separate provisions which purport to invoke legal enforcement of the intent behind the code that implements a smart contract, it is perfectly reasonable, legally speaking, to argue that prima facie these agreements are not subject to contract law. Thus the independence of programmatic agreements from legal constraints is legally plausible; this is a very different situation from the legally absurd arguments put forth by some crypto-zealots that, for example, transfers of cryptocurrencies are not subject to laws restricting money transmission. Now, might a judge decide that any particular programmatic agreement—or "smart contract"—is in fact a legal contract? And that therefore the judge, not the code, ultimately determines who gets what? Sure. Judges tend to decide that they get to decide, when there's any question about it. But it's not unreasonable to imagine that a judge might really say, "No, this is not a legally enforceable contract. It says so right on the box." And if that happens, then what the code says goes. 0. https://en.m.wikipedia.org/wiki/Intention_to_be_legally_bound https://en.m.wikipedia.org/wiki/Intention_to_be_legally_boun... 1. Beyond the determination of whether the agreement is legally a contract, I mean. In particular, I mean to point out that a so-called "smart contract" might well be legally deemed not to be a contract at all, and therefore not subject to the provisions of contract law that give precedence to the parties' intent in the agreement over its literal interpretation. In other words, if a programmatic "smart contract" is not legally a contract, there is no legal reason that the law should favor any outcome other that what the code's execution ordains, or that the law should say anything on the subject at all.
- kolinko 10y agoThat's why smart contracts will be really lousy for things that traditional contracts are used for. But on the other hand, there are some simple - yet important - things that can be implemented in smart contracts pretty easily. Say, futures, or stock options, or certain kinds of insurance. For these things smart contracts are great because they offer extremely cheap enforceability and speed. This is a textbook blue ocean, or innovator's dilemma. The new tech is much worse than the old one in some cases (enforcing intent), but far better in some other ones (speed, enforceability, global access)
- nzoschke 10y agoAs a software engineer everything here rings true to me. Use as simple of tools as possible when programming and offer many ways for mere humans to change code and review correctness and review, approve and roll back critical transactions. But this sounds effectively like the status quo with credit cards and Kickstarter. So I'm not sure what a blockchain adds other than a different platform and maintainers than the existing financial and group purchasing corporations.
- alttab 10y agoSimple contracts then are only as scalable, reliable, and secure as the code that runs off the blockchain. Arguably, that defeats the whole purpose because it is then who controls the code (since it is no longer decentralized), controls the contract. If I'm reading this right (I'm not 100% sure of that), this is the equivalent almost of not running a blockchain at all (if the idea is taken to its finality). Storing the who and the what of contracts has never really been the issue, its been the execution and the honoring of the contract that man has not yet solved. But centralizing the code that runs the contracts, and taking it off the blockchain doesn't sound like the way to do it.
- nzoschke 10y agoIt's not like honoring contracts is unsolved. Bookies have been doing it forever with questionable effectiveness. PayPal offers arbitration on stranger to stranger sales. Again with questionable fairness in tough cases. Kickstarter et al are doing a pretty good job as arbitrators and collecting money and issuing refunds more or less fairly.
- nzoschke 10y agoI do see room for improvement in efficiency. Kickstarter and PayPal surely have large teams working on arbitration, review and fraud that could be delegated back to the involved parties vote with some rules. And law suits can be very inefficient. This absolutely could be solved without a block chain.
- TheSpiceIsLife 10y agoThis absolutely could be solved without a block chain. I fail to see how, because a blockchain is just a continuously-growing list of data records hardened against tampering and revision[1]. A blockchain can't compel nor force me to action or inaction, nor enforce any legal penalty for inappropriate action or inaction. The courts exist as an attempt to resolve differences between peoples interpretation of right and wrong, "slap a blockchain on it" won't change that. 1. https://en.wikipedia.org/wiki/Block_chain_(database) https://en.wikipedia.org/wiki/Block_chain_(database)
- Aelinsaar 10y agoJust from reading commentators here at HN, it doesn't seem like these issues were unforeseen. Rather, it seemed that whatever intense optimism exists around cryptocurrencies is capable of overwhelming investor sense in return for the promise of some ideological "win".
- alistproducer2 10y agoI used to run an Ethereum meetup and I was pretty much the only skeptic in the whole group. Everyone I encountered were "true believers."
- skylan_q 10y agoThis is what it looks like to me. They couldn't see the problem happening because culture blinded them from thinking of things in such a way that would allow them to see this coming.
- draw_down 10y agoYes, I agree with that. This was pretty clearly a bad idea from the start. But, to say so was being a "hater" and so forth.
- notahacker 10y agoYup. To be honest, the bug with the implementation of the DAO that allowed someone to appropriate most of its assets is the least of the flaws behind the concept, which was fundamentally "let's put our money in a pool and let the anonymous votes of pool members decide what to do with it", complete with a big disincentive to opposing to stupid or malicious proposals since refraining from voting was the only way to ensure your funds weren't committed to a "contract", and absence of anyone, anywhere being accountable for anything as it's chief/only selling point. Since when was that a $150m opportunity?
- plttn 10y agoI feel like this might be a semi-unpopular opinion, but frankly I'm getting tired of the idea that a blockchain is the solution to every single problem the human race faces. There's this almost religious level of looking the other way whenever there's some sort of failure in a blockchain system, and they always say "that was a one-off situation"
- cyrillic 10y agoIf the contract code can be upgraded by the majority of involved parties, it would be simple to buy 51% of the voting power and change the code to pay out everything else. Each takeover would double your wallet. Am I missing something here?
- brbsix 10y ago51% attacks are a known issue. A sustained 51% attack is pretty much an existential threat to any blockchain. So I doubt the issue gets any better when dealing with individual contracts. https://blog.ethereum.org/2014/05/15/long-range-attacks-the-serious-problem-with-adaptive-proof-of-work/ https://blog.ethereum.org/2014/05/15/long-range-attacks-the-... http://ethereum.stackexchange.com/a/544 http://ethereum.stackexchange.com/a/544
- cyrillic 10y agoThank you for your valuable input. The problem I see is not in having 51% of the whole capacity of the blockchain, but of the smaller entities/organizations/contract codes. With the proposed simple contracts, the little 'start-up' contract codes with little voting power will easily get acquired by bigger ones, which then vote for a code change to pay out the remaining shares. This is much more realistic that the traditional 51% attacks. Letting the majority of a small DAO-like organization vote for code change (which translates to law-change) will not only be used to fix bugs, but to change the contract to the majorities advantage. This may eventually result in one single big contract code that incorporates every new organization on the horizon.
- nawitus 10y agoIt should be possible to define that you need e.g. 90% of the shareholders to approve a change to the contract. The 90% could still steal money from the 10%.
- brbsix 10y agoIt is. The example code for a DAO [0] illustrates how everything from minimum quorum for proposals to margin of votes for a majority is configurable. However like you said, so long as the contract is mutable, it's possible for a majority to subvert it. [0]: https://www.ethereum.org/dao https://www.ethereum.org/dao
- louprado 10y ago"Simple Contracts are Better Contracts" has always been the mantra of the Ethereum and DAO team. Most times when a security question was raised, "simple contracts" was their defacto answer [1]. This exploit suggests that the most competent developers in this space, who always preached simple contracts, are not yet able to consistently write secure contracts. Also, the OP states the importance of being able to update a contract. As of last year that meant the original contract MUST include a self-modifying code provision. Self-modifying code doesn't align well with keeping your code simple. As an aside, "contracts" are Ethereum's raison d'être and the Ether currency value is largely based on adoption. Even though this exploit did not expose a flaw in the Ethereum block chain, the Ether sell-off is an expected consequence. Lastly does anyone have a link to the original contract code and how it could be rewritten so that it isn't vulnerable to this exploit ? [1] https://www.youtube.com/watch?v=cahj4WJtp20 https://www.youtube.com/watch?v=cahj4WJtp20 Q&A at 42m44s is relevant. Edit: corrected time stamp for above video
- 109129831023 10y ago"Most competent developers"? There are probably thousands of better informed developers/researchers who would not attempt to set up such a company before they have stronger formal guarantees. Of course, if you want to be first-to-market, none of that seems to matter.
- jabgrabdthrow 10y agoMost Competent Marketers
- Avshalom 10y agoStrong formal guarantees are complicated see? and we run around telling ourselves that simple is better, so we keep writing shit code.
- alistproducer2 10y agoBailing out the DAO undermines the core value propositions of Ethereum - contract immutability (stability) and decentralization. I understand that the argument is "this is a special (ie, too big to fail) case; however, who can be sure? IMO the better way to handle this is to acknowledge the mistake and let it fail. It's embarrassing I get it. Honestly, the big bank types who threw millions at this tech without doing due diligence deserve to lose their shirt. It's called speculation for a reason. If the core team cares about the long term credibility of the project with the people who real matter - the tech community - they will not bail it out. Edit: For anyone interested, there's a really great discussion on this subject at the Ethereum reddit https://www.reddit.com/r/ethereum/comments/4oiqj7/critical_update_re_dao_vulnerability/ https://www.reddit.com/r/ethereum/comments/4oiqj7/critical_u...
- jcoffland 10y agoIf simple contracts, where much of the code is off chain, are to be the way of things it begs the question, why do we even need Turing complete contacts in the first place. A blockchain could be created which has a few fixed rules which enable the basics of a DAO with much lower risk.
- brbsix 10y agoThe AI equivalent to a recursive call bug are self-replicating Von Neumann probe paperclip maximixers that consume the entire universe. We're going to be in a world of hurt if we aren't able to sort this out. It's pretty essential that machines are able to discern our intent or the spirit of our contracts one way or another.
- leetbulb 10y agoEasy solution: just hide all of the paper in some other universe :) On a serious note, well said.
- draw_down 10y agoCode is law! Ohh, ummm, err, uhhh, except when we say it's not.
- grellas 10y agoCan code both embody and replace law for the exact function for which it is set up? DAO strives to execute through code an idealized pooled investment system by which contract issues are resolved entirely by code and wholly apart from any external societal legal or enforcement mechanisms. All well and good but, where people are involved, code simply cannot define all the relations needed to capture what the law does (and, indeed, and in spite of its flaws, does very well indeed). Consider the argument that the exploit here is not a flaw at all but just another variation on what the code does, with the result that investors who suddenly are $50M lighter in their wallets have not been harmed at all and should have no recourse to any remedy to restore their funds to them. The idea here is that the code is the contract and, if that is what the code does, well, that is what you bargained for, whether this is good or bad from any particular moral perspective. Right at the entry point of the system is a prominent disclaimer that says this in exact words. So a contract is a contract. If you don't like the result, tough. The participants here are wealthy and presumably sophisticated investors. What if they aren't? What if this were marketed to a lot of gullible small investors who were induced to part with their money through various representations stating that their funds were entirely safe, subject only to normal investment risks relating to the underlying companies they funded? What does society do when people like this lose their life savings when some newly discovered "feature" of the code allows a sharpie to walk away with their funds? Are they to have no legal recourse because a "contract is a contract," especially if it embodied in code? And what happens if a system is set up and the person or persons who find the new "feature" enabling them to walk away with other people's funds are the very people who organized the fund? Does law from the broader world step in to provide a remedy to those who lost their money? Or does the "contract is a contract, especially in code" logic work to deny any remedy to the participants here as well? And, setting aside any of the more extreme examples, what if it is simply the case that those who did participate had reasonable expectations that any code that would define and limit their rights would do all that was expected in terms of defining their investments but would include safeguards that would prevent anyone from simply coming in to remove their funds altogether (dare I say "steal")? What if they were misled into having such expectations by promoters of the venture who said or implied that such safeguards existed? Is it enough to say that none of this matters because of some disclaimer buried in fine print? Is all of this simply irrelevant just because a "contract is a contract, especially in code"? Contracts are part of any system of law that includes private property, and a very important part at that. But contracts can never define the totality of the law that applies to a given situation, even if the parties swear up and down that that is their intent. That is why securities laws exist, to help investors who get swindled by sharpies with well-honed contracts. That is why the laws relating to fraud exist, to help those who are misled by others to their financial detriment. Indeed, that is why a sophisticated body of laws exists relating to contracts themselves, to cover cases where the intent of the parties is sometimes so frustrated by one thing or another as to make it inequitable to enforce a contract. Law is and always has existed in multiple layers. Legislatures pass statutes but courts exist to interpret them to cover specific cases as disputes arise. The same with administrative regulations promulgated by agencies. Even within the courts themselves, common law courts would declare legal "rules" only to have courts of equity intervene to correct things where the "rules" led to harsh or inequitable results. Basically, all of this is another way of saying that human relations are complex and any system of laws and justice needs to be able to handle such complexity if it is to be worthy of being a system of justice. Perhaps in narrow cases, things such as DAO can be set up to create a rich guy's playground of sorts in which, for the overwhelming number of cases, outside laws play no part within the self-contained system. Perhaps there is even an ideal of some type to be realized here (get rid of lawyers, etc.). But no such system can ever be utterly divorced from the rules of the broader society. Ideal or no ideal, this is just not how the law works. Apart perhaps from some survivalist society or other, people simply cannot exempt themselves from the general rules of law no matter how much they desire to do so. They can limit the application of such broader laws to a degree but, when key bounds are transgressed, the law will apply in its full force regardless of their intentions. So, I would say that the curators here probably had no choice. It was either do what they did or watch as lawsuits followed, probably in abundance. This may have violated some ideal in play here but it was a pragmatic necessity given how law in reality works (and always will work).
- Animats 10y agoThere are two fundamental problems with Etherium contracts. 1. They're executable programs. They could have been a set of declarative rules listed in priority order, but no, the designers went overboard and made them general programs with loops and recursion. There are straightforward ways to analyze sets of rules; they're usually amenable to case analysis. It's hard to analyze programs. Writing a declarative contract language is a challenge. But doing so forces the designers to think through what they want the system to be able to do, and what they don't want it to do. Doing contracts as executable programs is punting on the problem. It says "we don't know how to do this, so we'll dump the problem on the users." 2. The stack overflow problem is idiotic. The system should have been designed so that if a program aborts, anything it did is rolled back. That's the design flaw this attack exploits.
- drcode 10y agoTo be fair, ethereum has bytecode at its base- almost certainly someone will wrote a more declarative language on top of it now to help minimize the chance that unexpected calling trees can lead to unexpected behavior. Also, the existing solidity language is pretty well designed, it's just a hard problem and an even better design may be needed.
- Animats 10y agoAlmost certainly someone will wrote a more declarative language on top of it Papering over the mold seldom works. It makes things easier, not more reliable. See C++ templates.
- jawatson 10y agoI may be stepping outside of my area of expertise, but doesn't this seem like a perfect place to apply formal verification tools? As long as the contract isn't too long, it should be possible to ensure that the implementation exactly matches the specification.
- ybroze 10y agoI really wanted to know about the Data Access Object.
- modarts 10y agoThought this was a commentary on the poor API contracts exposed by data access objects
- simpleblend 10y agoI ended up writing an article explaining my position on the whole thing: https://blog.simpleblend.net/dao-attack-whos-blame/ https://blog.simpleblend.net/dao-attack-whos-blame/