The web is currently heavily centralized. Primary data access requires communicating to a server back-and-forth over the internet backbone and often these servers are run by possibly a few companies, or even a single company. If the servers/datacenters hosting a service fall over, that data is entirely unavailable for the duration of the downtime and potentially data could be lost forever. If a nation-state decides to cut-off or limit internet access, as Turkey did in April of 2017 with Wikipedia, then citizens have few ways to retrieve the lost information other than through means that may seem difficult to understand and, even if untrue, dangerous. Although deletion and censorship are common forms of information loss, other forms are more mundane like hosting services becoming too expensive and a site shutting down or a web developer moving a page and breaking any link to it.
As Ray Bradbury wrote in Fahrenheit 451, "There is more than one way to burn a book. And the world is full of people running about with lit matches."
The InterPlanetary File System (IPFS) and blockchain technologies such as Ethereum allow a possible peer-to-peer alternative. In this case, we are looking at a bunch of centralized video services and looking at how this could be effectively and cleanly replaced with a decentralized architecture while giving more control to content creators. Focusing on allowing them to control the experiences they give their audiences.
What it does
As of now it communicates with others peers on IPFS to fetch video data and uses the ethereum blockchain to maintain a ledger of videos, purely as a list of IPFS content addresses. A plain html list will list videos currently available, selecting a video will start streaming it off of IPFS.
How we built it
IPFS addresses data by content hashes instead of by location. The ethereum blockchain is used as a ledger of videos and contains a smart contract that simply maintains a list of video content hashes on the blockchain. This data is then pulled by the application and populates an index. When an index item is selected it leads to page that will pass off to a HTTP <-> IPFS gateway to start streaming video. When uploading, the proper IPFS directory structure is created and the blockchain is updated (blockchain processing takes some time and money in the form of Ethereum's gas though we are using the test network for this project).
Challenges we ran into
The most difficult part was figuring out how to sanely maintain a persistent list of video files. IPFS is a young technology without a lot of parts of the stack still in the progress of being specified or implemented. Orbit-DB was our original choice but seems to currently have issues persisting, or has unclear documentation for proper usage. This cost us a lot of time since we were very much expecting this to work. Later on, we tried using a flat file to hold a list of videos but, because of how IPFS works, this made uploading impossible.
At the last minute, we moved to the Ethereum blockchain for persistence. This was also challenging since it was more overhead for learning and we had to already throw away a lot of our preconceptions from working on services in a centralized web.
Accomplishments that we're proud of
- The data model worked correctly
- Ethereum blockchain worked when we thought it would be harder
- Building a decentralized app that has no reliance on a central server for streaming
- Becoming reasonably competent in Solidity for this to work
What we learned
- Decentralized apps are still young and lot of functionality we are used to is not yet available and requires problem solving
- Lots of other things but I have 4 minutes.
What's next for SpaceVids
- Improve our current pages
- Implement a user data model
- Implement a different blockchain with incentives for content creators
- Get a proper CMS running to allow customization