13 ms·
How to Learn Solidity: The Ultimate Ethereum Coding Guide
- Principe 9y agoNow this truly is a job for the future..
- kefka 9y agoAnd remember, that there's a special function called VIP() . This is an implied function that wraps around your full code. This is instantiated if/when core founders are losing money on a function that possibly had a bug in it. This function returns the wrapped function, under the guise of a new blockchain, with invalidations applied to all 'unintentional' side effects of bad or buggy code. It happened with the DAO, because founders lost too much money. Just be aware, that VIP() can happen to your code, regardless if your implementation is a bug or intentional. Wrong people losing money means VIP() returns successful.
- jameskegel 9y agoTo me, this turns me off to the entire tech, no matter how stupid and kneejerk that sounds. If the biggest draw to get me using your technology (immutable contracts) is actually not true, then I'm less inclined to give it a shot outside of novelty value.
- PetrolMan 9y agoMaybe the immutability is not 100% now, but it will be when the technology is finalized, which will take a few more years. The fork to save DAO funds was a good thing, because otherwise too much ETH would have been in the hands of an attacker. The ETH distribution would have been skewed. That's all.
- jjnoakes 9y agoCan you really call the person an attacker when they simply used the contact as-written? I think that's spinning things a bit to fit a narrative.
- Jabanga 9y agoYes you can call the person an attacker. The rules of a mature Ethereum protocol should be neutral to the intentions of users, including those that one would reasonably characterize as hackers, but Ethereum was not a mature protocol at the time. It was effectively in early-stage beta. The DAO was the first smart contract of its kind, and was expecting $500,000 worth of ETH to be deposited in it. Instead $150 million worth was deposited. I believe that a fork like the DAO rescue would be perceived as totally unjustified and impractical today, and Ethereum is still a very young and experimental project. I think in a few years, when the network and technology are mature, such an application-rescue HF would be unthinkable.
- jjnoakes 9y agoRegardless of any of this, the person didn't attack anything. I'm not saying my position on whether the fork was right or wrong, but I think folks on either side should not characterize that incident as an attack.
- zeven7 9y agoUnfortunately it's not an honest portrayal of events. Disclaimer: I was a DAO investor. The DAO held 5% of my Ether at the time of the attack. Having said that, it's not as simple as saying: I support the DAO refund because it was in my best interest. That doesn't necessarily follow, and it didn't necessarily follow for most of the other DAO investors. I still held 95% of my crypto $ in Ether. I would have been happy to eat the 5% loss if it would have been the right thing to do and instilled confidence in Ethereum and its leadership. There were many debates at that time about what the right course of action was, and it was a very hard decision. If saving 5% of my investment meant I ended up with a worthless 100%, it would be foolish to save that 5%. And everyone else knew this as well. I think the decision the Ethereum team made was the best moral and legally advisable choice. They had the opportunity to stop the theft of 14% of all Ether, which would have gone to a criminal actor. It required a very risky solution (a hard fork) which came with big consequences (an alternative chain which remains to this day), so the solution wouldn't be feasible for smaller attacks (as some people like the poster before you try to allege). But for an attack which threatened 14% of the available supply, a hard fork to retrieve the funds was a viable solution. Most of the market agrees with this decision. In the time since the Ether market cap has grown to the second largest of any cryptocurrency at 1/2 the size of Bitcoin. The alternative chain that didn't fork is still alive but only has less than 10% of the Ether market cap. The vast majority of dApps are running on the Ether chain. And it's the chain that is being taken seriously by enterprise (look up "Enterprise Ethereum Alliance"). Large businesses know the founders can't simply hard fork whenever they want to better themselves. The model works around consensus, consensus that is clearly shown by the considerations listed above, and I am glad that the consensus model is strong enough withstand an attack on 14% of its supply and respond with a difficult solution to rescue the chain from a catastrophe. It makes me feel more confidence in the technology, the community, and the protocol.
- kej 9y agoYour whole argument is predicated on the idea that what happened with the DAO was "theft". All the publicity for the DAO explicitly said that the code was the full specification of the contract even if it disagreed with any other statements, and the code allowed someone to transfer the funds to their own child DAO. What crime, exactly, are you accusing them of committing when everyone agreed to a contract that allowed them to do what they did? How do I know using another contract won't be labeled theft and rolled back? > Most of the market agrees with this decision. This is exactly the problem. Ethereum would have been interesting if it could enforce unpopular decisions because they're specified in the code and them's the rules. Instead it will enforce them as long as there's not too much public outcry. No thanks.
- erlehmann_ 9y ago> Ethereum contracts are unstoppable and uncensorable until a core developer loses money Source: https://news.ycombinator.com/item?id=14162399 https://news.ycombinator.com/item?id=14162399
- Jabanga 9y agoThe project was very young, and the community miniscule, at the time. It could be justified as a one-time beginner's incident. The network and ecosystem can be expected to behave very differently when it's mature, or even today, given how much larger the community is now, and how much more aware people are of the risks facing smart contracts (which means there is much less justification to rescue those who put money in a complex smart contract that gets hacked). The project itself made mistakes early on by not sufficiently warning people of the risks of the DAO, which gave justification for the do-over. I think they can be excused given the DAO was the very first smart contract of its kind, and given how much was deposited in the DAO so quickly, which was totally unexpected. So I think Ethereum can easily be forgiven for the DAO and subsequent hard fork to redo it. It was a highly experimental technology, that saw a major hack of a early-stage application that was only aiming to attract $500,000 of ETH, but had ended up having $150 million worth of ETH deposited in it, when the ecosystem and the state of the technology were not ready.
- rspeer 9y ago> The project itself made mistakes early on by not sufficiently warning people of the risks of the DAO, which gave justification for the do-over. This is the weakest justification I've heard out of all of them. How do you get a "do-over" for not realizing that weird new financial instruments are risky? And how does rolling back the risk make people more aware of risk? Anyone who was not aware of the risk the whole time deserves the most to lose their money. The right time for the DAO to say "wait, guys, this is risky as hell and we have no idea what we're doing" and give back the money was before they lost the game they had created. (The fact that you refer to this loss as their "smart" "contract" getting "hacked" indicates that you still don't want people to be aware of the risks.)
- Jabanga 9y ago>How do you get a "do-over" for not realizing that weird new financial instruments are risky? People didn't realize the smart contract was at great risk of being hacked, and the project, meaning thought leaders in Ethereum, were partially at fault for this, for not warning people. This was the first smart contract of its type. It's easy to blame the community in hindsight. I choose to forgive it, as I remember early on in any endeavor, mistakes are normal. >The fact that you refer to this loss as their "smart" "contract" getting "hacked" indicates that you still don't want people to be aware of the risks. I don't follow. "Smart contract" is a term of art, and does not imply it's well made or secure. I also don't know what putting the quotations around the "hacked" is supposed to signify.
- flomble 9y agoYour Solidity contracts can run on Ethereum Classic, which you can be confident won't be forked since its users tend to believe in the principle of the immutability of the code.
- kej 9y agoThe classic branch is still susceptible to the same problem, though. They didn't fork because of the DAO, but who's to say they won't fork because they don't like the result of a different contract? If I'm going to trust the enforceability of my contract to some group of people, I trust the established legal system--warts and all--much more than the mob rule of the Ethereum crowd.
- flomble 9y agoThe dev team for Classic is much less likely to attempt to do so, and the miners less likely to adopt such a fork, since they declined to accept the fork the first time it happened. If a fork happened in Classic to protect some party's financial interests, I think the more likely scenario is the great majority of miners opting to stay on the original branch. I get that it's not a complete guarantee, but neither is the legal system. Contracts can be invalidated based on a judge's perception of their unfairness, on a technicality, or even on a whim.
- jhildings 9y ago>much more than the mob rule of the Ethereum crowd. Also known as "miner consensus", same for all crypto currencies including btc
- splintercell 9y ago> The classic branch is still susceptible to the same problem, though. So is bitcoin.
- DiNovi 9y agoAh, have fun over there
- 9y ago
- devmpk 9y agoThe real story of what happened during the DAO to me seemed like fast, responsive, and intelligent leadership. They had a problem, they asked the community how they would like it dealt with, and acted accordingly. Saying the founders were losing too much money so they hard forked it is a gross misrepresentation of the reality. It's like a Fox News representation of what actually happened.
- kefka 9y agoIt's completely the wrong way to handle this. To me, this "currency" is dead. There is no trust, other than if the creators lose more money on a venture, they'll "convince" the community to reverse it. I remember reading and playing around with it when it came out. It was raw, bare, and frankly awesome. The base tenant was that: "The Contract is the Code, and the Code is the Contract." It was a programmers no-man's land where anyone could stake a claim, and start doing cool stuff. And if you screwed up, it was your fault. Nobody else's. And you had to watch out, because it was easy to lose money into nothingness (yeah, BTC had checksums, Eth didnt - another point of amateur hour). Until the DAO. When that happened, I think $150m of Eth went into it. Massive amounts. The idea was to have a distributed living self-autonomous company. And, by the older ideals, lots of someones didn't do their homework. Or they did and it was intentional. Regardless, the "completely innocent magnanimous leaders of Ethereum" decided to force a Blockchain split, and rewind it all. Of course, Something like 2/3's of the total amount was owned by Ethdevs. Surprised? Nope. Bitcoin? Sure, I'll play. But Ethereum has proved that if you are in the special class of people (Creators with loads of money lost), you don't matter. Nor do the ideas of what they were supposedly founded with.
- komaromy 9y ago> 2/3's of the total amount was owned by Ethdevs Source?
- kefka 9y agoI was in the irc room during that time. It was the number batted around by ethdevs in freenode #ethereum. Regardless, the very people who build the protocol, application stack, and seed blockchain machines were also the ones who had massive stockpiles of eth from the auction... You do remember the auction, right? They had absolute fiduciary reason to undo their losses. Edit: And in all honesty, this would be compute-expensive, but the nature of the blockchain would be able to tell how much ethcoin came from before the auction rather easily. After all, a blockchain is just a append-only distributed ledger. Well, we did know the transactions, but you'd likely have to go to Ethereum Classic and replay what addresses put money in.
- deleted 9y ago[deleted]
- gricardo99 9y agoJust replace "code" with "valuable resource", and "founders" with "interested actors", and your comment is much more broadly applicable, if not universal.
- SirensOfTitan 9y agoThe whole idea around proof-of-work based chains isn't immutability, it's that the longest chain always wins. If the majority of CPU power 'votes' for a particular chain that chain sits as the de-facto chain. For most chains this means >50% wins, as requiring anything higher for consensus increases the potential for network deadlock. With that, are there any trust algorithms that aren't susceptible to 51% attacks? Ideally power (stake or hash in this case) is distributed amongst actors as much as possible. Cryptocurrency doesn't take us from centralized -> decentralized currency: it moves us from almost wholly centralized currency to more decentralized currency. The move is welcome but idealistically seeing the options as completely centralized or completely decentralized seems a bit misguided to me.
- veeberz 9y agoCitation? I have tried Googling it, but came up short.
- Jabanga 9y agoThe Core founders invested very little in the DAO, and pushing for a decision that went against the interests of the network would have hurt them far more through reducing the value of the portion of their holdings they still held, than helped by rescueing the portion they put in the DAO. In short, you're mischaracterizing the motives of the lead developers who supported the HF.
- vvillena 9y agoThis is simply not true. The protocol spec that the DAO was in is still alive and well. It's called ETC. Could it be that you just resent the fact that people give a lot more value to a forked chain called ETH? This is understandable, since the DAO fail made clear that code run on blockchains still depend on human consensus. Code will run according to spec, but only as long as the people running the nodes decide to adopt a specific version of the protocol. Note that no blockchain tech, not even ETC, is free from this fact. You can run a blockchain using the protocol you want, but what gives it value is human consensus. Ethereum is not a tech utopia. But it is a damn cool tech, and understanding its limitations is important to be able to take advantage of it.
- toolkitman12 9y agoOdd, I can't find this function whatsoever. By the way, Solidity is open source so there are no secrets - go look for yourself: https://github.com/ethereum/go-ethereum/search?utf8=%E2%9C%93&q=vip&type= https://github.com/ethereum/go-ethereum/search?utf8=%E2%9C%9... No function as op describes, also no source or reference. Screams FUD, nothing to see here...
- deleted 9y ago[deleted]
- otoburb 9y agoOne of the main Ethereum co-founders is working on a new experimental contract language targeting the Ethereum Virtual Machine called Viper which still seems to be under relatively active development[1]. Why pick Solidity if Viper and other languages like Low-level Lisp-like Language (LLL) by Consensys[2] are around the corner? Or is this just a matter of language flavour similar to how anybody can pick from a plethora of languages targeting the JVM (Clojure, Scala, Java, etc.)? [1] https://github.com/ethereum/viper https://github.com/ethereum/viper [2] https://media.consensys.net/an-introduction-to-lll-for-ethereum-smart-contract-development-e26e38ea6c23 https://media.consensys.net/an-introduction-to-lll-for-ether...
- PetrolMan 9y agoViper is not completed, and it might never be completed. Solidity is here now, and the demand for Solidity developers is growing by the hour.
- otoburb 9y ago>>[...] it might never be completed.* "Complete" is certainly in the eyes of the beholder, but Viper's author seems to think the language is "complete enough" to have started writing Ethereum's new Proof-of-Work/Proof-Of-Stake hybrid system (aka Casper contracts[1]) in Viper[2][3]. [1] https://www.ethnews.com/proof-of-stake-vitalik-buterin-shares-casper-contract-code https://www.ethnews.com/proof-of-stake-vitalik-buterin-share... [2] https://ethereumclassic.github.io/blog/2017-03-13-viper/ https://ethereumclassic.github.io/blog/2017-03-13-viper/ [3] https://github.com/ethereum/casper/blob/master/README.md https://github.com/ethereum/casper/blob/master/README.md
- charlescearl 9y agoAre there any resources more informed readers might suggest for building a "toy" EVM language? Say based on racket? Thought it might be a good way to understand things deeply.
- buttershakes 9y agoI've been using Solidity for a bit. I wouldn't say it is my favorite language, it's a bit too javascripty for my personal preference, and its genuinely hard not to introduce subtle security flaws into the code. As a smart contract language it leaves a lot to be desired. That being said, it is really the only game in town on Ethereum right now. The other language implementations on the EVM are in various states of disuse. If you are interested in smart contracts on Ethereum you have to learn Solidity unless you want to reinvent the wheel with your own language implementation.
- surak 9y agowell said, agree with you!
- rboyd 9y agobullish. whenever the average HN comment is negative for new tech you know it's going to be huge. great guide here too.
- woodandsteel 9y agoLast year I was pretty excited about Ethereum for a few months. But then I got to thinking about the social problems I care about, like how factory and middle class jobs are being wiped out by robots and AI, and I couldn't think of how DAPS could fix those sorts of problems on a large scale.
- Jabanga 9y agoPeople are not meant to work in factories. They're meant to own parts of factories and other productive enterprises. Ethereum reduces the barriers to entry to becoming a stakeholder in value created by enterprises. The cost to exchange a token is 1000X less than the cost to exchange a security. This is an orders of magnitude reduction in barriers to entry and expansion of liquidity. It means the economy can grow in all directions and become more inclusive in its ownership structure. We're still very early days, but this is what distributed smart contracts make possible. The second and third order consequences of this will be enormous.
- woodandsteel 9y agoDo you mean people won't work in factories but instead sit around and collect profits, or do you mean people will work in factories but own them cooperatively, or that people will work but not in factories but in some other type of economic enterprises, or what? And could you give me a link where this is described in more detail, including addressing various possible objections?
- Jabanga 9y agoI mean people will sit around and collect profits. I don't have any links about this. This is my own view on an ideal future. I haven't come across any objections to it.
- woodandsteel 9y ago>I don't have any links about this. This is my own view on an ideal future. I haven't come across any objections to it. This is what I am talking about. Ethereum supporters think it is going to make the economy into an anarchist-libertarian techno-paradise, but they don't present specific ideas and write them up so they can be subjected to critical scrutiny. You know, lots of ideas seem great until you try to work them out. My own thought is that economics starts with basic needs and desires, like for food, shelter, health care, internet access, and so on. Today these are provided largely by small and medium enterprises, and people earn their money working for them. I don't see how most of these things could be provided by DAPS, and so I conclude Ethereum isn't going to make much difference to the average person.
- OrangeTux 9y agoFWIW: The current Humble Book Bundle does contains the book Introducing Ethereum and Solidity[1]. [1]: https://www.humblebundle.com/books/linux-book-bundle https://www.humblebundle.com/books/linux-book-bundle