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?
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:
- You go to my-awesome-app.eth in the Mist browser.
- The domain gets translated to a unique Swarm hash.
- Swarm retrieves the hash and loads the HTML/JS files associated with this hash.
- 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.