chippy 6 years ago

Can someone explain what this does?

Like, what should a user expect to see when visiting the application, and what a developer could expect to make developing this application further?

I see a "gas" and a "gasprice" used, but ctrl-f doesn't show anything in HN comments, nor in the readme outside of the code, indeed the code itself is commented with:

  // Someone help me understand this.
  • jklepatch 6 years ago

    Just to add to echelon answer, gas represents the computational effort of a specific EVM (ethereum virtual machine) instruction. For example, deploying a contract cost a certain amount of gas, storing a variable another, etc...

    However when you send an ethereum transaction (i.e you modify data in the blockchain) you need to pay the miner in ether. You cant pay in gas. So you have to specify how much ether you are willing to pay for each unit of gas, i.e the gasprice. The combination of both (gas x gasprice) will give you the maximum amount of ether you are willing to spend for this transaction.

  • echelon 6 years ago

    Gas and gas price determine how much you're willing to pay for your smart contract to be executed. Gas price is the rate you're willing to pay, and gas is how much you're willing to spend for your program to complete. If you run out of gas, your program will not finish execution, and the state will be reset to the start state.

jklepatch 6 years ago

Awesome! Since you use Truffle, it would be even better if your code was wrapped in a truffle box, so that it can be installed very easily with the "truffle unbox" command.

If you are interested, I have actually just published a video about the "truffle unbox" command: https://youtu.be/LlVj1wAEMAU

And here you will find the official docs for how to publish your own truffle box: http://truffleframework.com/docs/advanced/truffle-boxes

  • throwawaysecops 6 years ago

    A trifle to Truffle.

    • foobarbecue 6 years ago

      The Trouble with Truffles

      • lowpro 6 years ago

        Let's stop touting the terrible trouble with truffles.

wanderingstan 6 years ago

If you're looking to use React instead of Vue, the Origin Demo Dapp is a great starter also combining IPFS with Ethereum.

https://github.com/OriginProtocol/demo-dapp

(Disclaimer: I was a big contributor)

Also note that `ganache-cli` is not strictly required in addition to truffle, as one can use `truffle develop` to get a local test chain.

qwerty456127 6 years ago

What exactly does it do? Although it is such a buzzword nowadays I still have absolute zero idea about how are these "smart contract" things used and what Ethereum is if not "a better BitCoin" (and if it is - what kind of applications can you build with it? money exchange/ecommerce/gambling?).

  • kolinko 6 years ago

    You can easily google what smart contracts are. A good starting point is also ethereum.org, which has three easy to understand examples.

    • qwerty456127 6 years ago

      A smart contract is a computer protocol intended to digitally facilitate, verify, or enforce the negotiation or performance of a contract. Smart contracts allow the performance of credible transactions without third parties. Smart Contracts are self-executing contractual states, stored on the blockchain, which nobody controls and therefore everyone can trust. Etc...

      So what exactly can these be used for other than for what ordinary paper contracts are used? What does it mean to build an app with this? Is this just about developing digital wallets/baskets or what?

      Yes, I am this stupid when it comes to this subject. I would really appreciate if somebody could direct me to an article/video/book that would explain the thing from the practical point of view for a plain old application developer having zero understanding of what's this all about.

      • dingo_bat 6 years ago

        You're right. I also cannot think of anything useful that "smart" contracts can accomplish that a normal contract cannot. Also, wtf does "apps" mean? Can I run this "app" on my phone? Is it like instagram?

        • eksemplar 6 years ago

          You probably live in one of the less corrupt countries in the world, where the public record the ownership you hold over your house won’t disappear over night.

          More than 4 billion people don’t, and even those of us who do, should probably use our non-corrupt climate to implement these anti-corruption use cases while our political leadership isn’t corrupt. I mean, even if we never turn to corruption it’s infinitely easier to implement when you don’t need it.

          Aside from that private sectors like container shipping desperately need a secure and global way to authenticate container ownership. Shipping the piece of paper that will let you pick up a container at a dock is currently more expensive than shipping the container itself, because anyone with that paper can steal your stuff.

          Or what about making sure consumers know that they are actually buying your brand and not a copy?

          That being said, most of those use cases won’t be decentralized. Maersk isn’t going to utilize public nodes, they’ll run their own.

          • qwerty456127 6 years ago

            > You probably live in one of the less corrupt countries in the world, where the public record the ownership you hold over your house won’t disappear over night.

            In sufficiently corrupt countries they don't even have to disappear, they just can be either ignored easily or proclaimed illegitimate. A blockchain record saying you own something means nothing in countries where these are not legally recognized and I don't know any where they are (but Estonia, perhaps) and especially in corrupt countries where police and judges do whatever they are told by particular people rather than the law, the evidence or whatever. Also, a person can just come and beat the secret key out of you and submit whatever transactions he wants to the actual blockchain in countries like that.

            • phoneboy 6 years ago

              I understand that even Estonia requires a manual process, with two witnesses at site to a property transaction. Then the question becomes how you digitize this on the blockchain?

          • sharemywin 6 years ago

            So, you don't think there will be a set of various orgs (like w3c is to html) that manage the protocols.

        • __MatrixMan__ 6 years ago

          I don't think the point is to do things that regular contracts can't. Instead imagine doing all of the things that they can do, but without the need for lawyers or court rooms or even governments.

          Once you drop those constraints, the door opens for all kinds of applications that would be too slow or complex to execute on government infrastructure.

          For example, I could configure my vehicle to keep track of pothole locations, and then every time it swerved to avoid one I put 25 cents worth of cryptocurrency into a wallet with an associated smart contract that says: this money goes to anybody who fixed the pothole.

          Later, somebody fixes it and notifies the smart contract of their claim against my reward.

          Next time I'm near that pothole, my vehicle either inspects is or prompts me to, and if it seems fixed, the fixer gets the money.

          Without smart contracts it's difficult for the would-be fixer to know that the promised money even exists, and to be sure I'll actually deliver.

          Now maybe the app above needs to be tweaked to include somebody who is a trusted pot-hole inspector who goes around doing the inspections (in exchange for a cut). Maybe that trust comes from the fact that they wrote the app in the first place.

          The point is, you can have apps that make decisions in a way that can't be tampered with. Want to withdraw your pothole donation? Too bad, the contract is the only software that can move funds out of that wallet. The only way to unlock them is to find somebody to fix the pothole.

          That's something that would be difficult to ensure without a smart contract.

        • ttul 6 years ago

          Forget the word “smart”. A contract is just code that is run by all the nodes in a P2P system to achieve outcomes that everyone can agree on. Add in some crypto to make it impossible for anyone except the author of the code to modify it, and to ensure that the code all runs in the right sequence.

          • qwerty456127 6 years ago

            And what can this be used for? I can hardly imagine any real-world application for this but distributed calculations like Folding@home, SETI@home, password cracking, DDoS-ing etc. And I totally can't imagine what can this have to do with a GUI framework like vue.js.

            • nyolfen 6 years ago

              many classes of transactions and economic activities that require the facilitation of real-world middlemen (drafting & enforcing contracts, coordinating buyers & sellers, etc) can be turned into something that exists entirely on the network and automated. a straightforward example is a gambling pool that exist purely in software, on no particular device.

              vue.js is just for a pretty frontend for the apps.

              • qwerty456127 6 years ago

                Is there a reasonably simple (and reasonably documented) yet reasonably usable free open-source application of this kind available to study?

                By the way, can I use the blockchain as a decentralized replacement for a database (e.g. instead of MongoDB/CouchDB) for my app so that all the data submitted (provided it's lightweight immutable semantic data, i.e. "facts" accompanied with small (never bigger than 256 symbols, usually smaller) amounts of parameters) will be stored in the blockchain? If yes, where do I get started (without having any blockchain experience to the moment)? Is there some kind of tutorial that would explain this vue-ethereum-ipfs things (the README.md of the repo by the links makes near-zero sense to me but I am eager to develop a "multiplayer" VUE app that would store its data "nowhere and everywhere")?

                • nyolfen 6 years ago

                  you could take a look at openbazaar, which (as far as i know) is the leading decentralized market software currently being developed. it uses cryptocurrency for payments and ipfs as a filesystem.

                  you surely could use the blockchain as a database, because you can attach small amounts of arbitrary data to blocks[1], but it would be very inefficient (transaction fees!). something like ipfs is probably a better solution.

                  i'm not a software developer, i just think this stuff is really cool and follow projects. someone with more technical chops could definitely give you some better pointers! i do have this bookmarked, though: https://dappsforbeginners.wordpress.com/

                  [1] https://poex.io/about

            • Kiro 6 years ago

              CryptoKitties and Etherdelta.

        • langitbiru 6 years ago

          Secure and untampered voting.

          In centralized server (server in AWS), the gate keeper can tamper the voting records (UPDATE voting set your_champion_voting = 100).

          With smart contracts on top of Ethereum, that is impossible.

          • jononor 6 years ago

            The important properties here are immutability, transparency and authentication. This could be done by a centralized server. For instance by keeping an append-only log with signed voting records which is regularly published, where each entry contains previous entry ID. Like git...

            • langitbiru 6 years ago

              But how do you know that the centralized server does not override all records to tamper the evidence? Append-only log is useless if the actor choose to override all logs.

              So you need a neutral third party to keep the records in case the centralized server does the malicious behaviour.

              This can be done, I admit. But in a corrupt society, it is hard to find a neutral and trusted party.

              Other way is using blockchain to record the logs and incentivize the miners to maintain the nodes. You can not bribe the cryptography.

      • aiCeivi9 6 years ago

        In theory smart contacts remove the need for law & lawyers to enforce contracts. In practice any useful contract will need some data that isn't present in blockchain, from 3rd party providers/oracles. It is nice solution for gambling - if you bet on future blockchain state, since betting on sport events need an oracle that will provide smart contract with sport event results.

  • patrickk 6 years ago

    "Programmable money" is one shorthand example for smart contracts. As a simple example, you could create a payroll smart contract that pays a fixed amount of coins/tokens/whatever at a certain time each month to a given ERC20 compliant address. You can contrast this with Bitcoin, whose two main functions are securely storing and sending bitcoin (limited by design).

    For a more in-depth answer regard smart contracts, here is an article by Vinay Gupta where he sets the context for Ethereum, smart contracts and blockchain against the existing way of organising and sharing data (SQL, the web, how organisations share data, protocols, and more):

    https://medium.com/humanizing-the-singularity/by-the-end-of-...

  • EtDybNuvCu 6 years ago

    "Smart contract" is a phrase from the ERights folks which Ethereum borrowed in order to raise hype levels. It originally referred to writing an auditor, a program which audits, or proves, that the behavior of some other client programs is in line with some specification.

cheschire 6 years ago

There has gotta be an encryption enthusiast out there that can explain to me how secure multi-user private communications can occur in a decentralized web.

Assuming the crypto was strong enough to guarantee privacy, how does an application automatically allow a user to transparently decrypt topics they’re invited to?

Point to point trust seems relatively easy with asymmetric encryption but point to point to point to point?

  • riskable 6 years ago

    Privacy is not a feature of Etherium or "smart contracts". It's the opposite, in fact. All transactions are public. The only "private" aspect is your address used to make a transaction but it has the same problem as Bitcoin in that regard: When you turn it back into real money your identity can now be attached to that address.

    • cheschire 6 years ago

      Is there a notification feature I can enable on HN to tell me when I get a reply?

      Anyways, yes I completely agree with you, privacy is not a feature. Decentralization in general suffers from the inability to manage privacy and I think that’s where future applications of the technology are going to struggle to gain traction beyond niche audiences.

      • grzm 6 years ago

        > ”Is there a notification feature I can enable on HN to tell me when I get a reply?”

        Check out Dan Grossman’s http://www.hnreplies.com

        • cheschire 6 years ago

          Thank you kind stranger!

  • zapita 6 years ago

    You can restrict access to content with on-disk encryption, and grant or revoke access with public key crypto. There is a lot of new tooling and infrastructure to create, but the crypto building blocks remain the same.

donpdonp 6 years ago

This seems like a great way to explore ethereum contracts, but the README stops early.

Following the README, I've got a ganash testnet and imported the accounts into metamask. truffle compiles the (empty) contracts into ./build/. It seems like at this step there should be an http server to give firefox/metamask something to visit, or a gateway.ipfs.io url to retrieve some HTML that was uploaded into IPFS. This second half of HTTP/IPFS is still a mystery. Please extend the README, thx.

  • donpdonp 6 years ago

    I added a bit more detail in the README (https://github.com/redacademy/vue-ethereum-ipfs/pull/2) though it runs into the question of is this repo an empty skeleton for apps or can it double as a hello world Dapp? Currently the Vue app compiles to a placeholder page with no eth/metamask bits on it.

marknadal 6 years ago

This is a nice bundle of things to install, however what is the end result here?

It seems to be an app that initializes web3 and saves a contract... a contract to do what?

We also have a decentralized tool, and people are building stuff like:

- Testing character-by-character realtime updates on a social networking dApp in a P2P mesh-network of devices: https://www.youtube.com/watch?v=C3akdQJs55E

- A 3D multiplayer VR game in the browser: https://www.youtube.com/watch?v=s_m16-w6bBI

And more! Note, this is not using Ethereum, but our decentralized tool: https://github.com/amark/gun , and here is a 4 minute and 40 LOC interactive coding tutorial that shows you how to get started: https://scrimba.com/c/c2gBgt4

So far CryptoKitties is the most interesting actual dApp I've seen with Ethereum. Does the op/parent github repo help enable building real dApps like above? I hope so.

  • zitterbewegung 6 years ago

    The idea is not to make an app but to have as a starting point for people to do apps in Ethereum. The contract is there just to have something so you can get feedback.

    • throwawaysecops 6 years ago

      Quick, someone name an Ethereum app that does something useful and is in widespread use.

      • diegocerdan 6 years ago

        Dai Stablecoin System

        • drdeca 6 years ago

          Is that in widespread use yet? I know it is in some use already, but not sure how much yet.

          I look forward to when it works with being able to be backed with multiple types of assets (e.g. The digix asset)

jpcapdevila 6 years ago

I think a better term would be "Dapp starter"

  • anonytrary 6 years ago

    That's what he said -- "decentralized application starter" Or, are you being pedantic ;)?

    But, I agree, it may have been more concise to just use shorthand.

  • dang 6 years ago

    OK, we'll s/web/decentralized/ above.

  • sova 6 years ago

    Does Dapp mean distributed or decentralized?

    • kss238 6 years ago

      decentralized

      • sova 6 years ago

        prove it

ukulele 6 years ago

It's a fun idea, but I really hope we don't have to sit through a multi year cycle of people using the term "Web 3.0"

  • fluxsauce 6 years ago

    I'm holding out until Web 5.0 RTM RC3. It'll still require a Flash plugin, ironically.

  • intjk 6 years ago

    If ajax was Web 2, I feel like decentralization feels apt enough to define Web 3. Like a major upgrade. ^^

    • amelius 6 years ago

      Web 1.0 was decentralized (see e.g. the email protocol), Web 2.0 centralized everything, and now Web 3.0 is about decentralization again. I can see how the cycle will go ...

      • codegladiator 6 years ago

        Every cycle should increase the power consumption by 10x.

  • dang 6 years ago

    We've taken that baity bit out of the title above.

  • ricardobeat 6 years ago

    I thought we were done with that back in 2009...

Proven 6 years ago

Like ZeroNet, but more complicated and two years late.

decorator 6 years ago

If it's on Ethereum, it's not decentralised. Their state is mutable -- as per the DAO.

  • patrickbolle 6 years ago

    I understand this, but good lord people need to stop bringing this up in every damn thread that mentions Ethereum. We all know about the DAO and what happened afterwards.

    • decorator 6 years ago

      That's probably because people think decentralised apps should be decentralised.

      • cortesoft 6 years ago

        What does having mutable state have to do with being decentralized?

        • drdrey 6 years ago

          Mutable history is the problem. What's written to the blockchain is supposed to be immutable forever and independently verifiable by everyone. If an entity can rewrite history (eg drop or revert transactions), it becomes a problem. This is what happened after the DAO hack and it resulted in the Ethereum classic fork.

          • drdeca 6 years ago

            Well, sort-of?

            The chain still includes the transaction history of what happened with the DAO, but the hard fork added a special case unique state change which undoes most of the effects of the transactions that happened with the DAO.

            So, the transactions still are recorded as having happened, but the state was edited?

            Not that that necessarily is a particularly important distinction, but I think it is one that can reasonably be made.

        • weego 6 years ago

          The decentralized element should be more than just a software concern. Regardless of decentralized / mutable state if the control of the state of the chain (forks etc) is a centralized concern by a small group then we're just admitting the conceptual model is bullshit and this is literally just a very mediocre technical implementation of stuff we already have.

          You can't just throw out or dismiss the historical failures of the model because it doesn't fit the ongoing narrative. The DAO was a glimpse at how easy the theory is corrupted, whether it started for the right reasons or not.

    • yjftsjthsd-h 6 years ago

      Break contract, be forever viewed as less trustworthy. The punishment fits the crime.

  • quickthrower2 6 years ago

    Only the names mutated:

    Ethereum -> ETC.

    New Coin -> Ethereum.

    The market said New Coin a.k.a. Ethereum is worth more. But who cares about fiat, eh?

    • quickthrower2 6 years ago

      Just had a nasty though. Don't tell the tax office about this. They'll could tax you as income on the "New Coin" a.k.a. Ethereum you got for free, and you claim a capital loss on the drop in price of the old coin (Etherium Price - Classic Price). Yikes!

    • decorator 6 years ago

      This may sound radical & all, but I think people may be investing in coins based on things which are other than 'rational'.

      'I can calculate the movement of stars, but not the madness of men'.

      If more professional investors get involved, that would likely change some.

  • mhluongo 6 years ago

    You can he decentralized and mutable...

    • lojack 6 years ago

      Precisely. The decision to fork was made via a decentralized process.

    • decorator 6 years ago

      A blockchain?

      • mhluongo 6 years ago

        > If it's on Ethereum, it's not decentralised.

        You didn't mention it not being a blockchain. Words matter.

        I think the fork was a mistake as well, but that doesn't make something centralized.

        • decorator 6 years ago

          I hadn't realised that people didn't know what type of data structure Ethereum used.

  • drdeca 6 years ago

    I think if you have a node running locally, metamask will work with ETC as well, so you could probably use this setup with Ethereum Classic if you wish.

    • decorator 6 years ago

      I think most things can change chains. So I'm not condemning everything.

  • krrrh 6 years ago

    Yes, distributed but not decentralized.