Project Full Document including Team Information, In-Depth Project Details & Test Credentials
Track: Theta Video Development Track
We live in a world where people and companies who are capable to create high quality online courses, but cannot get started due to the following reasons:
- Rigorous Platform Requirements.
- Huge income deduction (Transaction taxes, platform fee, service fee, processing fee and other fees that might be applicable).
- Long Income Payout Schedule Intervals – Average 2-3 months before receiving payouts.
2 Solution: Terner Academy and What it does
Imagine a platform where anyone can create online courses without dealing with so many platform requirements, low deduction fees, and almost real time income payout. Terner Academy was created and aim to be that platform and attempt to solve the problems that every instructor has encountered. Terner Academy is a Blockchain-based Online Learning Platform that fully utilizes Theta Network and Theta Video API. You can imagine Terner Academy as Udemy/Skillshare/Udacity with Theta Network and Theta Video API Integration.
Basically, Terner Academy has 2 user personas: instructors and students. For the instructors, they can be able to create an account, manage courses (create course, upload video lessons, and publishing the course), view course reviews and purchases. For the students, they can also create an account, see recommended courses, buy published courses, and view their purchase history.
The team behind Terner Academy has chosen TFuel as the platform’s native currency. Since TFuel is widely available on CEX, that makes it more appealing and accessible for the Students and Instructors to use it on the platform. Also, since Theta Video API only accepts TFuel (as of the moment) as payment, it is much easier to pay since there is no need to convert currencies. Lastly, the platform will need to use TFuel for the gas to transfer instructors’ income payouts.
To solve the rigorous platform requirements, anyone can register as an instructor, and it is as easy as creating a social media account. An email address is required to support reset password change and other use cases in the future.
To solve the huge deduction fee, when a student purchases a course, the payment will be transferred to Platform’s Wallet. The platform will deduct 10% of the amount sale as Platform fee. 90% of the amount sale will be transferred directly from Platform’s Wallet to the Wallet set by the instructor. The 10% deduction fee is relatively small compared to some known online learning platforms that deducts around 20% to 40%.
To solve the issue of the long income payout schedule intervals, the payout will happen automatically (without human intervention) and almost real time (~2 minutes) after the student purchased a course.
3 Architecture & Technology Stack
Terner Academy has built mostly using Microsoft Technology Stack. The cloud service provider used was Microsoft Azure. Considering the scalability, Azure Function App was used for the Web API and Web Job. Azure Function App is a serverless compute service that enables the Platform to run event-triggered code (HTTP Request, Queue, CRON) without having to provision or manage infrastructure.
The Web API is mainly responsible on providing the Web Frontends a way to connect and interact to different system components (Data & Storage Account) and services (Theta Network) and it is mainly triggered by HTTP Request events. On the other hand, the Web Job mainly responsible for listening on Azure Storage Queue for some jobs that are very essential especially with the uploading video lesson (more details on the next section).
For the data, the platform used Azure SQL Database to persist user and course related data.
Storage Account contains two components: Storage Blob and Storage Queue. Storage Blob used to store user profile pictures & course thumbnails. It is also used as temporary storage for Video Lessons. On the hand, Storage Queue used to queue course lesson that will need to be uploaded on the Theta Video API Platform.
Lastly, Azure Virtual Machine with Ubuntu 18.04 has been provisioned for the ETH RPC Adaptor / API for Theta Network. It was used to fetch wallet balance & transfer TFuel between wallets.
Technology Stack & Tools
- IDE: Visual Studio 2022 Community Edition
- Cloud Service Provider: Microsoft Azure
- Web Frontend: both Instructor Portal & Student Portal
- Blazor Web Assembly and C# as the Programming Language
- Azure Static Web Apps.
- Backend: For the Web API and Web JOBS
- C# as the Programming Language
- Azure Function App
- Azure SQL Database (MS SQL Server)
- File Storage: Azure Storage Blob
- Queue Storage: Azure Storage Queue
- ETH RPC Adapter / API Server: Azure Virtual Machine
Upload Video Lesson Mechanism
Now we have great information about the architecture, let’s discuss how uploading of video lesson works and how the Platform utilizes Theta Video API.
- When the instructor uploads a video lesson, the portal will send an HTTP POST request to the Web API with the lesson name, notes, and the actual video itself to the Web API.
- The Web API will process the data received from the portal and upload the video temporarily to the Storage Blob with specified filename.
- After the video has been uploaded to the Storage Blob, the course lesson data together with the storage blob video specified filename will be inserted into the database and it will return a course lesson id (primary key)
- Then the Web API will insert the course lesson id into the Storage Queue.
- Since the Web Job always listening to the Storage Queue, it will automatically fetch the inserted course lesson id. Then it will fetch the course lesson information from the database.
- If the course lesson is not yet uploaded before, it will send an HTTP POST request to the Theta Video API using the storage blob video path as Source Uri and save the VideoId value from the Theta Video API response into the database and proceed to Step 7. Otherwise, it will send an HTTP GET request with the VideoId to check the status of the video upload, if the video upload was completed it will proceed to Step 8. If not, proceed to Step 7.
- It will temporarily sleep for 30 seconds and queue the course lesson id again then repeat Step 5 to 7 until the video upload completed.
- After the video upload was completed, the Web Job will update the course lesson entry on the database to add the Player Uri, Playback Uri, and Video Duration.
- Lastly, the Web Job will delete the video upload on the storage blob.
As an instructor, they can be able to use the instructor portal & expects to:
- Creation an account
- See their latest Wallet Balance (TFuel).
- View TFuel Latest Price
- View the Dashboard
- Manage Courses (Create, Update and Publish)
- Manage Course Lessons
- View Course Reviews
- View Course Purchase/Subscription
As a student, they can be able to:
- Create an account
- See their latest Wallet Balance (TFuel).
- View TFuel Latest Price
- View Recommended Courses
- See Course Preview
- View Purchased Courses
- See Course Details
- Watch Course Lessons
- Provide Review on their Purchased Courses
- View Purchase History
5 Value to Theta Ecosystem
In 2019, one of the biggest online learning platforms hit around 40 million students, 30 million minutes of content, and more than 50,000 instructors. The team envisioned to capture at least 3% to 5% of those numbers in the next 1-2 years. Having that goal in mind, the team believes that it would help to boost the cryptocurrency adaptation and provides great value to Theta Ecosystem.
6 Learnings & Challenges
The team learned a lot on exploring Theta Network and Theta Video API. The documentation from https://docs.thetatoken.org provides great use for development of the Platform.
The most challenging parts are:
- Setting up Testnet node. The team encountered some error regarding seeding nodes.
- Theta Video API restrictions. The team encountered some unexpected restrictions on Theta Video API such as there is a maximum number (3) of concurrent video upload. Also, Video limit duration (15 minutes).
But those mentioned challenges doesn’t stop the team to bring Terner Academy to life.
7 What's Next for Terner Academy
On the technical aspect, the team are looking for:
- Integrating MetaMask on the student portal.
- Real time notification.
- Integrating EdgeStore as dCDN.
The team is very open for feedback & comments to improve the Platform (the email can be found on the first page of the document).