Live data from Hacker News

Learn Ethereum smart contract programming

ethereumdev.io

71–80 of 244 posts

Re: Learn Ethereum smart contract programming

#71
post #22

Earlier quoted context omitted.

Not that I have mathematical proof, but I'd be happy to bet that the chance of buggy code being written is higher than the risks you outlined above :)

Everyone chooses risks that they take, and consider whether there exists enough benefits for the risks. It makes sense to take calculated risks. I'm opposing the viewpoint "there exist risks, therefore it shouldn't not be considered at all".

Come on, people are not saying that "risks exist", they are saying that the risks are very very likely.

It's a near certainty that I won't get hit by a car tomorrow - people do get hit by a cars but most people don't get hit by cars most of the time. There is a risk (a fraction of percent), but it's acceptable.

It's an even larger certainty that code will have bugs. As far as I've seen, all code will have bugs, as experience shows, even security oriented code carefully made and reviewed by experts tends to have bugs, but it is possible (though not as likely) that a small piece of carefully audited code will be bug-free. That's a bit different than the risk of getting hit by a car; it might be more fair to say that you have a "risk" of being bug-free comparable to the "risk" of winning a lottery.

Re: Learn Ethereum smart contract programming

#72

I know this might sound like a joke, but it is not: how about documenting how to actually test and debug smart contracts? Is there even a way to do so? How about fuzzying?

The best tool for debugging is http://remix.ethereum.org/. It lets you step through the compiled EVM bytecode, while highlighting the solidity source mapping.

Re: Learn Ethereum smart contract programming

#73

Earlier quoted context omitted.

Judging by the frequency which which catastrophic bugs seem to appear within smart contracts, it appears that most users of the platform also don't grok the complexity of the Ethereum network and it's vulnerability to bugs. This argument can get dangerously close to 'clever people have invested a lot of time and effort into this, so you should either invest the same amount of time and effort or trust that the whole t…

It's true that abstractions require trust. Have you flown anywhere lately? Inspected the plane before you took off? It's true for the risk you take you must be assured that engineers are making things safe. Lots of planes crashed before we got to the incredible safety record we have today, which is paid for by people having trust in airlines, who employ competent engineers. The only difference here is that the organi…

> Lots of planes crashed before we got to the incredible safety record we have today, which is paid for by people having trust in airlines, who employ competent engineers.

> The only difference here is that the organisation is a decentralised one. The engineers are not paid but are incentivised by the network.

ETH Engineers are also disincentivized from refactoring code / doing CD, as they have to pay a fee for every deploy. I'd imagine that the safety record for airlines would not look as it is today if engineers had to pay a small fee for every safety modification they wished to make.

The analogy with airlines is also faulty. There is no real financial incentive for a bad actor to find a software bug that is capable of crashing an airliner. There's nothing financially they can gain out of it. However, with the amount of money bound up in the ETH network even currently, any bug found by a bad actor could potentially land millions of dollars. Almost any amount of time spent pen-testing is trivial compared to that, so you will find a lot of bad actors actively seeking to find software vulnerabilities.

Re: Learn Ethereum smart contract programming

#74
post #30

Earlier quoted context omitted.

You know Bitcoin is useful. One of the useful things in Bitcoin is that you can make a transaction conditional on a multiparty approval ("multisig"). This is used by many organizations to control funds in a safe way. Ethereum lets you construct even more interesting types of transactions. For example you can easily implement the logic of a crowdfunding (unless X is raised by time Y everyone is refunded). In that cont…

Ok but that raises a lot of technical questions. Do I myself host that logic or is the logic itself distributed? While creating a crowdfunding contract, I am the host in my mind so assuming that the smart contract is hosted on my machines this must mean that when people are sending Ethereum to my wallet the logic does it's thing? Another version of that could be that the logic is sent out to all interested peers and…

When you write a smart contract, the natural route is to deploy it into the Ethereum public network. Otherwise, your contract is only accessible to your own private channel and uses your own tokens (as opposed to Ether), etc.

Some clarifications: Ethereum = the project or the foundation itself Ether = unit of (crypto)currency used in Ethereum

Re: Learn Ethereum smart contract programming

#75
post #30

The problem I see with Ethereum is that it is way too complex. I have read perhaps at least 10 times on their home page without even understanding what it does, what problems it solves etc. This is the sole reason why I don't think it will be successful in it's current state. With most successful tech or services or whatever the core idea is often super simple to grasp and you can instantly see the benefit. I don't s…

You know Bitcoin is useful. One of the useful things in Bitcoin is that you can make a transaction conditional on a multiparty approval ("multisig"). This is used by many organizations to control funds in a safe way. Ethereum lets you construct even more interesting types of transactions. For example you can easily implement the logic of a crowdfunding (unless X is raised by time Y everyone is refunded). In that cont…

> In that context, "smart contract" is just a way of saying that you're not relying on the promise of a third party to perform the refund—it's automatic

What if the code is malicious, and instead of auto refund it steals the money? I mean, not everyone would read the code to see what it really does, so what happens in that case?

Re: Learn Ethereum smart contract programming

#76
post #61

Earlier quoted context omitted.

Sorry for being so uninformed but what happens if there is an error in the logic? Doesn't that mean that it's not possible to update the smart contract?

>what happens if there is an error in the logic? If you are a big name in the Ethereum community, they will soft fork Ethereum so that your mistake is rolled back.

That isn’t true. Nowadays you can’t fork Ethereum like that by fear of losing legitimate transactions.

Re: Learn Ethereum smart contract programming

#77
post #41

Earlier quoted context omitted.

The logic exists on the block chain. It is executed on each and every machine that follows the chain. This is how executions are verified, 'everyone' has to agree on the outcome.

Sorry for being so uninformed but what happens if there is an error in the logic? Doesn't that mean that it's not possible to update the smart contract?

There have already been multiple incidents involving bugs in "smart contract" code being exploited to steal funds, one within the past few days[1]. A particularly nasty case involved something called "the DAO", which was an attempt to do something like a distributed VC fund, but had a bug which allowed any participant to steal all funds contributed. That one got backed out by a hard fork of the Ethereum blockchain, but that's obviously not a stable or scalable solution to dealing with these types of situations going forward.

[1] https://www.theregister.co.uk/2017/07/20/us30_million_below_...

Re: Learn Ethereum smart contract programming

#78
post #68

Programmable smart contracts are a great idea in a world where programmers write bug free code. That world does not exist yet. Until we have near-perfect code writing AIs every new smart contract is just a disaster waiting to happen.

It's possible to write provably correct code, though. At least then you reduce the problem to the issue of correctly specifying what the code is supposed to do. Certain classes of contracts might be small enough to do that. Granted, the requirement for NASA-level code correctness would make smart contracts expensive to develop and put them out of reach of average developers.

> issue of correctly specifying what the code is supposed to do.

also the intent of the programmer, right?

Re: Learn Ethereum smart contract programming

#79

I took a glance at the lottery example [1] and I wonder: isn't the owner of the lottery able to change the outcome so the winningNumber is always in his favor? [1]: https://ethereumdev.io/managing-multiple-users-a-simple-lott...

the lottery code is so broken it isn't even funny. actually it is hilarious! the first bet will almost always win, especially if it's a very small bet!

Re: Learn Ethereum smart contract programming

#80

The problem I see with Ethereum is that it is way too complex. I have read perhaps at least 10 times on their home page without even understanding what it does, what problems it solves etc. This is the sole reason why I don't think it will be successful in it's current state. With most successful tech or services or whatever the core idea is often super simple to grasp and you can instantly see the benefit. I don't s…

The big thing that helped me was to understand that: smart contract == program stored on the blockchain

The blockchain tracks the program's state and handles state transitions. Read-only functions are free to execute; functions that alter the program's state cost Ethereum to run.

That's it. It's quite powerful and conceptually simple, but the phrase "smart contract" seems to throw a lot of people off.

Post reply on HN