Live data from Hacker News

Learn Ethereum smart contract programming

ethereumdev.io

41–50 of 244 posts

Re: Learn Ethereum smart contract programming

#41
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…

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.

Re: Learn Ethereum smart contract programming

#42

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.

That's like saying legal contracts are a disaster because we do not live in an ideal world where lawyers don't do mistakes, and there are no legal loopholes. Granted, bugs are much more common than legal loopholes, but in the same way an operating system's APIs and constraints are tested until it becomes reliable enough for other people to rely on it, I can see some standard types of contracts (in the same way as in…

Most "real life" contracts have bugs too. The difference is: the visibility of these contracts is very limited such that these bugs cannot be exploited by random hackers. And any exploit can be challenged in court. Ethereum takes away both - opening you up to be challenge by everybody with no recourse.

Re: Learn Ethereum smart contract programming

#43
post #33

I didn't have high expectations for Solidity considering the recent vulnerabilities, but even these were disappointed. If some guy writes this kind of code at home, alright, but this as the alleged foundation for our future financial system? Frightening. Just one example: "Our function EndLottery() must be only accessible by the owner of the lottery." [0] function EndLottery() public { if (msg.sender == owner) { ...…

I understand the eth VM is pretty limited and limiting, but Solidity is just sad, it's like somebody saw Javascript and thought "ok that's a pretty terrible basis for writing contracts, but surely we can make it even worse?"

And then they succeeded at failing.

Re: Learn Ethereum smart contract programming

#44

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.

> That world does not exist yet

With a big emphasis on "yet". Serious question: are the "halting problem" and the "yet" in your sentence dependent on each other? I.e., don't we need to first solve the halting problem before we can manage to write 100% bug-free programs?

Re: Learn Ethereum smart contract programming

#45
post #22

Earlier quoted context omitted.

They might still be a good idea, you just have to live with that risk. World is full of risks anyway and you might die tomorrow in a traffic accident. Sometimes risks are worth taking, such as leaving your apartment and risk walking under a car.

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".

Re: Learn Ethereum smart contract programming

#46
post #14
post #13

Earlier quoted context omitted.

I dream about blockchains. Yeah it's true, not only the technology is interesting but also the community and all the ecosystem behind cryptocurrencies.

And this is just the beginning.

Wait until we have a self-driving and deep-learning blockchain...

Re: Learn Ethereum smart contract programming

#47
post #34
post #33

I didn't have high expectations for Solidity considering the recent vulnerabilities, but even these were disappointed. If some guy writes this kind of code at home, alright, but this as the alleged foundation for our future financial system? Frightening. Just one example: "Our function EndLottery() must be only accessible by the owner of the lottery." [0] function EndLottery() public { if (msg.sender == owner) { ...…

Have you read next article? https://ethereumdev.io/better-readability-with-modifiers/

You are right, they solved the particular problem I highlighted with Modifiers.

But the main question remains: Why don't they utilize the progess we made in decades of research for better programming languages?

The argument that Solidity should be useable by the average programmer doesn't hold, in fact, typing makes programming easier since it clarifies data structures that are implicit in languages like JS.

Re: Learn Ethereum smart contract programming

#49
post #41

Earlier quoted context omitted.

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…

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?

Re: Learn Ethereum smart contract programming

#50
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?

Yes the block chain is by definition immutable. So no means to update the contract the only way if it is a ENORMOUS mistake would be to fork it: read about DAO hack FYI
Post reply on HN