15 ms·
These incidents really illustrate the main flaw of smart contracts: a single bug in your code can lead to incredible losses. I simply don't think it's possible
by lalaland1125 5y ago
These incidents really illustrate the main flaw of smart contracts: a single bug in your code can lead to incredible losses.
I simply don't think it's possible for human beings to write good enough software for smart contracts.
- fasteddie31003 5y agoHow is that different from a traditional contract written by a lawyer? A single word could leave a huge unexpected hole in a traditional contract.
- duxup 5y agoThere's actually some chance that a poorly written contract, can be fixed / worked out between the parties involved.
- kortilla 5y agoThe difference is that disputes are resolved by humans who attempt to determine intent.
- tyre 5y agoBecause traditional contracts can be interpreted by a court of law and adjudicated with context. There's an entire field of contract law, with hundreds of years of precedent to fix very obvious human errors, like a typo where neither party could have possibly meant what is "technically" in the contract.
- tablespoon 5y ago> Because traditional contracts can be interpreted by a court of law and adjudicated with context. And all of that is a kind of technology that many "technology" people are far too eager to throw away for spurious reasons (often because they just plain don't understand it). It's like if someone was working on autopilot program and rewrote it in a "modern" language, and "simplified" it in the process by dropping a bunch of "unnecessary" use cases...then it turns out that at least some of those cases were there for good reason and a bunch of planes crash. A lot of cryptocurrency and blockchain stuff is half-baked because it seems focus on faddish technology for its own sake rather than trying to actually build someone that works.
- leifg 5y agoRegular written contracts are not automatically enforced. Not a lawyer here but I’m guessing. Not all legal loopholes automatically deprive you of all your savings. Intentional loop holes only go so far before consumer protection or other entities overwrite it. And if both parties are in agreement and in good standing you can figure out a way to find a reasonable compromise.
- pinky1417 5y agoIndeed, contracts can be invalidated if they're abusive. For example, there's a doctrine in contract law called unconscionability. If you buy an airline ticket to Boston, the captain can't say upon landing "Welcome to Boston! You can pay $10,000 to deplane or we'll take you back to where you departed." Or let's say that, when you agree to the terms for a e-commerce site, buried deep in the terms is a clause saying the site gets half the money in your bank account. Sure, both parties might've technically agreed to the contract, but the contract probably isn't enforceable. *Not a lawyer either, but I've read some introductory contract law stuff. All I know is this: you don't want to rely on the courts to save you, since they generally err on the side of the literal contract, but I don't spend much time worrying about accidentally agreeing to a contract that will sell myself into slavery.
- exdsq 5y agoLawyers argue over ambiguities or mistakes and use precedent to solve these issues, smart contracts don't have that extra level of protection.
- donmcronald 5y agoWith a traditional contract you don't have to worry about an unrelated 3rd party coming in and taking all your assets. And if you have a mistake in a contract that governs a business relationship there's a lot of incentive on both sides to compromise (assuming it's a good relationship).
- aeturnum 5y agoPart of contract law is that the legal standard for enforceability is "reasonableness"[1]. If there is a clause in a contract that you want to exercise, but your counterparty claims they didn't understand it or intend it they can take you to court. Unless you can convince a judge that they might, at one time, have wanted to agree to the contract then the contract is not a basis for you to take that action. Contracts have always had a healthy dose of manual debugging that have allowed them to function. [1] The idea of "a reasonable person" is used heavily in the US legal system and has problems but it also has upsides.
- PeterisP 5y agoIn contract law, intent is the key part, so if the "hole" is truly unexpected (e.g. the most significant errors that come to mind would be an accidental omission of "not" which completely reverses the meaning of the contract; or perhaps a mistaken swap in the description of who pays whom) then it would be reasonable to demonstrate that is was not what either of the parties intended, and thus that single mistaken word simply does not matter and would be ignored. What you do get in contract disputes where specific wording matters is in edge cases where you might reasonably assert that both parties wanted (and agreed) A or not-A for some specific situation as part of the negotiation, disputing where exactly some boundary lies - but not for the core parts or complete reversal. On the other hand, automatically enforced "smart contracts" don't make such a distinction and any typo can reverse the core meaning of the contract as well.
- ullevaal 5y agoThe parties in a dispute like that are likely to settle out of court, in a somewhat reasonable manner, instead of blindly applying the law until a judge automaton reaches a decision following the letter of the law. With a smart contract, there can be no negotiation and attempt at reconciliation. The price here will never recover from $0, so at a single point in time $248,000 was transferred from bag holders to beneficiaries.
- mrec 5y agoI've seen them described as "self-funding bug bounties".
- intrasight 5y agoWhen I think about it in those terms... Why not fund bug bounties that way?
- X6S1x6Okd1st 5y agoThat is happening as well.
- solomonb 5y agoBecause you presumably want to find bugs in applications that are not smart contracts.
- adtac 5y agoWait you don't have a /root/btc_bounty_private_key.txt with 600 permissions in every server?
- intrasight 5y agoNo. I was specifically referring to finding bugs in smart contracts. Stand up a network and have a "bounty" that would attract attempts.
- EGreg 5y agoBecause the payout would be too large
- intrasight 5y agoThe payout would be whatever gas you put in as the "bounty"
- rawtxapp 5y agoThey are called ransomwares and people aren't very happy with that method.
- jwlake 5y agoMostly it involves people making systems that are too complex to trivially analyze. You can not write arbitrarily complex secure code. You need to limit your scope and do one very simple thing extremely tersely and correctly. You can make powerful systems with simple correct independent components. You can not make complex secure monolithic systems. It gets even worse when you look at contracts with delegation. The problem with most "smart" contracts is they have abstractions, delegation and scope creep.
- raverbashing 5y agoYes, I agree. Most of the security of smart contracts should be in the VM. Things like self-asserting the results and only finishing the transaction if it actually passes a double-check. Or set value limits to each smart-contract (so even if there's a bug it will only operate on 0.00001 BTC for example).
- admax88q 5y agoIf your smart contract can only process tiny amounts of money, then it's no useful.
- raverbashing 5y agoThat's not what I'm saying. But sure, if you think you can write smart contracts without bugs for all means don't set a limit. I'm saying you should define a ceiling for your smart contract so in case of a bug, no transactions over that ceiling go forward. So if you have a stupid bug that causes you to transfer 1BTC instead of 0.001BTC you don't lose all your money.
- recursive 5y agoWhat's the distinction? That just means you won't be able to use smart contracts for anything useful.
- jwlake 5y ago
- tylersmith 5y agoHuman beings write software that flies people around the world and shuttles people between the Earth and space. Managing money is not more important than many things we use software for.
- ethanbond 5y agoSoftware that you can't update is borderline not-software. It's hardware with no joysticks for humans to adjust. It just happens to be hardware that's implemented in code.
- trophycase 5y agoYou can upgrade many smart contracts with proper practice.
- mustafa_pasi 5y agoThose systems have built in redundancies. They don't assume trustless 100% bug-free code.
- pfisch 5y agoI'm not saying you're wrong, but that software in most cases isn't constantly under attack from another team of engineers trying to blow up all the planes.
- MattGaiser 5y ago1. Not always correctly, as seen with the 737 MAX. 2. We have a general AI exception handler called a pilot. 3. Many of those systems have hardware redundancies, so even if there is a bug, hardware can stop it. A fuse might blow instead.
- rspeele 5y agoPutting your money in one of these smart contracts is like getting on a fully autonomous plane, with no pilot. And you get a refund for your plane ticket if you reach your destination, but if you don't, whoever figured out the trick to crash the internet-connected plane gets to keep all the ticket money. And that could be the same person who wrote the plane's software.
- deleted 5y ago[deleted]
- hindsightbias 5y agoUntil lawyers become coders or coders become lawyers I don't even see who could review them.
- bena 5y agoI actually know a guy who does both. Nothing further to add, just thought it was funny that I actually know a lawyer who does some programming. I think he was going to college for computer science and then switched to law. Last I heard from him, he was running for a judgeship.
- wyager 5y agoIt's possible, but approximately no one in the shitcoin industry knows or cares enough to write fully formally verified programs.
- solomonb 5y agoAre there even any dependently typed smart contract languages that would allow you to encode and carry proofs in your contracts? Without that I think the best you could do is model your program in some other formal verification system and then convince yourself that your model matches the actual contract.
- vjhdfhjjh 5y agohttps://blockstream.com/2018/11/28/en-simplicity-github/ https://blockstream.com/2018/11/28/en-simplicity-github/
- wyager 5y agoThe Simplicity language is good. I’m sure there are other designs.
- solomonb 5y agoOk I did a really shallow search of the smart contract space and it looks like the trend is towards creating simple languages that are easy to reason about and formalize their semantics. Simplicity seems to be the best example of this. With such a language you can write proofs about the behavior of the runtime using some proof checker and then programs in it should be simple enough to reason about in a rigorous way. What I have not seen and what I am curious about is a smart contract language more in the spirit of Idris. That is to say a more complex language design with full dependent types, which would be a lot more difficult to formalize, but would allow you to do really nice things like treat proofs as first class citizens in your actual smart contracts.
- wyager 5y agoI think in most cases you wouldn’t want something like idris as a smart contract language on any kind of cryptographic system (blockchain, ZKP system, whatever) because idris programs are expensive to typecheck and evaluate. It would be reasonable to construct a DSL or something in idris that compiles a compact, easily computable language though. The idea about having proofs as values in smart contracts is interesting though. I could see a few neat applications of that.
- progbits 5y agoTime for LawyerCoin (TM). The smart-contract is written in English (or other human language) and the oracles are powered by a bunch of lawyers who pinky swear to enforce them. I'm doing ICO next week, if anyone wants in.
- whatshisface 5y agoWe can do better than pinky swearing. Each lawyer gets mining fees when they enforce a contract fairly. "Fairly" is defined by consensus, where each lawyer is forced to predict the consensus before voting in a private ballot that is only revealed when the rewards are issued. Lawyers who predict the consensus get rewarded. If you start it off with people who are trying to be fair then predicting fairness will lead to the most reward, and it will keep going until the majority defects. The collective is incentivized to continue being fair because if they weren't, nobody would use their coin, and the rewards issued to fair lawyers would be worthless.
- lisper 5y agoThat's actually a pretty good idea. I had a similar idea to discourage the gaming of upvotes on sites like HN and Reddit: make each upvote cost a point, but then you get a point for everyone who upvotes after you, divided by the number of votes the item had at the time you upvoted (or something like that). So people who upvote popular stories early, i.e. people who successfully predict what people will like, get rewarded.
- whatshisface 5y agoDon't give me too much credit, I stole it straight from https://augur.net/ https://augur.net/ by swapping "truth" with "justice." ;) Fortunately for me the idea blockchain is irrevocable and my theft cannot be reversed.
- falcor84 5y agoBut why would we want to encourage such groupthink and discourage dissent?
- iNane9000 5y agoThat’s not even close to the main flaw. The main flaw is that it incentivizes crime, human trafficking and accelerates environmental destruction. None of these are huge problems if you can afford a private bunker in New Zealand. It’s a major problem for ordinary citizens, especially those of poorer countries. Everything involving code has bugs. Bugs aren’t a reason not to use code. Bitcoin isn’t a problem for the very small fraction of the population that use it. Bitcoin users are super rich tech workers and finance guys, by and large. The people hurt most by Bitcoin are all the people who don’t use it. It benefits the ultra-rich at great expense to the other 99% of humanity.
- twox2 5y agoThat it incentivizes human trafficking and crime is pure hyperbole. Also turns out that the barrier to entry for crypto is lower in the 3rd world than you might think: https://www.youtube.com/watch?v=jvHN0MEBoZo https://www.youtube.com/watch?v=jvHN0MEBoZo
- iNane9000 5y agoI believe the synagogue shooter was paid in Bitcoin. So not pure hyperbole. Edit: might have the details confused about above point, but the general thrust of things is pretty clear. https://foreignpolicy.com/2019/03/19/neo-nazis-banked-on-bitcoin-cryptocurrency-farright-christchurch/ https://foreignpolicy.com/2019/03/19/neo-nazis-banked-on-bit...
- breck 5y ago> I simply don't think it's possible for human beings to write good enough software for smart contracts. I agree, but think it's fixable. I believe we have missed a natural platform in between binary notation and computer languages. I believe there is a 2-D dimensional binary. Simply using a grid (with an array of cells forming a line, and lines stacked on top of each other—a spreadsheet basically), we can drop *all* syntax characters. The only thing you have is your cells and your semantic words. Not only does this make tooling and languages much simpler (which will have big network effects), but you gain new fundamental complexity metrics which may turn out to be incredibly important in designing simple, bug free systems. I personally really like crypto but it's not one of my main interests. I have been working with some folks in the space on using these ideas to build a new type of blockchain from the ground up. I bet that the biggest blockchain in the future will be a higher dimensional one, based on Tree Notation or derivatives of the core ideas.
- Jasper_ 5y agodid you just reinvent Befunge, but unironically?
- breck 5y ago> v v ,,,,,"OH NO! "@
- jcranmer 5y ago> I believe there is a 2-D dimensional binary. Simply using a grid (with an array of cells forming a line, and lines stacked on top of each other—a spreadsheet basically), we can drop all syntax characters. The only thing you have is your cells and your semantic words. I fail to see how this helps. The reason why bugs crop up all the time in software isn't because syntax is confusing. It's also not because semantics is confusing--plenty of bugs have perfectly clear, well-understood bugs. The problem is that we as programmers don't think about how our software could fail. We don't ask ourselves "could this multiplication overflow?" frequently enough. We don't look at code and ask "who made sure this pointer points to valid data?" We believe that there's no way the price of an affiliated token could ever reach exactly $0, so we assert that it can't happen. The way you avoid these bugs is to just simply make it impossible for the system to get into certain states. It's already the case with statically-typed languages that it's impossible to pass a string to a function that expected an int. If you design your API right, you can make it impossible to get an index into an array that is out-of-range (although this is way too rarely done). But, even then, you will still find people who will confidently use the escape hatch to say "this string is clearly UTF-8, I know it is from outside experience, so don't bother checking."
- Kiro 5y agoI don't see it as a flaw. It's all part of the game and the fact that things like this can happen just makes it more intriguing. Obviously only valid if you, like me, see it as a futuristic/cyberpunk financial experiment or art project.
- jxi 5y agoOn the other hand, it's fully auditable and transparent. Who knows if my bank's software is stealing a couple dollars from me every month due to "software bugs" as well. I'd need to setup a bot to check my balance every day to make sure. Point is not whether my bank is malicious, but just that there's bugs everywhere and we'll have a few big "rug pulls" as this defi stuff is in prototype phase, but it will eventually grow mature. A flaw in Windows can lead to incredible losses too, but we've grown past that.
- HugoDaniel 5y agoWould an "upgradeable" crypto-coin solve that flaw?
- analognoise 5y agoUpgrade to fiat currency that the rest of the world runs on and doesn't have these problems?
- WalterSear 5y agoImmutability is at the heart of blockchain functionality. Everything involved requires it. So, you'ld have to throw it all out and try to invent something entirely different.
- w4llstr33t 5y agoHave you heard of Tezos? Tezos is often referred to as the first “self-amending” blockchain, which routinely adapts and adopts new features natively and automatically via its unique on-chain governance mechanism. This protocol functionality allows the system to coordinate the selection of new updates though popular voting, integrate the new updates that are selected, and compensate the developers who proposed them. [1] [1] https://www.gemini.com/cryptopedia/what-is-tezos-xtz-governance-use-cases https://www.gemini.com/cryptopedia/what-is-tezos-xtz-governa...
- hanniabu 5y agoLot of buzz words to say soft forks. Also this has nothing to do with upgradeable contracts.
- w4llstr33t 5y ago> has nothing to do with upgradeable contracts. Although the article is talking about the SafeDollar contract, there were some general points about crypto / blockchain in this thread that I was responding to. Tezos is one example that has on-chain governance, which is why I mentioned it. If you want to provide more info about how the on-chain governance is really just done through soft forks, and why you think that's not innovative, I'd be curious to hear. I'm not huge on Tezos but I think they do some interesting things.
- ourcat 5y agoAgreed. And it's the auditors who need to get better.
- arcticbull 5y agoA lifetime of experience has shown us that code review and testing are never sufficient to eliminate bugs. What we need to do is abandon the concept of smart contracts that immutably and permanently move people's money with zero recourse - running exposed to the internet without a firewall.
- ConcernedCoder 5y agoCan there ever be 'bug free' software? As a lifelong programmer, I'm starting to think that it's impossible to write perfect software free from bugs.
- ma2rten 5y agoI thought that was conventional wisdom.
- Symbiote 5y agoIn some cases, yes. See Software Verification [1] for some pointers. It's massively more expensive, so you'll see it used in aerospace, railway signalling, some vehicles (trains, components of some cars), power generation and distribution, industrial processes. Sometimes also in consumer products that have long warranties and are extremely expensive to recall/repair, like washing machines. Just yesterday was a post on a formally-verified C compiler, used by Airbus (and others) [2] [1] https://en.wikipedia.org/wiki/Software_verification https://en.wikipedia.org/wiki/Software_verification [2] https://news.ycombinator.com/item?id=27648735 https://news.ycombinator.com/item?id=27648735
- kube-system 5y agoSoftware verification can make a system ≈ bug free from a pragmatic perspective, but, there are still holes: humans do the verification, and there are practical limitations to the scope of system and integration tests. The fact that we still find zero-days (and other bugs) on systems that have gone through software verification is evidence of this.
- jhickok 5y agoTechnically, I don't see why it would be impossible. Seems like it is incredibly unlikely.
- dragonwriter 5y ago> Can there ever be 'bug free' software? Sure. And if you look at sufficiently small-scale pieces of software, there is probably a lot. As scope of a software system increases, the probability of bugs rapidly approaches unity, though.
- rawtxapp 5y agoThe flip side of that is any smart contract that stood the test of time should be rock solid. For example, there are huge incentives to go ahead and hack a big contract like maker, compound, uniswap or aave, so you can bet that there's highly qualified people out there trying to hack them as we speak, yet after all this time, they are still working as intended. I have a lot more trust in that kind of product than in a product where contracts are subject to interpretations by humans which may or may not be reliable. It's one of the reasons why people incorporate their companies in Delaware, there are well known case law, so you know in advance what to expect from the justice system. Predictability is an important part of a contract, I trust a well inspected and battle tested smart contract much more than a human enforced contract. That said, not everything is suited to smart contracts, but many financial applications are.
- lisper 5y agoThat's no guarantee. Someone might have a zero-day stashed away somewhere.
- rawtxapp 5y agoThe game theory comes into play, if you found a bug that could empty maker's vaults for example, you better do it right now, otherwise, someone else will before you and you wasted all your time/energy.
- theli0nheart 5y agoExactly. This is precisely why there aren't (or at least, in a rational world, should not be) any undisclosed zero-days in crypto. If you're aware of an exploit, you're just going to exploit it immediately unless you're willing to let someone else exploit it in your place. There is a large amount of money at stake with these exploits and it doesn't make economic sense to let one sit around.
- Retric 5y agoHow many major bugs in software and especially cryptosystems went undisclosed for decades? The core issue is the inherent asymmetry where 1 person finding 1 bug can destabilize giant systems. Even if these systems where hundreds of years old that doesn’t actually mean much.
- skizm 5y agoEthereum just forked the entire blockchain to undo a transaction they didn't like. I'm not sure if that's reassuring or a complete violation of the entire premise of smart contracts.
- mikkelam 5y agoAs long as everyone agrees i see absolutely no problem. The entire value proposition of decentralized blockchain is to establish consensus without trust. If everyone agrees to undo a transaction, it seems perfectly fine to me, as that would require the consensus the blockchain already establishes
- danellis 5y ago> As long as everyone agrees i see absolutely no problem. They didn't all agree, though. Now there's Ethereum (the people who agreed with the fork) and Ethereum Classic (the people who didn't agree).
- mikkelam 5y agoSome agreed, others didn't and they decided to create a fork. Consensus doesn't require everyone to agree, just the majority
- WalterSear 5y agoOne way of reading this comment is that you concur that there's a problem.
- hanniabu 5y agoOne way of reading this coontent is that most don't think there's a problem
- vecinu 5y agoYou're literally talking across yourself, at least that's how I read it. Your first comment [1] > As long as everyone agrees i see absolutely no problem and now > Some agreed, others didn't...Consensus doesn't require everyone to agree, just the majority So you literally just said there is a problem. [1] https://news.ycombinator.com/item?id=27666781 https://news.ycombinator.com/item?id=27666781
- scottpf 5y agoThe plus side is that smart contracts provide their own "bug bounty" programme. If a smart contract that handles a coin with a market cap of +50M USD has not been breached, I absolutely trust that contract to be safe.
- dasudasu 5y agoThen it becomes a matter of game theory as to whether you cash in the bug immediately to empty the pot, or wait for it to grow even more from the positive feedback loop of it being "obviously bug free if it grew this large". For state-sponsored actors, 50M would only be a modest sum.
- mattwilsonn888 5y agoThis is one of the biggest reasons I like Cardano. It's written in Haskell and its contract language is functional and heavily inspired - meaning that code gets many of the functional benefits: it is more concise, more readable, less prone to side effects, and more often than non-functional code won't run at all if mistakes are made. The trade offs in functional languages seem to well suited for the world of smart contracts, that I almost think of smart contracts as the retro-active problem that functional programming solves. Granted, I appreciate functional programming and good code enough where I wish all code met the standards required for FP, but the real world is much messier; when large amounts of money are so directly on the line though I think its obvious the compromise is worth it. Smart contracts are like launching a rocket - you don't optimize for development time. FP forces a bit more safety.
- throwaway4good 5y agoThe problem here is really Ethereum and the language Solidity. Chuck full of gotchas and completely horrible to work with. The mechanics of stable coins is really trivial and thusly should be trivial to implement and validate. Unfortunately it is not, and it is sad that the hype and investment rush inside the broader crypto field does not foster languages and platforms that actually are suitable for the few realworld use cases that exists inside crypto.
- delusional 5y agoHow are they trivial? From my limited knowledge they are basically trying to stabilize a speculative asset using another speculative asset. To me it seems like an essentially impossible task.
- throwaway4good 5y agoYeah. In theory they are broken. But in practice they can work for a while. They work by taking a collateral and splitting in two. The first part has some fixed value in an external currency. The other part is the rest. And that works as long as the rest has some value. However here we are talking about programming errors in the implementation. And Solidity/Ethereum is really at fault. How do you implement a contract in Ethereum where a certain thing happens the price of Ethereum drops below XXXX dollars? You can (as this is what MakerDAO and others are doing) only it is silly complex to do. It really should not be.
- hanniabu 5y agoMost things are simple in theory and not so simple in practice. Also just because people write programs with bugs doesn't mean the language or platform is at fault. Sorry but it sounds like you have no idea what you're talking about.
- mattbeckman 5y agoEOS tried to use on-chain Ricardian Contracts and pair that with upgradeable smart contracts in C++ with DPoS consensus so that intent-of-code could be enforced. That's pretty "real world" but most people feel it's not unstoppable enough. Ethereum is pretty unstoppable, but unless you use a contract proxy, your contracts are immutable and bugs that can be exploited will be exploited.