16 ms·
This is what concerns me about contract programming. With human contract law, if there's a minor typo or loophole, participants can generally see the spirit an
by imglorp 10y ago
This is what concerns me about contract programming. With human contract law, if there's a minor typo or loophole, participants can generally see the spirit and intent, and at worst go to a judge who will usually enforce the intent. But with software contracts, only the characters matter and there's no intent anywhere: either you get paid or you don't.
ETH is advising, "Contract authors should ... be very careful about recursive call bugs, and listen to advice from the Ethereum contract programming community," which indicates there's some subtle behaviors to be aware of and secure contracts are apparently not easy to write.
Lest you think, "we'll just be careful, review and QA it", consider the bug[1] in the "Programming Pearls" binary search. Bentley was clearly an expert who had proven the algorithm correct and the algorithm had 20 years of careful study by thousands of professionals. Yet it had a simple overflow.
How do _you_ know your contract is secure?
1. https://research.googleblog.com/2006/06/extra-extra-read-all-about-it-nearly.html https://research.googleblog.com/2006/06/extra-extra-read-all...
- 0x006A 10y ago> How do _you_ know your contract is secure? It most likely is not, looking at the recent post on contract security, most if not all examples ever posted as best practice are flawed and can be exploited: https://blog.ethereum.org/2016/06/10/smart-contract-security/ https://blog.ethereum.org/2016/06/10/smart-contract-security... (currently down, cached version https://webcache.googleusercontent.com/search?q=cache:https://blog.ethereum.org/2016/06/10/smart-contract-security/ https://webcache.googleusercontent.com/search?q=cache:https:...)
- LoSboccacc 10y agothat's the gist of the problem Turing machine, meet halting problem.
- panic 10y agoThe halting problem is easy to solve for Ethereum programs by design. Programs are made of instructions, each instruction requires fuel to run, and fuel is limited, so every program must halt eventually.
- roywiggins 10y agoI'm not familiar with Ethereum programs, but it seems to me that it's not possible to answer the practically-identical question, "How much gas does this program need to start with to guarantee it will either get into a loop or halt of its own accord before it runs out of gas?" Or, to put it another way, it sounds like the language is Turing complete in roughly the same way C is Turing complete even though every C program ever instantiated is actually a linear bounded automaton because there's no such thing as an infinite tape. Like, I can announce that my C-like language will always halt after a trillion-trillion operations and therefore the halting problem is "solved" for it, but for all other purposes it's almost exactly as difficult to reason about as a Turing machine.
- joosters 10y agoI agree completely. 'Smart' contracts are terribly flawed in this regard. Operating outside of contract law is a weakness, not a strength. No-one can write bug-free code, so why are these people building a huge, expensive system that relies on no bugs being found?
- cmdrfred 10y agoI agree, for now. What I argue is that just like nobody can write bug free code, nobody can write bug free contracts as well. I think this might have a good use case down the road once all the bugs are worked out. That said, it's not ready for prime time yet.
- drinchev 10y agoIndeed, but you have bug-safety law around the world which incorporates something like : "If there is a typo, error, fraud, crime etc. a contract is considered invalid or the part of the contract that is flawed" With software bugs you have something similar : > NO WARRANTY. THE SOFTWARE IS PROVIDED TO YOU “AS IS” AND “WITH ALL FAULTS.”
- cmdrfred 10y agoWho decides what a typo is? "Oh, that contact for 1000 dollars is really 10 dollars because they 'missed' a decimal place. You still have to uphold your part though." Corruption of judges can be a problem in that space and that is in part what this is attempting to solve. A lofty goal, maybe even impossible, but certainly worth the time to try.
- dagw 10y agoThere are relatively few cases where $1000 and $10 are both reasonable numbers. It should be pretty obvious to both parties from context which is the 'correct' interpretation.
- 10y ago
- Chris2048 10y ago> participants can generally see the spirit and intent, and at worst go to a judge who will usually enforce the intent Stuff like patent-trolling (and patents) suggest to me the law isn't so consistently trustworthy as you suggest.
- pjc50 10y agoPatent law is not contract law.
- Chris2048 10y agoAre they not overseen by judges and lawyers also?
- Alexx 10y agoI don't think that is the same - There is no claim that rules of written law always gives the most favourable outcome. But rather that the written law (or contract, in this case) allows for the reality of human error or omission by leaving space for human interpretation, enforcing the underlying intent, rather than strictly enforcing 'bugs' in the contract. After all, there are almost always small mistakes in complex systems. The system of case law is, essentially, a structured way of turning differing interpretations into a stricter framework over time.
- Chris2048 10y agoThere are no bugs, there is just the contract, and the intent, and the difference between the two. My point is, the institution of law needs to be trusted, yet patent-trolling exists because the institution has failed to apply fair judgment and common sense such that ridiculous legal structures have prevailed.
- Alexx 10y agoA bug is the difference between the intent and the produced document.
- kauffj 10y ago100% agreed and anyone who expects these types of smart contracts to replace typical contracts is overlooking this. The real void smart contracts fill is the type of contracts that cannot be trusted to be enforced by the current court systems. For example, consider prediction markets. Just about any economist or rational person will tell you these are a huge boon to the world, but the CFTC shut down InTrade just a few years ago. It makes a lot of sense for these types of contracts to move onto ETH or similar.
- seibelj 10y agoI am fascinated with prediction markets, is there an existing place to do this now with ethereum?
- kauffj 10y agoAugur and Hivemind are the two that get talked about the most. Neither are out.
- nsajko 10y agoWhy are prediction markets a huge boon for the world? Isn't that just a fancy term for betting anyway?
- kauffj 10y agoThey provide a far more accurate insight into the likelihood of events than any other alternative. You can think of it as betting if you like, but it's betting with lots of positive externalities. Consider a business that needs to reason about the probability of a law passing, severity of global warming, or any number of other difficult to predict events. Prediction markets would provide by far the most accurate insight. It's wisdom of crowds + skin in the game.
- mootothemax 10y ago>Consider a business that needs to reason about the probability of a law passing, severity of global warming, or any number of other difficult to predict events. Prediction markets would provide by far the most accurate insight. Surely such prediction markets are a guarantee of corruption? That or I just don't understand - if a market exists that takes bets on human actions such as passing laws, how long someone will live etc, the betters will have a very active interest in doing everything they can to make a large profit, of which corruption alone is the most obvious target. I mean in a way you're right - it is wisdom of crowds, albeit crowds of people that "know" only because they're corrupted the final event.
- Joeboy 10y agoI'm mostly an ethereum skeptic, but maybe this doesn't actually indicate that all smart contracts are doomed? Maybe all it means is that bespoke ethereum contracts are risky, and people will have to use boilerplate contracts that have proven robust in the past. I sort of assumed this DAO thing was intended in this spirit, as an experimental stab on the path to robust contracts.
- gexla 10y ago> I sort of assumed this DAO thing was intended in this spirit, as an experimental stab on the path to robust contracts. With millions of dollars in prizes if you could exploit it?
- tremon 10y agoWith millions of dollars in prizes if you could exploit it!
- Joeboy 10y agoMy hope is that the people putting millions of dollars into it are well off people who are OK with putting their spare money into something obviously risky and experimental. Edit: If this is not how it is, I'd be interested to know who is putting money into the DAO, sociologically speaking. I hope nobody's investing their life savings in it.
- tveita 10y agoMy impression is that the DAO people are early adopters mostly from the Ethereum Foundation itself, so the "150 million dollars" number that is bandied about would be mostly paper profits from a much smaller investment. It doesn't mean they ever had 150 million dollars in actual money between them, or any practical way to get it.
- DasIch 10y agoThere are bugs in critical shared software infrastructure like Linux, libc, OpenSSL, and so on as well and not just a few minors ones. Why would it be any different for "bespoke ethereum contracts"?
- wslh 10y agoI see a different problem here: Ethereum and the DAO were not in a mature state to handle this amount of money. For example, there is a limited support for upgrading contracts in Ethereum and the DAO was not reviewed enough to handle hundreds of million dollars. Also, there are methods to make the software ultra secure using formal models.
- infodroid 10y agoI always wondered why there was such a rush to launch the DAO. As opposed to what Ethereum itself did: develop a proof of concept for over a year, then release a beta version and provide bounties for security bugs, all the while collaborating with testers and security researchers to stress the software.
- fudged71 10y agoTheDAO effectively turned into a massive bug bounty, a pot up for grabs.
- infodroid 10y agoIndeed an important question that will be decided soon is whether the "hacker" will get to keep the reward pot, or whether the rules of the game will change to deny it.
- drewm1980 10y agoI am curious if a huge DAO-like organization could avoid being a target solely by keeping very of its wealth liquid at any moment... i.e. what would have happened if 99.99% of the DAO's eth were loaned out... would the hacker have bothered? (assuming it wasn't an inside job)
- SkyMarshal 10y ago>I always wondered why there was such a rush to launch the DAO. So Slock.it could raise money, obviously. A common complaint right around when Slock.it launched the DAO was that Slock.it planned to offer the first funding proposal on it but only provided a brief 2-week period for review and debate before the voting started. It had the appearance of an attempt at railroading the crowdfunding process for a quick payoff. Fortunately cooler heads uncovered the problems and spoke out, putting the brakes on. Now it's a big learning experience for the ~23,000 people who blindly jumped on the hypetrain and put money into a flawed investment vehicle. You'd think the first 7 years of Bitcoin would have taught people a lesson that this technology is risky, but dollar signs in the eyes tend to obscure hindsight I guess.
- pron 10y agoOf course. But human contracts require human judgment and it is precisely the psychological fear/mistrust/puzzlement of proponents of machine contracts that leads to their political adoption of the idea. I don't think there's necessarily an objective risk/reward analysis behind preferring one over the other, just a matter of personal temperament.
- infodroid 10y agoUnlike traditional contracts, the idea was that smart contracts were going to eliminate the need for enforcement or dispute resolution. So that law is enshrined in code. But this incident has set a precedent, at least within Ethereum, that the project leadership will intervene to enforce the spirit of a smart contract. So what now are the benefits of Ethereum smart contracts over the traditional legal system? The way I see it, at least with traditional contracts you have the benefit of a trained and experienced judge making the call in case of a serious problem.
- ar0 10y agoAgreed. If this soft and hard fork idea really goes through, it seems that now you are in fact getting the worst of both worlds: For your contract, you have to write code that apparently is very hard to get right and bug-free[1], while at the same time you are at the whim of a "community" -- whose decisions (sorry, "suggestions") can apparently be announced by one guy in a blog post -- not to deem what you are doing an "attack". PS: Also a second thought: Given that the "attacker" used apparently existing functionality of the DAO and that the DAO site clearly states "[n]othing in this explanation of terms or in any other document or communication may modify or add any additional obligations or guarantees beyond those set forth in The DAO’s code", I am wondering: If this (as measured by the DAO code: rightfully obtained) ether is now taken from him/her, might this not be an opportunity to sue the developers implementing this fork in a real-world court? [1]: http://hackingdistributed.com/2016/06/16/scanning-live-ethereum-contracts-for-bugs/ http://hackingdistributed.com/2016/06/16/scanning-live-ether...
- pron 10y ago> might this not be an opportunity to sue the developers implementing this fork in a real-world court? That would make for a very interesting trial, where a very rigid ideology would be put to the test.
- sznurek 10y agoCommenting on your second thought: I hoped that people behind DAO (and Ethereum?) will stick to the terms they themselves proposed but it seems they will push hard for forking the chain (see: Ethereum blog).
- unknown_apostle 10y agoAnother way to say the same: there is no slack. Errors can be sudden and complete. Compare with "old fashioned" contract law or e.g. national currencies or gold. The errors there (theft, counterfeit and fraud) tend to impact only one or a few transactions. It's all more localized/ In case of broader failure of old fashioned money (e.g. national currencies being destroyed through inflation): at least this is a very slow process that is usually being telegraphed years in advance.
- lumberjack 10y ago>This is what concerns me about contract programming. It is really the whole cryptographic ambition for trust less systems that is possibly problematic. I'm trying to be open minded. I'll concede that maybe they are will be proven right with time, but maybe not.
- kalleboo 10y agoThe problem is in a trustless system, there's still trust - trust in the code. And if there's one thing I have ZERO trust in, it's software.
- xioxox 10y agoI don't know much about Ethereum, but why aren't the contracts declarative? Surely, it would be much easier to see the logic behind the contract and avoid the impossible task of a bug free turing complete language.
- gjem97 10y agoThe Turing-completeness of the language is the whole point of Ethereum. That's what differentiates it from other (Bitcoin-like) crypto currencies. It allows anyone to build arbitrary business logic--an exchange, a venture capital firm, a game--that is run directly by the participants in the blockchain.
- Animats 10y agoIn retrospect, a declarative language might have been a better choice. There's a tendency in open-source projects to make things Turing-complete because it's too hard to agree on what the declarative primitives ought to be. (Hence JavaScript.) This is not what you want in contracts for substantial amounts of money. It's passing the buck to the users.
- 3pt14159 10y agoThere is nothing stoping you from getting involved in a much more complex scheme of contracts. You could easily set up a system where a web of trust filtered, community funded "court" creates a wallet that is used for mitigating disputes. If a judgement (done by key signing votes) goes against a user you decrement how much they are going to get after the period ends and you increment how much the claimant gets. If nobody gets into a conflict at the end of the period everybody votes to send back all the money to everyone's respective wallets.
- dzdt 10y agoYour word "easily" translates to "I haven't really thought hard about it and I am not an expert but it seems easy to me." That is a trap for beginners to cryptographic systems. Getting it right in all details is HARD, as has been proven time and again by failures. The theory is hard, the implementation is hard, and making it usable is hard.
- deleted 10y ago[deleted]
- qwtel 10y agoThis hopefully provides further evidence that smart contracts currently are not and probably never will be a replacement for traditional contracts and court systems. Instead they are a low-cost alternative for specific off-the-shelf problems (like ownership) for which battle-tested implementations will eventually exist. In that sense smart contracts are a tool for a specific purpose (and maybe a replacement for people who don't have the luxury of a working court system) as opposed to the end-all-be-all solution that some make it out to be.
- deleted 10y ago[deleted]
- programmarchy 10y agoKeep in mind Ethereum is less than a year old, the DAO is even younger. It's still new, risky, and fraught with problems that need to be solved. If you're not familiar with anarcho-capitalist theory, there's a concept called a DRO -- dispute resolution organization [1] -- that can perform arbitration functions in a decentralized manner, i.e. without a monopoly on judicial services like the state. In the future, as the infrastructure matures, I'd be willing to bet DROs will arise to handle these types of disputes. Forthcoming DAOs can be more competitive by integrating dispute resolution clauses into their contracts. For example, maybe there's a flag that must pass before any transaction takes place, and can fail if X% of DAO stakeholders vote to halt transactions and defer to a DRO for arbitration. Hard to say exactly how things will evolve, but what's great about Ethereum is that contract law has the potential to evolve at a much quicker, cost effective pace than does the monopolistic, bureaucratic justice system we have in place today. [1] https://en.wikipedia.org/wiki/Dispute_resolution_organization https://en.wikipedia.org/wiki/Dispute_resolution_organizatio...
- Analemma_ 10y agoThis is fascinating. How do ancaps propose that DRO's will enforce their judgments? With violence? What's to stop the losing party from just gathering a bigger militia and shooting back to prevent collection?
- qwtel 10y agoThe collection could be written as part of the smart contract that wants to use the service of the DRO (of course that part would have be be bug-free…). Generally, I think ancaps would argue that violence wouldn't occur because it is too costly (as they do in the context of private defence agencies [1]). Anyway, I believe this argument is flawed, in the sense that people have resorted to violence, despite the fact that it was nonsensical in economic terms (I'm looking for the quote of some prominent intellectual who argued around ~1914 that no big war could ever happen again, because it would be devastating in economic terms. He was proven both wrong and right in the sense that it indeed was devastating for the economy and that it occurred anyway as we know. If somebody knows the name of this gentleman please let me know). [1]: https://en.wikipedia.org/wiki/Private_defense_agency https://en.wikipedia.org/wiki/Private_defense_agency
- lallysingh 10y agoFormal proofs. These are reasonable to do with modern proving systems, and contracts with formal proofs would be a reasonable output for a specialist in this area, equivalent to a lawyer for regular contracts.
- erikpukinskis 10y agoI'm surprised no one has mentioned: Human contract law still applies in this case. DAO members can still go to the FBI and try to find the "attacker". They can still ask the courts to try to take their Ethers back.
- Taek 10y agoAttempting to enforce the spirit of the law is a problem in its own right though. The flexibility of written law is repeatedly abused. Whether it's politicians taking land from their constituents, or drug laws being used to drive racism, we really shouldn't be looking at the flexibility of written law as a good thing. Or at the very least, we should be acknowledging that it's a double edged sword. Ethereum's smart contract language is not one which makes it easy to write secure smart contracts. There are dragons everywhere, and the DAO is far and away not the only smart contract to incur their wrath. In general I am in favor of moving to programatic, unforgiving law. But we need to do so at a pace that matches our technological progress. Today, the technology is not there to make advanced contracts. Simple ideas like 'this coin is owned by this person until a signature from this key transfers ownership to someone else' are pretty easily enforceable. Bitcoin has a scripting system with a variety of safe scripts in widespread use. But as soon as you start aiming at things like 'this investment fund is owned by this group of people and is able to make investments under conditions X, Y, Z, and can split... etc.', you've outpaced what we currently know how to do safely.
- logicallee 10y ago>This is what concerns me about contract programming. With human contract law, if there's a minor typo or loophole, participants can generally see the spirit and intent, and at worst go to a judge who will usually enforce the intent. But with software contracts, only the characters matter and there's no intent anywhere: either you get paid or you don't. It's much worse than that!! What you've just said applies to building an airplane or getting to Mars, too. Mother nature won't care what you meant to do. But this is worse: mother nature might give you turbulence, but She won't carefully cycle or time the turbulence in a code injection vulnerability to try to get your avionics to lock up at some particular moment. With these kinds of systems, you have humans actively doing everything in their power to break the system, even using the most subtle possible tricks. It's not just noise: it's a malicious attacker. It's not enough to "get it right". You have to get it right against someone with lockpicking tools, budget, time, and no legal, social, or moral checks and balances. By that standard, every vehicle NASA has ever built is completely broken, and NASA has never built a single thing that works. It's not just about code that's correct. It's about code to held to literally supernatural standards of correctness. It's a social problem.
- deleted 10y ago[deleted]
- fmap 10y agoIf there are ever more compelling use cases for smart contracts this will create a market for smart contract validation or development. Interactive theorem proving is already at the level that verifying something like the DAO (a few hundred lines of code!) isn't too complicated. By the time smart contracts become relevant we'll probably have all the tools in place to make this an industry instead of a research project.
- metaguri 10y ago> How do _you_ know your contract is secure? Ideally, using formal methods [1], one can write a provably correct program. Just because software can have bugs does not mean it must have bugs. Human contract law has no analogue. Personally I'd be wary of any electronic contract that wasn't formally verified. The DAO exploit is unsurprising. 1. https://en.wikipedia.org/wiki/Formal_methods https://en.wikipedia.org/wiki/Formal_methods