11

I keep reading that swarm or ipfs would be used for storage, but how would that work exactly? Would an ethereum contract store its data in these data blockchains? I thought ethereum smart contracts can't write to an external source but only read from it? Also what other storage blockchains can be used in this way?

1 Answer 1

10

It's basically the other way around. The Ethereum blockchain will store a hash that points to a file in either Swarm, IPFS or something similar.

From a DApp point of view the following could happen in a theoretical distributed twitter-clone:

  1. You go to my-awesome-app.eth in the Mist browser.
  2. The domain gets translated to a unique Swarm hash.
  3. Swarm retrieves the hash and loads the HTML/JS files associated with this hash.
  4. Once all the data for the app is retrieved the application code will look in the blockchain for the latest tweet hashes, and again request these hashes from the Swarm network, loading the page with recent data as they come in.

I hope this explains it, if not let me know.

3
  • 1
    can you explain it for truffle point of view?
    – BlockA
    May 27, 2016 at 10:20
  • 2
    can't you store data inside the smart contract code? Jul 1, 2016 at 15:46
  • 2
    @duckx You could but it's a very expensive operation. Storing more then a few bytes would cost too much for any type of real-world usage.
    – Maran
    Jul 2, 2016 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.