943 points · by campbelltown · 9y ago · 725 comments
All state is mutable by default (this includes struct fields, array elements, and locals). Functions can mutate state by default. Both are overridable by explicit specifiers, much like C++ "const", but you have to remember to do so. Even then, the current implementation doesn't enforce this for functions.
Integers are fixed-size and wrap around, so it's possible to have overflow and underflow bugs. Granted, with 256 bits of precision by default that's harder to do than usual... but still pretty easy if you e.g. do arithmetic on two inputs.
Operators have different semantics depending on whether the operands are literals or not. For example, 1/2 is 0.5, but x/y for x==1 and y==2 is 0. Precision of the operation is also determined in this manner - literals are arbitrary-precision, other values are constrained by their types.
Copy is by reference or by value depending on where the operands are stored. This is implicit - the operation looks exactly the same in code, so unless you look at declarations, you don't know what it actually does. Because mutability is pervasive, this can can have far-reaching effects.
Map data type doesn't throw on non-existing keys, it just returns the default value.
The language has suffixes for literals to denote various units (e.g. "10 seconds" or "1000 ether"). This is purely syntactic sugar, however, and is not reflected in the type system in any way, so "10 second + 1000 ether" is valid code.
Statements allow, but do not require, braces around bodies. This means that dangling "else" is potentially an issue, as is anything else from the same class of bugs (such as the infamous Apple "goto fail" bug).
Functions can be called recursively with no special effort, but the stack size is rather limited, and it looks like there are no tail calls. So there's the whole class of bugs where recursion depth is defined by contract inputs.
Order of evaluation is not defined for expressions. This in a language that has value-returning mutating operators like ++!
Scoping rules are inherited from JS, meaning that you can declare variables inside blocks, but their scope is always the enclosing function. This is more of an annoyance than a real problem, because they don't have closures, which is where JS makes it very easy to shoot yourself in the foot with this approach to scoping.
Any remotely popular functional programming language created over the last years shows a better design (and taste) than this one.
And if that only attracts a certain type of programmers? (pun intended) That is, programmers valuing languages like Haskell/OCaml/F#/Kotlin/Rust, who would only ever touch C with verified compilers and 5 different static analysis tools?
Well, that's exactly kind of people you to attract to write your security-sensitive code.
Solidity is ostensibly designed to let people write smart contracts for Ethereum.
More realistically, it is a marketing tool for enabling and onboarding people onto the Ethereum platform, which Ethereum benefits monetarily (enormously so) from. Security and design are secondary goals to the extent that they help prevent disasters which hurt adoption or churn developers away.
Through this lens it's not a mystery why the language is "hacky". Perhaps being a good language is not even the driving goal.
Curious question of a non-native speaker: What does this phrase mean? (in general, and in this context)
+1 : My feelings after going thru basics of ethereum.
The problem is that it's just not easy to get all those details right from day 1, and interest in Ethereum has grown way faster than its capacity to produce a reliable, mature set of tools around it.
Unsurprisingly, Tezos is actually written by OCaml people who seem to value the correctness of the contract language.
But not the kind of people you want to focus on to get traction for your venture-backed startup if you want a relatively quick and profitable exit
It's also quite hard for programmers to reason about performance or complexity in most functional languages. In the EVM, all functions should either be O(1) or bounded O(n) and should strive to use the most economical bytecode available to perform each task.
Disclaimer: I am a regular contributor to Solidity.
This is why I criticized the VM design as well as the language.
Yes, much effort went into making "cycle counting" as simple and straight forward as possible.
But I don't see any comparable effort doing the same for safety and correctness. (Apart from providing crypto primitives by the VM, which is neat, but only the tip of the iceberg in terms of language design.)
> It's also quite hard for programmers to reason about performance or complexity in most functional languages
This is true for Haskell, but "most" other functional languages don't suffer this issue: SML, OCaml, F#, Rust, etc.
Also note that lots of effort already went into creating lambda calculus variants where performance is especially easy to reason about. However, dismissing functional langauges as a whole already demonstrates that none that the research played any role in the design of EVM and Solidity.
In case you are interested, here is a nice starting point about the state of the art of 2014: "Structure and Efficiency of Computer Programs" https://www.cs.cmu.edu/~rwh/papers/secp/secp.pdf
Yet another data point for 'why a TC language is a bad choice for smart contracts'.
That would be cool. Even cooler would be if they created a code style culture around small contracts such that a contract should print out a legal-looking document with its own source code, when echoed to a printer.
My bet they never took any PL course, and have very vague understanding of what consequences certain design decisions would produce. "20 years of PHP coding" or something like that.
Any decent PL course would emphasize the first-class-everything (procedures , obviously), lexical scooping for proper closures, strong but dynamic typing (no implicit coersions) etc. No matter which sect one belongs to - ML or Scheme - these are universal fundamentals, the well-researched foundation.
PHP/Javascript coders usually do not understand the principles and implications behind languages they use. Otherwise they would develop a healthy aversion, like to a tasteless, vulgar porn.
Sane people with PL background would use a dialect of Scheme as a DSL (the numerical tower and all the nice things) or at least Lua (because packers are afraid of parenthesis and see nothing behind of them).
Actually, Scheme (or a simplified dialect such as the one inside Julia - flisp) would be almost ideal choice for financial DSLs.
For those who are cosplaying a PL expert (with 20 years of PHP and Javascript coding under their belt) there is a good read: http://users.rcn.com/david-moon/PLOT3/
Debugging is also a nightmare. There's no way to step through function calls or set break points, even though it's basically just Javascript. Multiple classes of bugs will generate the same "invalid opcode" error that is only visible at run-time with no indication of what line even triggered the error.
This is why I invested in the Tezos crowdsale. Smart contracts are a great idea but there's gotta be a better way.
The only small correction I would make concerns this:
> Functions can mutate state by default. Both are overridable by explicit specifiers, much like C++ "const", but you have to remember to do so. Even then, the current implementation doesn't enforce this for functions.
When interacting with Ethereum you can do two things: send a transaction, or call a function against your local copy of the blockchain. The former is mutating, costs ether (in gas fees) and requires the transaction to be included in a block. The latter is entirely local, cost-free, and any mutations to state are ignored.
The 'constant' modifier in Solidity serves only to tag the resulting ABI of a function so that calls to it from common interfaces default to local calls instead of sending transactions. It's not intended to enforce that calls to that contract are read-only, only to indicate to callers that it should be called locally instead of creating a transaction for it.
Actually, let me rephrase this. For better or worse, Solidity is a shipping product now, so you're constrained in your ability to make breaking changes. However, its status as the "official" blessed EVM language can be changed without breaking compatibility. So I guess a better question is, are you planning to replace Solidity with a language that has more emphasis on safety in its design (even if it's called Solidity 2.0 or whatever... clearly it would have to significantly break backwards compatibility).
Now, I know that most feedback that you hear is to just take an existing functional language. But after looking at Solidity and EVM specs, I also see why this is not necessarily feasible. And, as one of your contributors has pointed out in this thread, functional style can often be too high-level to keep track of the underlying opcodes and their gas cost.
But even sticking with the imperative approach, I think it's clear that there's a lot that could be changed, starting with adopting some key principles like "explicit is better than implicit", "don't pick a default unless it's absolutely safe" etc. Looking at the design of Solidity, it's clear to me that the primary inspiration was JS with a dash of C++. The one thing that's common to both is that they allow and encourage "clever" code. Perhaps looking at Ada, Eiffel, and even COBOL for inspiration would be more appropriate for this niche.
In any case, if you're interested in specific suggestions on how to redesign, I do have some thoughts, and would be happy to share them.
There are also proposals out for a number of the issues you have mentioned. I believe that people _do_ want to make Solidity into a better language for safe code authoring, but some things require EVM changes which requires a hard fork, and other things simply require time (discussion and engineering). The impression I get is that at this point there _are_ some voices of reason involved in the Solidity language process, but it will take time before those voices can enact all of the changes listed here.
Also, keep in mind that when Ethereum launched it did so like any scrappy startup, with an MVP that was "good enough" to move things forward. Now that Ethereum is a leading contender in the blockchain race it is starting to have to pay for some of those early decisions.
https://solidity.readthedocs.io/en/develop/solidity-in-depth...
Daily LoL: Googling "secure language" brings up mostly results about Java.
https://publications.lib.chalmers.se/records/fulltext/234939...
You can just skip messing with the termination checker (just don't mark your functions total) in Idris and write Haskell-ish code. The occasional rough edge aside, it's not hard to write the kind of programs we're talking about here: and if you want to prevent DDoS-like infinite looping, put the "total" annotations back in.
Starting from something like the lambda-calculus seems more sensible than starting from something like Javascript.
The E language has been a vehicle for smart contract research for decades. Joe-E is a more recent incarnation of many of the same ideas, that's a secure subset of Java.
Even replacing 256bit ints with arbitrary precision "bigints" wouldn't add too much of a cost if it's a native type of the underlying VM (as it should be for such an application IMO). It might even reduce code size by removing overflow tests.
That's not still the case with `const` and `let` in Javascript, is it? Lexical scoping still exists, but Block scoping is default now in JS
The default best practice, you mean? Declaring with 'var' will still get you the same lexical scoping rules as always.
I believe OP meant 'inherited from pre-ES6 JS'
I don't think that one even matters, that the language has side-effecting expressions (through impure functions) is enough to make an undefined OOE problematic.
> Integers are fixed-size and wrap around, so it's possible to have overflow and underflow bugs. Granted, with 256 bits of precision by default that's harder to do than usual... but still pretty easy if you e.g. do arithmetic on two inputs.
That ignores the problematically trivial "type inference" of `var`: type is decided based on the smallest type which can hold the literal. So any implicitly typed variable initialised to 0 is an 8-bit unsigned integer.
In reality, all closures get the same variable, and if it is the loop counter or derived from it, and closures are executed later, then they will all see the same value - the one that said variable had after the last iteration. It's even worse if closures try to write to it.
This is something that is peculiar to JS. In most other languages, there's no similar issue, because either local variables can't be declared inside loops (or, indeed, at all, treating assignment as implicit declaration), as in Python or Ruby; or if they can, then their scope is what you'd expect it to be, as in C#, Java etc.
Writing async code using closures as continuations is not unique to JS, either. All mainstream languages support this now.
for(var i=0; i < textures.length; i++) {
textures[i].onload = function (i) {
pattern[i] = ctx.createPattern(textures[i], 'repeat');
}
}
The enlightenment: for(var i=0; i < textures.length; i++) {
createPattern(i);
}
function createPattern(i) {
textures[i].onload = function() {
pattern[i] = ctx.createPattern(textures[i], 'repeat');
}
}
In JavaScript you can now however replace var with let and it will be block scoped and the WTF code will work. It's sad though as people learning JavaScript now will not get the beauty of it and will be stuck in callback hell. Function scope in JavaScript pushes you in the right direction. It's like instead of teaching people how to fly, we give them roads so they can walk, like they are used to.A common criticism is the way for loops and arrays are implemented are broken? Well actually they should rarely be used in contracts, its not like you can send ether/btc to an array recipients or in a for loop.
You do not need a complete language like F# and C++ to write contracts, The hacked contract should have had a simple modifier describing only the owner can run this command.
Once again the type system doesn't need to be perfect, if your code on the blockchain is broken you pay a transaction fee and the contract doesn't execute it.
For a language that was made less than 3 years ago, it amazing to see the progression. It will be a language that people hire for in the near future (already happening). Companies are notorious looking for 5 years experience.
Its hard to read the "I told you so replies", when the price of ETH has remained relatively stable during the news
It's interesting to see how the first virtualmachine specification for the first financial smart contract platform has overlooked all the pitfalls of the language-design industry and it doesn't look that a redesign is going to be addressed very soon because of the difficulty of the redeployment (as naturally backwards compatibility must be the first concern).
> Its hard to read the "I told you so replies", when the price of ETH has remained relatively stable during the news
Haha, so if the price is stable, this means that Solidity is not embarrassing? I'm sorry but this just means that people only care about security when their funds are the ones affected. Not about "potential" security problems or "design flaws" which sound too technical to them.
Not at all. Deconstruction of PL design is a popular pastime here.
> A common criticism is the way for loops and arrays are implemented are broken? Well actually they should rarely be used in contracts
If they cannot be used safely, they shouldn't be in a language.
If they can be used safely, but it requires caution and is to be rarely done, then the syntax should reflect that by not making it so easy to use them.
> Once again the type system doesn't need to be perfect, if your code on the blockchain is broken you pay a transaction fee and the contract doesn't execute it.
The type system enforces invariants that go beyond code being broken in a sense that it doesn't run. Sometimes broken code does run, with catastrophic consequences - remember Mars lander crash? That was one example of an error that could be prevented by a sufficiently advanced type system - in F#, for example, types can reflect units of measurement, and the language will plainly not allow you to do nonsensical things like add together feet and meters, without explicitly converting one way or the other.
By its very nature, smart contracts on a blockchain that deals with money have a huge potential for this sort of thing - a contract that doesn't trigger an error, but which silently behaves differently from what was intended by the author. The consequences, as we can see here, can be staggering, as in millions of dollars in damages.
It follows that the language that is used to write them should use every known mechanism to discover such errors early. This includes strong typing, immutability, explicitness, design by contract etc.
> For a language that was made less than 3 years ago
The language was not made in a vacuum 3 years ago. Other languages preceded it, and provided valuable lessons in PL design. Why these lessons weren't heeded is a reasonable question to ask.
A great motivation: it's always better to write half-assed implementations of rarely used features because they are rarely used.
> You do not need a complete language like F# and C++ to write contracts
Agreed. You need a small verifiable DSL, not an entire new language.
> Once again the type system doesn't need to be perfect
That's the spirit when designing a language!
> it amazing to see the progression
Well... yeah, if you started with the goal of executing without crashing it can only improve over time.
The initWallet function should have been marked internal, but was instead not marked. Unmarked functions default to public in Solidity, so anyone can call that function and reinitialize the wallet to be under their control
Based on the time of your post, I suspect you meant to link to:
https://github.com/paritytech/parity/blob/4c32177ef3f4521c66...
The initial poster posted this link: https://github.com/paritytech/parity/blob/master/js/src/cont...
Where "master" is the branch which normally has the latest code. And #L216 automatically scrolls down to the 216th line.
The issue is that line isn't permanent since the code in the master branch is subject to change. So in order to make a reliable link, you can link to the ref [1].
Like this: https://github.com/paritytech/parity/blob/4c32177ef3f4521c66...
You could also do it with the short ref (4c32177e): https://github.com/paritytech/parity/blob/4c32177e/js/src/co...
Normally you'd have to scroll up to the top right of the document and grab the short form it, e.g. "6b0e4f9" and replace it with master. Note that's only the ref of the last change for that blob (file) [2].
If you click the line number on a GitHub file, it will add the #LineNumber to your URL.
From there, press Y, this will replace master with the latest commit of the repo.
[1] https://git-scm.com/book/en/v2/Git-Internals-Git-References
[2] https://git-scm.com/book/en/v2/Git-Internals-Git-Objects
Language design is actually notoriously difficult in general[1], but if you're doing language design for a security-critical language[2]... well, that requires actual mechanized proof, IMO. Not just proof of "design", but proof of the implementation. Anything else is a huge gamble. (And I'm sure there are some 'investors'/gamblers who made off very well.)
[1] Beyond surface-level, obviously.
[2] We're talking about 0.0001% of the general population here.
Absolutely, few people really get this. Even those that do get it generally don't know what it looks like in practice because it's so rare.
In case you're curious about what it looks like in practice (at least one way), we presented direct user code compilation and verification[1] in Jan for our smart contract language Pact[2].
The idea that you can write a doc test that triggers a formal verification about some aspect of your code is, for lack of a better term, strange and yet the power to weight ratio is just off the charts. For the first few days that the system started working (I built the FV portion, Stuart the language + H-M type system) I thought it was broken... turned out we just had a bug in our demo code that we never noticed.
Usually, tests check the things you know to check so when they find something it's not a surprise what they find. Sometimes you can fuzz and randomly find something, which is cool but doesn't guarantee that there isn't a problem somewhere else. However, FV just feels uncanny (as a dev) because the test either finds a problem in the code -- and tells you how to replicate the bug -- OR proves that a problem cannot exist.
[1]: https://youtu.be/Nw1glriQYP8?t=1071
[2]: kadena.io/pact
Then, in another section of the documentation, when talking about function types [2], not specifying internal or external defaults visibility to internal.
It doesn't seem like the simplest or most consistent way to express these concepts, and certainly not the safest way.
[1] http://solidity.readthedocs.io/en/develop/contracts.html#vis... [2] http://solidity.readthedocs.io/en/develop/types.html#functio...
Your honour, in my defence, the contract clearly specified that anyone could reset the wallet, and if that's not what they wanted, they shouldn't have agreed to it.
So like most court cases, it will simply be a matter of human influence winning the case.
But yes it seems pretty asinine to use global by default for (not so) smart contracts.
"use strict";
foo = 1;
var bar = 1;
"foo=1" changes the variable foo (this is very useful) and "var bar=1" creates variable bar and adds it to the function/lexical scope. If the variable foo is not created/declared, it will throw an error! But without "use strict", "foo=1" would add variable foo to the global scope! Which might create unexpected bugs if you are used to other languages that does the sane thing and adds it to the local function/lexical scope. So I suggest to always "use strict" !It's not even in the category of weird timing attacks or complicated internal states allowing unexpected state transitions -- this is a trivial bug that could be spotted by viewing the contract in Remix (the Solidity IDE).
There are certainly some weird edge cases in the Ethereum VM programming model that are hard to UT, and I think that dev efforts in this area are under-resourced (e.g. it's currently impossible to test time-dependent contracts as there's no way of mocking out the clock in the simulated blockchain).
If you are considering writing a smart contract, read and re-read https://github.com/ConsenSys/smart-contract-best-practices, and then write UTs for each of these cases so that you can convince yourself that you've covered them.
Relevant to this bug:
> Understand that your public functions are public, and may be called maliciously. Your private data is also viewable by anyone.
This philosophy permeates the community of Etherum development.
Bitcoin disabled most of the smart contracts op codes for a very good reason.
I wouldn't recommend putting anything of value into an Etherum smart contract and find a project with more responsible developers who take a more "wait and see" approach.
If HE can't get it right, what business do you have running around saying that anyone who can make a webpage can make a decentralized application?
We are playing with money. Dealing with attackers is not as simple as rebooting your server. Mistakes mean irreversible loss.
The devs in this industry are way over their heads and nobody is willing to admit it, because doing so destroys the entire core value prop of Ethereum, the poster child of the current bubble.
Bitcoin is also stuck in the past. Yes, Ethereum breaks things, but for me it's not about the money but about the technology stack. We're too early in the process to have the luxury of being able to stop innovating.
If I want to play with cool state-of-the-art technology I use Ethereum. For financial transactions I use my bank and/or Transferwise. Haven't quite yet figured out why I'd use Bitcoin for something.
Some projects have started sharing audit results publicly directly in their repos [1]. It's a great read to see common errors and yet unsolved issues that originate in the ERC20 token specification.
[0] https://github.com/ConsenSys/smart-contract-best-practices#i...
[1] https://github.com/status-im/status-network-token#reviewers-...
How do these smart contract deal with the real world? I can see how they can work for things that entirely involve activities that take place on the block chain (e.g., a smart contract that automatically pays a crowd funded project if and only if it meets a threshold for pledges by a deadline, and refunds the donors otherwise).
But suppose our contract is something like I will pay you $X in Ethereum when you deliver to me 125 bales of Surat cotton, guaranteed to be middling fair merchant's Dhollorah [1], delivered at the Liverpool docks from Bombay on the next sailing of the Peerless.
How do we put all of that into a smart contract? Can a smart contract trigger payment only when the cotton arrives? Can it check to make sure it arrived on the ship specified in the contract?
And what happens if it turns out that there are two ships named Peerless, unrelated to each other, one of which is sailing from Bombay to Liverpool in October, and one in December? I only know about the December one, and it is on that one that I'm expecting the cotton. You only know about the October one, and so it is on that one you send the cotton. The cotton arrives before I'm ready to deal with.
Unless dealing with all that can be included in the smart contract, and executed by the smart contract without human intervention, lawyers will still be needed...and they will be needed almost as much as they are now.
PS: my cotton hypothetical is based on a real case: Raffles v Wichelhaus, EWHC Exch J19, (1864) 2 Hurl & C 906. There really were two unrelated ships both having and neither deserving the name Peerless, and both working the India / England trade routes, both scheduled for Bombay to Liverpool, one in October and one in December.
[1] Dhollorah is a very dirty cotton of a longish staple, which when cleared is very white, as if bleached. For for more than you probably ever wanted to know on this and other types of cotton, see the book "Cotton Spinning and Weaving: A Practical and Theoretical Treatise" by Herbert Edward Walmsley, page 71. It's from the late 19th century and is public domain now I believe, and you can find it on Google Books.
They can't deal with the real world by themselves, but where they have value in agreements involving real world events is that they allow the real world assessments to be debundled from those aspects of the agreement that can be formalized.
So in the cotton shipment example, the smart contract would have three parties assigned as Oracles that determine whether the correct ship arrives at the correct port on its correct trip. The smart contract would dictate that if 2 out of 3 of the Oracles agree that the condition has been met, then the smart contract will transfer the funds. There could also be a failsafe clause in the smart contract, that is controlled by a set of five oracles, who have the power to override the smart contract if the majority deem that an expected event occurred.
So yes you need human intervention, but only for those parts that cannot be automated. This explicit definition of what the human roles are may encourage better contracts, by forcing the counterparties to spend more time reasoning about which aspects of the smart contract are subject to ambiguity.
I've not worked with smart contracts personally, so take it with a grain of salt, but...
This problem seems to be mostly solved by the information available in shipping manifests; the locations of loading and unloading, the consignee (buyer), container ids, description of goods... all there in a publicly available (at cost) record.
The real difficulty has more to do with verifying the quality - I'll admit I'm at a loss to how that's done today and I can't imagine quality assessors are at the port to verify that container #123 contains the shipment of Grade B+ cotton or map that to an API. As well, what happens when you disagree and your own independent assessor says its Grade B-? This seems like something that would remain up to legal debate; probably denoted in the contract but not verified by it such that lawyers and assessors can handle it should problems arise.
Just my two cents.
Sir that is a prejudicial statement and I want it stricken from the record.
So I feel obligated to post the full bit (from wikiquote)
>Wonka: [angrily] Wrong, sir! Wrong! Under section 37B of the contract signed by him, it states quite clearly that all offers shall become null and void if - and you can read it for yourself in this photostatic copy - "I, the undersigned, shall forfeit all rights, privileges, and licenses herein and herein contained," et cetera, et cetera... "Fax mentis, incendium gloria cultum," et cetera, et cetera... Memo bis punitor delicatum! It's all there! Black and white, clear as crystal! You stole Fizzy-Lifting Drinks! You bumped into the ceiling, which now has to be washed and sterilized, so you get... NOTHING!!! You lose! GOOD DAY, SIR! [returns to work]
One of the things that cyberpunks fail to grasp is that people don't want a perfectly immutable, fixed system. They want to feel that their sense of justice and moral righteousness can be satisfied. Stuff that drops people off right at "sucks to be you" doesn't really work; there must be some type of recourse available even if it doesn't have a 100% success rate.
Specifically, in the DAO hack, the affected people had enough political influence to get the entire network to undo the ownership transfer that was the result of their own oversights:
https://www.reddit.com/r/ethereumfraud/comments/6bgvqv/faq_w...
If anything, Ethereum is worse because you have to get the entire network to fork (analogous to a revolution or constitutional convention) to fix a mistake, instead of just getting a judge to rule "okay, that's obviously not what anyone meant".
Furthermore, it's far more unequal, where mistakes only get fixed when they affect the most influential users. Seems like a step in the wrong direction.
For all its warts, a legal system backed by a jury of your peers is still the best way of sorting out the actual intent of a contract when the shit hits the fan.
A system of laws devoid of all ambiguity and emotion isn't even possible, let alone desirable, because at some point these contracts have to come into contact reality, and the humans in it. And these humans happen to be, well: human.
I guess there's an ideology at play that would love to change humans to fit within their neatly arranged algorithms. And if that means some grandmother loses her house because she signed the wrong smart contract when buying cat-food, there'd be a lot expressions of sympathy on Twitter, but she really needs to understand that it's just not possible to do anything about, because principles etc etc.
Here and there, some of these people may, very privately, consider it a feature of the system that others less intelligent than them sometimes happen to die on the streets because of that one Saturday morning where they didn't audit all 500k lines of brainfuck in that contract for chinese takeout.
With less snark: the idea of ambiguity or emotions as being something negative is a somewhat naive view of reality, somewhere on the spectrum between Star Trek's ideal of Spock and the social darwinism of Ayn Rand. It's most often seen in the currently popular misunderstanding of how judges should behave, and how journalism supposedly used to work.
For an example that maybe is a bit less inflammatory than anything about journalism, check any recent threat about the Google vs Uber lawsuit: the presiding judge is almost a legend for his diligence in learning the technology in the Oracle vs. Google lawsuit a few years back. Yet people criticise him for a lack of decorum whenever he uses language that doesn't pretend to be a robot following an algorithm: "This judge is clearly biased! The contract clearly only says $50,000, and there's no law that gives him the authority to say those are USD. When the defendant says it means Canadian Dollars, it's he-said-she-said and undecidable"
Some people do.
Source: I am a person who wants this.
[1] https://www.bloomberg.com/view/articles/2016-06-17/blockchai...
But I think of this issue in slightly different terms that are more simple.
There's a ton of case law about what constitutes a contract that pretty much all countries have. Clearly understanding the contract you are getting into is a prerequisite for the contract being enforceable in most places.
The simple fact is that this is never going to hold up in court when people start suing.
No one gets into a contract with the understanding that they can be robbed, and that's just okay. No rational person would do that. And I think it's a fair case to say that no rational person did clearly understand the contract as presented and agree to it.
The courts are going to to shut this down, in my opinion.
You can't just write into a contract that you might get stolen from or murdered or whatever bad thing and then that bad thing is suddenly okay.
"Okay, this guy didn't read the fine print on that used car loan. Let's go rape his wife and kids now. He said it was okay!"
That's not how it works. Etherium deserves to get hammered for this.
Facepalm
Wasn't this lesson learned long ago? C# defaults to private on unmarked members. Why would you ever want to default public?
Calling initwallet: https://etherscan.io/tx/0xff261a49c61861884d0509dac46ed67577...
Executing: https://etherscan.io/tx/0x0e0d16475d2ac6a4802437a35a21776e5c...
What kind of brain-dead apes designed this language? This would be a stupid decision in any language, never mind one specifically intended for high-value transactions.
The problem with cryptocurrency is that they try to be better than the system, but have to relearn all the lessons the hard way. It probably won't take too long before all of it becomes exactly like what banks are now - heavily regulated, etc.
parity.io, the company author of the bug, is a top-notch Ethereum actor. If they can neither get a wallet contract right, nor realise that it's faulty, then who can write and trust any non-trivial Ethereum contract?
How many DAO or Parity trainwrecks before people admit that Ethereum isn't a dependable platform?
ETH and ETC have the same underlying technology and language to write the contracts. So if someone writes a contract it can be used in both variants. The contract may check that it is in ETH or ETC (probably looking for the contract that was added during the fork) but I think very few contracts check this, so almost all contracts are usable in both chains.
So if it was possible to use the Parity contract in ETH, then it's very probable that it was also possible to use it in ETC.
To answer your question: Probably the same bug that was used to steal ETH can be exploited to steal ETC, if someone is using these contracts in the ETC chain. But it's not a problem in ETH or ETC [1].
[1] As other commenters noted, it's a very bad design flaw to make all function public by default. It's not an error, but it makes much easier to write buggy code.
[Ethereum] only makes sense if all of the following obtain:
(a) the code is 100% bug-free (b/c accidents cannot be rewound)
(b) all code-writers are 100% honest (their code does what they say)
(c) all contract participants are 100% perfect code readers (so as to not enter into fraudulent contracts)
(Strictly speaking, only one of (b) and (c) needs to be true).
None of these conditions will ever obtain.
As a contract becomes more important it should be viewed/vetted/trusted by as many entities as possible. Users of the contract should pay an insurance fee that goes to the vetters, who promise to reimburse in case of unpredictable behavior.
Yes, this means applying some meatspace solutions to Ether. However the smart contract infrastructure itself is ideal for implementing this. Ethereum offers immutability, and blockchains can foster new kinds of trust, but trust still has to grow organically in the ecosystem.
Money is a social technology that solves a social problem. Cryptocurrency is a engineering technology in search of a problem to solve.
Unexpected downsides for whom? Smart contracts cease to be smart if we have to rely not on the VM but on a small group of human overlords.
If a smart contract exists and you don't know clearly how many times it has been used and what percentage of the parties who used it are pleased with its functioning, you really should not use it unless you feel comfortable personally reviewing the code.
If you need a source of trust outside of the blockchain, why would you need the blockchain after such trust has been obtained?
The blockchain offers characteristics (immutability, consensus, distributed backup) that allows entities to trust each other efficiently.
But when you introduce a non-trivial smart contract, there is a chance that it (a black box) has behavior that is not obvious from its source code.
Since the behavior of the contract will cause immutable changes to the blockchain, and since humans can't perfectly mentally model all conceivable source code behaviors and interactions, there must be some other mechanism for establishing that the behavior of the contract matches the common understanding of what the contract does.
This could be sandbox testing, parameter range verification, formal verification, star ratings, etc. As the would-be user of a contract I generally want some reason to trust it.
Ethereum offers the building blocks to create an elaborate vetting, verification, simulation, etc. system. Thusfar, existing institutions have leveraged their own reputations to make users of Ethereum comfortable trusting their contracts. The DAO is an example of the folly of this, but many other contracts are examples of the reasonableness of it.
Over time, Ethereum will build the right meta building blocks to create very rich trust mechanisms which put the meatspace hedging/insurance industry to shame while also shedding much of the inefficiency that ambiguous legal enforcement creates.
When the proponents of this service are claiming that you don't have to trust the hospital that they would get someone to triage you, instead you can have your own assigned triage Nurse, you're claiming "But you still have to trust that this third party agency will have someone on the remote location to triage you, then what's the point of using this service?"
Why not just use a traditional financial institution then? What's the benefit of the complexity of a blockchain if it's still unreliable without the added meatspace complexity of a bank?
Insurance via smart contracts is still far simpler and more efficient to implement than in meatspace.
Consider things like insurer solvency risk and the way that meatspace regulations make that hard to understand. With cryptocurrencies an insurer can easily offer proof of solvency based on all outstanding risks.
Insurance emerges as a fundamental economic behavior when you have investment and you have an uncertain future. There is benefit to risk pooling. Since most of us live in the first world where the traditional financial system has evolved ample insurance infrastructure, we don't always realize how remarkable it is, or how vulnerable we are to bad regulation of it.
> The crypto currency space is currently so fraught with fraud and crime
The lack of KYC requirements has led to some criminals using cryptocurrencies, but BTC is fully public and so money laundering, counterfeiting, and tax evasion both go away when we move to a public blockchain.
Those three crimes are all so much bigger and more costly to society than the petty crime that has fled KYC to use the blockchain that I think the truth is the opposite of your insinuation.
Which would make such contracts significantly more expensive than regular contracts that are reversible by trusted intermediaries and legal authorities.
Paying out insurance claims is much more expensive than simply reversing a transaction. This is part of the reason Bitcoin never took off as an alternative to credit cards. Consumer protections are much more expensive to wrap around immutable transactions.
You assert this but don't offer proof. The cost of fraud is baked into all areas of our economic system to the point where it's very difficult to establish how much it is costing society. Arguably the massive innovations in counterfeiting prevention in the past decades indicate that counterfeiting is a major problem. Money laundering and tax evasion are the other big crimes that impose significant social cost which public blockchain systems solve beautifully.
The larger a percentage of the economy that is transacted via a public blockchain, the less opportunity for all sorts of crime. The existence of the "trusted intermediaries and legal authorities" as well as the elaborate enforcement mechanisms that accompany them, are themselves a cost.
> This is part of the reason Bitcoin never took off as an alternative to credit cards
This does not make sense as Bitcoin is not a mechanism for extending consumer credit.
> Consumer protections are much more expensive to wrap around immutable transactions
Protections against what? Confusing interest rate terms or cards sold to college students? Bankruptcy or minimum payment rules? All these sorts of things would apply equally to a credit card denominated in BTC so I'm not sure what you mean.
Of course, the code is deterministic and so the behavior was unambiguously defined in the contract's source code.
But there exist all sorts of semantic bugs, which can at times be pretty subtle, which means that even for an expert, the mental model of code execution may not match reality.
If there were nondeterministic behavior in the Ethereum VM that would necessitate a fix to the VM and would likely be completely uncontroversial.
Does that argument still hold up if you're going to have human insurance and human arbitration?
I think it does. You don't need human arbitration, but there are so many cases where having it makes people more likely to transact.
Similarly, a hotel can put up a rack with brochures in the lobby, or can hire a concierge to smile and interact with guests as they walk by. The purpose of the concierge is to create more transactions than would have happened with a rack of brochures.
As for the question in the previous thread, I'm not sure if it's worth the energy expenditure or not, but predictions are that energy will cease to be scarce by 2030 or so.
We're basically in no true Scotsman territory here.
In a group of actors, trust is a good thing. It benefits everyone, and everyone has an incentive to foster its development.
In meatspace systems we rely on things like identity verification (id cards, green bar certs, fingerprints, retinal scans, etc.), reputation by affiliation (resumes, schools attended, firms worked for) and and testimonials from others we trust.
The key aspect of the above is that we don't have to trust any of those signals perfectly in order for it to be of some benefit. If I find out someone went to Harvard, is followed on Twitter by Marc Andreessen, has had five commits accepted by Linus, has a credit score of 675, uses Android, has bad breath, etc., I will take each of those signals as some indication of her credibility on various issues and formulate my meta-opinion about how/whether to trust her based on some heuristic.
When I order from a seller on Amazon with very few stars I take a similar risk, yet once in a while I do so. Some fraud is taking place on Amazon but on balance the system gets more trustworthy every day.
1) moral hazard/information assymetry - If I insure you against fraud I have removed most of your financial incentive to protect yourself, so I need to have some other reason to think that you will. I also need protection against the fact that you have more information than I have about the risk of fraud (how do I know you won't collude with the fraudster, in effect defraud yourself and collect on the insurance?) In the normal world this category of concerns prevents lots of types of risks from being insurable, and we have criminal law to protect against collusion 2) Capital commitment - It's not sufficient to just get a promise from the vetters, the capital has to be committed (ie escrowed in some way) otherwise how do I (as an insured party) know they will make good on their payment when I need them to? As an insured party I have to be able to verify that you have done this. In the normal world, this is handled by regulatory capital guidelines for insurers and counterparty collateral posting in the world of OTC contracts. 3) Network effects - If I have capital in escrow, the contracts protecting that escrow would presumably themselves become extremely high-value targets for fraud. Can they be insured? How would you know that the capital is committed to pay out on these insurance contracts? Escrow again? This is a very significant bootstrapping problem - how do I as a participant somewhere in this chain know that in the last resort my insurance will be able to pay out so that if need by I can make good on my commitments. In the normal world this is handled by central counterparties demanding collateral posting against open contracts.
It's very tempting for engineering/technical people to assume that even though they don't really understand all the details, everything has an engineering/technical solution that would be so much better than what has been developed by their predecessors. This disruptor's hubris is necessary for progress to be made against very hard problems otherwise they would probably be to daunting to tackle.
Trust in the existing contract law system has grown organically over a very long period of time. Some of the smartest people going are lawyers and they've had a significant head start on these problems. It would be pretty difficult for trust to evolve organically given some of the poor decisions and scale of subsequent fraud that has already happened in the "smart" contract world.
You point out the non-trivial nature of building a system like we have today. I'd argue that Ethereum, with smart contracts and an immutable public blockchain is a useful innovation that I consider a useful building block for creating and improving the kinds of institutional relationships and interactions that you describe.
A system of insurance implemented on Ethereum would need to have the same sorts of moving parts that you describe. Ethereum would make some aspects of this harder and others far easier.
There would still be a need for collateral, escrow, etc. My comments are not meant to argue that these mechanisms become useless, they simply become more transparent and when viewed in terms of the rule of law, become significantly more resilient when markets become politicized and the rule of law is in danger of breaking down.
Things that would potentially be far easier in an Ethereum based system would be:
- assessing/auditing the books of an entity. Things like proof of solvency become much easier, and also looking at assets which are accounts receivable that depend on another entity's solvency. The modern financial system has very course-grained and inadequate ways of looking at this sort of systemic risk, which makes cascading firm failures truly devastating and nearly impossible to insure against, since any cascading firm failure will involve many ad-hoc regulatory interventions and rule changes that essentially nullify a large number of pre-existing contracts/hedges that might have existed.
- forcing precise regulations. One of the pre-2008 meatspace glitches was the too-little-too-late regulatory decision to force firms to mark certain types of assets to market even if their accounting approach determined that doing so inflated or deflated their balance sheets incorrectly. With a public ledger it would be possible to easily test a new accounting rule's impact on a firm's financial statements.
If Ethereum becomes popular enough, one day the participants in an Ethereum contract are going to sue each other, and the judge is not going to be impressed by arguments that the contract is intended to be immutable. You can't opt out of contract law just by saying that you opt out of contract law.
In many cases I would assume the opposite will occur: plaintiffs will claim that there was no contract formation because because the technical mumbo-jumbo of computer code is incomprehensible to a layman.
I suspect that courts will react quite favorably to this argument seeing as how they have a natural interest in maintaining their jurisdiction.
Why give up those rights and let a computer program (or rather, it's creators) dictate that you're screwed if you make a mistake? I mean, contract law exists because that kind of strict arrangement proved unsatisfactory in real life in the past.
In that case the judge can't do shit.
If you want the protections of courts, there is already a perfectly easy way to do that. And that is to use a real contract.
But if you explicitly do NOT want that, and explicitly DO want code to be law, that is what ethereum is for.
a judge can't take away the crytocurrencies of some anonymous other party.
> In that case the judge can't do shit.
In the latter case, I'm pretty sure that (even leaving aside other mechanisms that might apply), judges and courts exist in Russia. Agreements where the parties are based indifferent countries have long been a thing, and long been enforceable by courts.
Unmasking anonymous parties, obviously, can be (though it is not always, even where it must be done) a prohibitive burden to legal action, OTOH.
Agreement is not the only prerequisite for a legally enforceable contract. The contract also needs to avoid certain unenforceable things like unconscionable clauses, or agreements to do things that are illegal.
Because the purpose of a judge is to interpret the law, not enforce Ethereum software invariants.
It just doesn't work like this.
But that's basically obvious to anyone not hinging their personal identities on peddling technocratic revolution.
Maybe you should replace the word "Ethereum" with "sotware". "Software in general makes sense is all the following are true"
Software in general doesn't exist in a vacuum - it's backed by all the centuries-old meatspace institutions like common law, courts, and lawyers that provide a recourse when something goes wrong. As I understand Ethereum's whole purpose is to replace a lot of these institutions with "smart contracts" (correct me if I'm wrong). If Ethereum has to rely on the same institutions as every other piece of software to deal with contract disputes isn't it just adding more complexity to transactions?
Now, I'm skeptical of Ethereum's suitability in this space - the design doesn't seem to be geared enough towards correctness. However, they've also done some things that I really like (e.g. rolling back The DAO), so I'm not counting them out just yet.
To clarify, my point isn't "software has bugs! don't trust it for anything". My point is "software has bugs! don't make it the forum of last resort for contractual disputes".
Let's say we have an uncertainty scale scored 1-100. If 100 is "money in a bank" and 1 is "money that's already been set aflame, but there's a cup of water nearby", I'd put Ethereum in the low single digits =)
These newfangled experiments that I don't fully understand are still well above 10 for me, but they only have to get down to around 11-15 before I'll be interested.
The theft wasn't due to an issue in the core protocol of Ethereum, it's due to faulty code in a single piece of software (as you can see throughout the rest of the thread).
It's a matter of poor engineering practices, not a flaw in the fundamentals of the protocol.
If an engineer designed a bridge, and it failed due to a flaw in the design -- say the math on a strut's angle was bad and the bridge collapsed causing millions in damages and took a few lives. Do you blame steel, all steel, and everybody who uses steel in construction as foolhardy? Or do you blame the engineer, the safety inspectors, and the company that oversaw the project?
True enough, but what the parent pointed out is that this class of problems is due to a flaw in the core concept of Ethereum - which is much worse than just a flaw in the protocol.
To extend your analogy - Ethereum is like if a company advocated for building bridges using a process that made the bridge's integrity unverifiable using traditional engineering means. Some bridges may hold up, some may fail, with no clear way to identify which bridges will do what.
Even so, any product designed for the network could be tested to death on any of the available testnets. It would be foolish not to ram any project up against everything in that environment, which is why I suggest poor practice as a primary cause.
It was an oversight, to be sure, and a major one. (that's not nearly strong enough language, but I want to be civil)
To use your analogy - I'd view the bridge design engineer as having guaranteed that the design process could not possibly result in construction of a bridge that fails. That seems closer to what Ethereum would have us believe.
A bridge design domain expert presumably understands: - that design process uses strut calculations (and therefore includes measures to guarantee those calculations can never be wrong); - that bridges may be built from steel (and therefore includes inspection routines that guarantee faulty steel can never be used); - that the environment acts on bridges through corrosion and earthquakes (and therefore includes routines that absolutely always preclude failures arising from the bridge's environment); - etc., etc., etc.
Maybe it's just my ignorance or misunderstanding of this domain, but I see Ethereum as naive in its guarantee of perfectly predictable behavior.
A guaranteed flawless protocol that fails (for whatever reason) when implemented in reality, isn't.
The engineer who wrote the contract appears to have made a critical logical error.
That does bring me to your conclusion, though. I've paid less attention to the marketing and promises and have assessed the technology as-is (within the confines of my knowledge) -- as such I see what's possible instead of seeing it as a product that under-delivers.
I wonder if a lot of people (especially on HN) would view it differently if it weren't for such bold claims on the developers' part. I mean, I think you're probably right in it being naive in its guarantee of predictability. I think any actors on the platform should assume its supposedly perfectly predictable behaviour is not quite so when they take to designing software or a contract. But that's part of what I meant when I've said it comes down to engineering practice -- when it comes to critical systems assumptions just shouldn't be made in young technology no matter what anybody tries to sell you.
So, yes, in reposting I generalized from "smart contracts are a bad idea" to "Ethereum is a bad idea". Considering how essential the smart contract is to essence of Ethereum, I feel comfortable making that generalization.
Side note: "the essence of ethereum" would make a great subtitle for Drakkar Noir.
Would you blame the the steel (or the concept of bridges in whole) for the Tacoma Narrows bridge waving in the wind?
[1] https://blog.ethereum.org/2016/06/17/critical-update-re-dao-...
- A hacker managed to exploit a ICO multisig wallet vulnerability and drain 44,055 ETH - $9,119,385 at present.
- A white hat showed up and "saved" 377,000 ETH - $78,039,000 !!! - by draining other accounts.
I get the "see cryptos are too insecure / it's a pyramid / it's a bubble / ICOs are scams / etc" arguments.
But holy shit turning a world currency into the wild west - for better or worse - is going to be disruptive, period.
That $10m out the window is like a Series A for a nefarious hacker with deep crypto skills, what does this success embolden or create?
I can only imagine the debacles that we have to look forward to, and I say that in full support of and as a long term believer in both blockchain and cryptocurrencies.
(1) https://press.swarm.city/parity-multisig-wallet-exploit-hits...
Where "deep crypto skills" refers to someone who bothered to read the documentation on Solidity (the Ethereum contract language), specifically the section on function visibility[1], and the Parity wallet contract itself[2].
In other words, an obscure security hole was not found by a genius hacker. An obvious, trivial, simple mistake was exploited for $9m because the people investing money in it provably didn't know what they're were doing.
[1] http://solidity.readthedocs.io/en/develop/contracts.html#vis...
[2] https://github.com/paritytech/parity/blob/4c32177ef3f4521c66...
Very true – the price hasn't really moved in response to this news, which makes very little sense to me. I'd be shorting if I could figure out how.
This was a third-party wallet. Everyone used it because everyone else used it. Exactly like Mt Gox. There was no reason to store coins on Mt Gox, just like there was no reason to use this wallet.
A moment's reflection would have prevented this foolish decision.
But the bug allowed any other address to add themselves as owners and withdraw from it.
Luckily not many people used it and the white hat was able to claim all the rest before anyone else.
So many things wrong about that, it's the cryptocurrency equivalent of installing random software packages on your critical servers.
About Parity
Parity's goal is to be the fastest, lightest, and most secure Ethereum client. We are developing Parity using the sophisticated and cutting-edge Rust programming language. Parity is licensed under the GPLv3, and can be used for all your Ethereum needs.
Parity comes with a built-in wallet.
How is this not a third-party wallet? They say right on the page that they're trying to be the best implementation of Ethereum. That means they're not the core implementation, right?
https://mobile.twitter.com/IamNomad/status/88777698177709261...
"incredible plot twist: whitehat hacker supposedly saved most tokens from being stolen using the same vuln."
https://mobile.twitter.com/bcrypt/status/887775417406431232?...
"Multisig wallets affected by this hack: - Edgeless Casino (@edgelessproject) - Swarm City (@swarmcitydapp) - æternity blockchain (@aetrnty)"
https://mobile.twitter.com/maraoz/status/887755889897295872?...
Any proof of this?
EDIT: This appears to be false. From https://blog.ethereum.org/2016/06/17/critical-update-re-dao-...
The leaked ether is in a child DAO at https://etherchain.org/account/0x304a554a310c7e546dfe434669c...
But that site shows the account hasn't received anything since July 8.
What?!? That seems like a pretty relaxed response for someone who just lost 8m dollars.
If the creator of Solidity, Gavin Wood, cannot write a secure multisig wallet in Solidity, pretty much confirms Ethereum is hacker paradise.
If you were the attacker and you now have the ETH in your wallet, how do you cash out without anyone identifying you and maximising your profits?
Also has the attacker broken a law by exploiting a bug in the contract?
Keep sending cash to bank accounts you have opened by depositing cash in person. Use round robin to distribute money across multiple of your hidden bank accounts so suspiciously large volumes of incoming money doesn't get noticed.
Keep moving around, mixing coins and using localbitcoins to get cash and deposit. Also diversify outside of cash to not raise suspicion of the banks by depositing every day / regularly.
Buy physical gold from pawn shops. Then you can turn gold into cash in banks and deposit it to your account like that. You can also use cash to buy prepaid travel debit cards with like 5k on them at a time from post offices or so. Use that for daily expenses.
That might work. If you are not a US citizen but let's say citizen of China that makes it easier to pull off.
Of course, getting that money back to US to your home bank account would be near impossible (without some way to launder the money).
But you could live off your hidden bank account in tax haven. Just don't flash your millions too publicly so people don't get suspicious. Be humble and pretend to live regular life.
Also you could try to launder the money via setting up some fake ICO project and investing your mixed coins into your own ICO, then cash out your custom tokens on exchanges. Just make sure to do this from some unregulated tax haven and it should work (most of these ICOs create their businesses in dodgy tax havens for this reason).
This is how I'd imagine these scammers are doing it.
Exchange to BTC, mix it, exchange to USD.
> Also has the attacker broken a law by exploiting a bug in the contract?
There are no laws. Only contracts.
You could use localbitcoins to offload one coin at a time on an as-needed basis. That'd be pretty sweet, and the IRS won't be able to know anything strange is happening if you avoid depositing your USD into a bank. But paying rent in all-cash is rather sketchy. I wonder if drug dealers deal with similar problems.
I don't know how plausible this is, but the localbitcoins route might also open you up to being kidnapped. You'd need some pretty decent opsec to avoid revealing that you have a massive amount of BTC you're trying to offload.
> And then the IRS will want to know where you are suddenly getting a huge amount of money from.
In my experience, the IRS is largely unconcerned with where you are getting money from. They just want you to declare it, and pay taxes on it.
If you treat Bitcoin as ordinary income and pay taxes on it at the highest available rate, the IRS will largely be satisfied. If you treat Bitcoin as a long term investment and attempt to only pay capital gains tax.... well then the IRS will become curious enough to ask for 'proof of origin'.
If the hacker was entitled to those funds based on the agreement between the concerned parties (implicit OR explicit in the contract) it would not be theft. But it clearly isn't their Ether and the implicit agreement behind the contract stands.
Basically human ethics, morals and the legal system will always trump code.
Importantly, the contract is not part of the Ethereum protocol, so other implementations and non-multi-sig Parity wallets are safe.
Safe from this bug, maybe. But there's nothing to say that they might not also have bugs of their own.
- Who's the "white hat group"? Why do people have confidence in it?
- Why does everyone believe they'll give back $75M+? If they decided to just keep it, what could anyone do?
- How will people even be able to claim ownership of the ETH in a way that's verifiable so they know they're giving it back to the right person?
They are just going to deploy new multi-sig contracts with a fix and make the original owners the owners of the new contracts. Pretty easy to do. They are actually paying for the gas to do the fix using donations they received for their work on The DAO attack so the original wallet owners aren't even out the gas the fix would charge (which isn't all that much but it's nice that they are being made completely whole).
It definitely is an uncanny read.
Vitalik on why there will be no hard fork for this: https://twitter.com/VitalikButerin/status/887783867129745412 (not to suggest that Vitalik can just decree there won't be one like some people think, he's just listing the reasons why the community is very unlikely to support a hard fork).
This means that ETH has no actual value. It adds nothing to the legal or economic landscape because it does nothing new (if we repeatedly rollback and hard fork because of "hacks" like this). This isn't a hack. This isn't theft. This is morons who don't know how to code coding in a crappy language meant to run on an even crappier VM. The only victims here are the people who were duped into investing in ETH in the first place. Poor saps.
To dispute that de-facto centralization requires miners to collectively decide to abstain from updates to these primary clients en masse. That just won't happen, people don't organize or coordinate like that. The status quo has tremendous inertia beyond what can be reasonably expected of independent actors trying to act in their own self interest.
Yeah, tell that to Bitcoin on August 1st.
If there is sufficient consensus among Ethereum users for a hard fork, then it can happen.
The law is written in code, and clearly code can be changed by human intervention. It's even open source, so technically anyone can change the Ethereum protocol, at any time.
Of course, changes to the law are effective only when there is overwhelming consensus, otherwise they're called minority forks.
Sure, the core team / devs are using the rollback for good. But will that always be the same in the future? It's an avenue for abuse and one of the primary reasons ether isn't going to take off.
Discontent users simply switch to a different branch maintained by different developers. If there's enough consensus, people will call it "real" blockchain and the other one will be left behind with few users and hence no meaningful way to spend the balances.
The same laws which apply to stealing tangible things and cash also apply to stealing cryptocurrency.
In the very unlikely event that the perpetrators came out and sued the Ethereum developers for violating their contract and taking "their" money back, a judge would look at the facts and then decide how the law applies to this particular case. IANAL, but I'm ready to bet that the thieves will go to jail for a while :-)
The explanation is a bit scary about what actually ended up in parity code:
The wallet contract forwards all unmatched function calls to the library using delegate call... This causes all public functions from the library to be callable by anyone, including initWallet, which can change the contract’s owners.
Edit: formatting
https://etherscan.io/address/0xb3764761e297d6f121e79c32a6582...
Looks like about +300,000 ether was able to be drained before it could be stolen thanks to a white hat group.
> Every single line in our codebase is fully reviewed by at least one expert developer (and routinely two or more) before being placed in the main repository. We strive for excellence; static code checking is used on every compile to cut out bad idioms. Style is enforced before any alteration may be made to the main repository. Continuous integration guarantees our codebase always compiles and tests always pass.
I guess I am just wondering how this contract can be updated, given its on the blockchain and considered immutable.
When it's about your money, you should be able to do all that.
And yes, Solidity is pretty horrible. I hope there will be better options such as Idris in the future.
In this case, by some stupid mistake the contract allowed anyone at all to change who was considered an owner of a wallet.
The code wasn't changed; one of the functions it specified was used to change a variable.
There is a catch-all [1] function in the public API (why???) of the wallet contract which uses delegatecall to delegate to the library class.
"In a similar way, the function delegatecall can be used: the difference is that only the code of the given address is used, all other aspects (storage, balance, ...) are taken from the current contract." [2] (again, WHY???)
So calling through this catch-all function the "internal" modifier on "initMultiowned" does apparently not prevent it from being called, since the delegation happens from a function inside Wallet.
So the "attack" is to just tell the wallet to reset its owners to myself. This would be so embarrassingly trivial, that it's more like picking the money up from the floor, than a "heist".
This wallet contract is insane and the programming language too. Why would a language for such a critical application have such super unsafe constructs? This can't be true. Please, serpent community, talk to your local PL people!
[0] https://github.com/paritytech/parity/pull/6103/files [1] https://github.com/paritytech/parity/blob/02d462e2636f1898df... [2] https://solidity.readthedocs.io/en/develop/types.html#addres... [3] https://github.com/paritytech/parity/blob/02d462e2636f1898df...
Nah, Vitalik is not affected by the bug this time. You only hard fork, when your money are stolen.
This is completely incorrect.
A hard fork can undo anything, it's just backing up before this happened and continuing down another path as if it didn't.
There was no such twist this time around which means the funds could already have been transferred to an exchange and withdrawn as dollars or BTC. You can only undo the ETH part of the transaction, which would take money away from the exchange (or from people who have since bought the stolen coins from the exchange unknowningly) and give it back to the victim. That's a lot less palatable than taking the money from the thief, so it's unlikely to happen.
https://twitter.com/VitalikButerin/status/887782650026631168
Seems like having this complex logic on-chain is asking for it to be exploited.
- https://ericrafaloff.com/parity-multi-sig-contract-vulnerabi...
- https://ericrafaloff.com/analyzing-the-erc20-short-address-a...
I think at least a big part of the solution to these security problems is two-fold:
- More secure conventions. All of the gotchas in Solidity make for a bad time. Even non-security bugs create a bad developer experience. Opting into private functions by default
- More code review. Engineers need to be diligent or hire security professionals who are (I'm one).
The practical challenges to tracking hackers or 'hackers' stealing digital currency mean you don't see regular prosecutions, but the ease of getting away with it shouldn't imply legality.
$30M worth of BAT, $26M ICONOMI, $17M CFI, $1.4M EOS
historic episode here which is sure to spur many a conversation about what disclosure means in the blockchain era.
There is a paper[1] written by some researchers on how using a more powerful language (Such as Idris) could prevent a whole category of errors in smart contracts development, but it doesn't necessary talk about formal verification of smart contracts.
1. https://publications.lib.chalmers.se/records/fulltext/234939...
- The vulnerability is in Parity's "enhanced" multi-sig contract
- This affects Parity 1.5 and later
- Parity 1.5 was released on January 19, 2017 (have you created multi-sigs in Parity since then?)
- The canonical multi-sig contract used in Mist / Ethereum Wallet does NOT have this vulnerability
- 0x1db is a community "white hat" sweep effort and not an attacker (See: https://etherscan.io/address/0x1dba1131000664b884a1ba2384641... )
Parity bug: https://github.com/paritytech/parity/pull/6102
If people are interested, it's on Amazon: http://amzn.to/2trOjJS (I have no financial interest in it, but I bet a lot of people in this thread would enjoy reading it and/or writing long diatribes on why he is wrong about everything in it.)
Ask me anything ;-) I have, like, a whole chapter about smart contracts which answers everything about this latest disaster. The idea is that it will be a handy rhetorical ammo dump for when someone asks you about those blockchain things and why the business needs them ...
During the DAO hack, the funds were prevented from moving anywhere so a hard fork caused a direct reversal.
That's my understanding, anyway.
If anything, it shows there needs to be a better process for peer review and some defaults in Solidity should be changed for security.
Hopefully the ethereum foundation takes note because this problem is not going away, and they are responsible for 20B$ market cap of value. I realise that ethereum is still young but they have chosen to build a product that can be used in a multitude of ways without enough thought about how to keep the value secure. I wouldn't even know where to start when deciding whether it's safe to use a smart contract, and I understand the concepts well. If ethereum is ever going to grow into it's current market cap if will have to be safer for use by everybody.
https://etherscan.io/address/0x1dba1131000664b884a1ba2384641...
Why is there no "pen-test" phase to any crytocurrency which hits the market.
So, let me understand; you're ostensibly smart enough to (perhaps as a body of contributors, even) develop a cryptocurrency offering - yet youre also fucking stupid enough to not have same/wider network of ppl attempt to hack the fuck out of your plan?
Does this already occur? or some savant comes and owns them?
We have fucking HIPPA FFS and the compliance systems for something as trivial as my stupid name.
so; ELI5: WTF are currencies doing/not-doing which allow for such hacks (1) and allow for exploits to go unseen (2)
It's more like a company's open source software allowing somebody to steal your bank password. It doesn't have anything to do with USD or the Fed, or even the bank's larger practices. It has to do with how negligent they were with regard to a particular feature.
Each of these situations is a painful learning experience, but moves the platform forward.
I remember it as "hippo", or "H-I-P-P-Oh darn, I spelled it wrong again!"
Sounds like this is all probably dot com bullshit, but maybe something genius will come out of it that is unforeseen now.
I use Parity, I have a wallet contract deployed, it's night and I'm wearing sunglasses.
Anyway, your theory is much better than mine.
30 million is enough for a small group of hackers to live comfortably for the rest of their lives.
The page linked to here is the blockchain address of whoever exploited that fault and was able to take control of a large number of wallets and forward all of the ETH to their account.
They've sold ~20 ETH so far (~4100 USD), and have ~150,000 sitting at that address still.
Edit: Without Vitalik or a hard fork.
On the plus side, Bitcoin popcorn futures continue their steady progress up and to the right.