Smart contracts

  • area_pol

    Ethereum is a crypto-currency project which supports autonomous contracts (programs running in some decentralized way in the network).

    DAO is one of such contracts and many people put money in is, such that it was estimated to hold millions of $. And today an exploit was found in the contract, allowing someone to start taking that money away: DAO vulnerability.

    That is hardly an unexpected result, but I looked at the Ethereum contract programming, and there is a big WTF to be found here.

    It turns out that the contracts are created using a simple imperative programming language (example). I think this is a terrible idea:

    • Programming a reliable distributed system this way is extremely difficult - as demonstrated by the devs themselves in an article about numerous potential mistakes in a simple auction contract
    • Mistakes lead to exploits, as demonstrated by DAO
    • Code (of this kind) is a terrible way of conveying meaning. How are we to trust a contract with our money, if the only thing we see is this low level code? It is not clear what it does, it may have bugs, and even may be malicious. And the users will not audit the contracts anyway - so is this a platform built specifically for scamming?
    contract auction {
      address highestBidder;
      uint highestBid;
      function bid() {
        if (msg.value < highestBid) throw;
        if (highestBidder != 0)
          highestBidder.send(highestBid); // refund previous bidder
        highestBidder = msg.sender;
        highestBid = msg.value;

    I would expect a smart contract system to be built of high-level blocks which clearly communicate its purpose and rules.
    The whole auction process would be a single block with the resource being sold declared upfront. Other blocks could be a majority vote or exchanging tokens-type-A into tokens-type-B as rate R.

    To sum up, the contracts in their current state are impossible to properly evaluate and any participant would have to trust in their developers' honesty and programming skills.

  • You would think that at the very least this Smart Contract nonsense would support rolling back all effects of an execution if it fails somewhere.

  • @Adynathos You're not even mentioning the BIGGEST WTF:

    Despite DAO's promises to never interfere with contracts, (many of) the people in charge of Ethereum currency are planning to modify the crypto currency client itself to prevent the person who stole this money from ever spending it.

    So, the whole point of the computerized contracts is that the whole thing runs with no human intervention, no special favors, no standing in front of judges, etc. But the first time they find a bug? All that goes out the window.

  • area_pol

    @blakeyrat It would be funny if majority of miners decide to decline this change, but I guess the devs will sneak it in as a regular update.

    This whole thing has the feeling of sci-fi hacking: "the hacker is draining our accounts, but we cannot shut down his access".

  • @Adynathos said in Smart contracts:

    @blakeyrat It would be funny if majority of miners decide to decline this change, but I guess the devs will sneak it in as a regular update.

    This whole thing has the feeling of sci-fi hacking: "the hacker is draining our accounts, but we cannot shut down his access".

    They can stop it by correcting their contract.

    But I was reading up in Scanning Live Ethereum Contracts for the "Unchecked-Send" Bug (which is linked from the DAO vulnerability link) and found this:

    Upon inspection, *not one of the Solidity programs that passed our heuristic check actually applied the recommended best-practice of testing the callstack directly.*

    When there are, for example, 5% of the contracts that have a problem then that's clumsy programmers. When none of the programmers can get it right, that's a system architecture issue: they are expecting the programmers to correct for an architecture deficiency; which is hard, so no one does it.

  • @blakeyrat Anarcho-capitalists are like that, governments are bad until someone tricks them out of their money, then obviously it's completely different.

  • area_pol

    @BatConley said in Smart contracts:

    When none of the programmers can get it right, that's a system architecture issue

    This Solidity language is terrible for writing reliable programs or understanding existing programs.
    They commited all this effort towards the infrastructure for running the contracts, but spare no thought about how the contracts themselves will look like?

    The problem with existing non-smart contracts is the lack of clarity, possibility of including "fine print" terms.
    Making that obfuscation even easier with inscrutable code is a step backwards.

    The progress would be carefully creating default contracts (or construction blocks) that represent the intent of the contract.
    If you want to sell stuff, make the [default sell contract] and the customers know what it means. If you use a non-standard contract, it is a sign that something is wrong.

    And if - like in this situation - a bug is found in one of the standard contracts, an update that fixes the exploit is easy to justify: the code is fixed to match the designed intent of the contract. Because everyone agrees on the intent on the contract - the code behind is just the implementation detail.

  • @Adynathos Sounds like a bunch of amateurs tried to write their own programming language without bothering to do any research on the topic.

    Cryptocurrencies have some very promising concepts but sadly they are still subject to Sturgeon's law. 90% of them are shit (and that's if you don't count the literally thousands of pre-mined, pump-and-dump bitcoin clones).

    Ripple sounded so promising though, did it ever go anywhere?

  • area_pol

    @anonymous234 said in Smart contracts:

    Cryptocurrencies have some very promising concepts

    I find the smart contracts much more interesting than bitcoins, because - if done well - they could be used to make processes like public voting secure and open to audit.

  • @Adynathos There are two things that I want to have:

    • Secure online voting
    • Some kind of anti-spam mechanism. If you think about it, the hard problem that Bitcoin solved was how to create "digital scarcity", i.e. a virtual "token" that has a limited supply, without needing a trusted 3rd party. This lets you prevent Sybil attacks and implement internet-wide rate-limiting.
      And before someone points it out, yes, I know "require a micro-payment for each email" has been tried and failed many times, that still doesn't mean there's any inherent problem with the concept.

  • @anonymous234 said in Smart contracts:

    Secure online voting

    Hm. When I said that I got a bunch of people telling me how stupid online voting is and linking me to some video with a man with a banana-shaped head.

    I'm curious to see how they'll react to you saying it.

Log in to reply

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.