Radflix: Building A Movie Streaming Service on Radix
Hackathon #2 Overview
During our second internal Hackathon, we decided to model and build a simple movie streaming service where you can actually own and trade the movies that you acquire.
Our 2-member team (Edgars and me) had one day to build the Radflix movie service from scratch, but thanks to our client libraries and the advanced features already available in our Betanet, we could achieve our goals on time.
The Radflix System
We modelled Radflix with a simple, yet powerful concept: minting a token to represent the ownership of a movie stream by the user.
In that way, the user can keep all their movie tokens in a digital wallet, and manage them as any other regular token. This also enables many powerful use cases: e.g., a user could send a movie token to a friend so they can watch it on the weekend, and then return it to the owner on Monday.
On a high level, the Radflix system is comprised of two applications:
- A client web application, that allows a user to:
- Authenticate using the Radix wallet
- Access the Radflix service
- List all the movies available for purchase
- Buy any Radflix movie
- Watch previously purchased movies
- A server application that offers:
- User access validation
- A list of streaming content for the Radflix users
- Support to purchase new movies, by minting access tokens
- The ability to watch purchased movies on demand
- An Admin option to add new movies to the catalog
How It Works
As mentioned before, the server workflow when a user buys a movie consists of minting a token of the purchased movie, signing it with the Radflix server account and transferring it to the buyer’s account.
When a user wants to watch a movie, the server sends a challenge to the client. The client asks the Radix wallet to sign that challenge with the user’s private key and sends it back to the server. With the signed challenge, the server can then verify that the user owns an account, and can check the presence of the movie token in the account.
Only when all these validations have passed, the server will return the protected movie stream file to the user.
What We Used
To prototype the Radflix server, we used an open-source TypeScript+Webpack boilerplate to speed up the development. For those who want to run and test it, keep in mind that the server also depends on a local MongoDB to keep the purchase records.
For the frontend client application, we decided to go with the Vue.js framework, as it allowed us a quick and straightforward way to present the list of Radflix movies to the users, while keeping the Radix abstractions like Atoms and Transactions away from the HTML code.
For those developers eager to dig into the code and learn more about how Radix can simplify the work of building DApps in a distributed ledger, you can find the Radflix hackathonhackaton source code on this GitHub link. (The repository includes both the client and server applications)
In case you’re curious to see how it looks like –or if you’re not so technical to build and run the Radflix service yourself– we have a video that showcases our hackathonhackaton project:
Further improvement of the Radflix system could include missing features such as:
- Support for transfer rules to allow token recovery
- Support for conditional lending
- Host video files on a distributed file system (such as IPFS)
Beyond the fun of the movie streaming, we think that this example also presents a solution to other important cases like equity ownership and investor disclosures in security tokens.
What will you build on Radix?
Jump into our Knowledge Base and get started today.