Building SkyLive during the first Skynet hackathon

DaWe
The Sia Blog
Published in
4 min readSep 2, 2020

Note from the Sia team: We’ve held a number of hackathons over recent months, mostly focusing on what can be done with the incredible Skynet, the world’s first fully decentralized content and application hosting platform. DaWe won our first with SkyLive, a livestreaming platform built on top of Skynet. Prior to this, we didn’t even know that livestreaming on Skynet would be possible, but the hackathon tested DaWe and the network, and something beautiful came of it.

Our most recent hackathon was Own the Internet (over $8,000 USD in prizes), where we partnered with Namebase. Our next, Hack the Rainbow, has us partnered with Near Protocol and has almost $5,000 USD worth of prizes. Hack the Rainbow is live right now, so sign up and get involved.

Hackathons are an incredible opportunity to build on the next wave of technology. Read on for DaWe’s full hackathon story.

The beginning

I was very happy when the first Sia Skynet hackathon was announced. I already used Sia for renting and hosting purposes, so it was not a question to enter the competition. I had a bunch of ideas, so I felt it was for me.

I started working and made three small projects already when my mind exploded — how cool it would be to live stream on the decentralized Sia storage? To be honest this was not the first time I tried to make something crazy with Sia — some months prior I tried torrent seeding and full-bitcoin-node running on my rented Sia storage — both failed.

The problem was that you can’t stream continuously on Skynet because you can’t upload an in-progress video file. You need to finish the file, upload it, and then you can send it to your friends. You also can’t change the uploaded file, because the URL of the file is generated from the file itself. This means when you change the file, the URL will also change, resulting in a completely new file on Skynet.

An idea emerges

But what if I cut the recorded video into 10-second segments? Okay, there will be some delay, but most major streaming platforms already have some delay, however small. I developed a whole backend/frontend solution, but it was not perfect. I used two HTML video players and switched between. So first player1 started, but player2 was hidden. When player1 finished, player2 already loaded the next piece of the video, so I hid player1 and started player2. And it worked well on fast computers, but the switching was slow on mobile devices. I don’t know why, but it was slow and the video stuck a little every 10 seconds.

Problems aside, it worked. So I decided to take a test and asked some people from the Sia Discord community to try it out. Pjbrone was the first — he asked if I was using HLS and I said no, but I was interested in HLS, so decided to learn about it. HLS is an HTTP Livestreaming Protocol what works with small file chunks and as it turns out YouTube, Facebook, Twitch, and many site use this protocol (or something similar). The live broadcasting software OBS also has an HLS recording option (m3u8), so in the last 24 hours of the hackathon, I rewrote the whole project’s code to support this. 40 minutes before the first run I found a massive bug in OBS (more details on GitHub) which is why I almost had to cancel the whole thing. With some tricks, I was able to stream 15 minutes and after that, restarting OBS helped, so you can watch the whole test stream here.

After the hackathon, I hired a developer and we released SkyLive GUI to make streaming easier for non-tech users (honestly, it’s still a bit complicated because of the OBS bug). I opened the beta registration on my SkyLive webpage, so if you want to try out streaming, you can register here.

What happens next

That’s where we are, but I have a lot of ideas to make SkyLive also really 100% decentralized (now the m3u8 playlist file is stored on a normal centralized web server — this file changes every 10 seconds, so I can’t upload it to Skynet. A p2p video database could solve this, I just need to develop one).

It was very amazing to see SkyLive improving with Skynet. Sia v1.5.0 contained a bunch of Skynet download speed optimization, so it was a huge improvement for video load times on SkyLive.

I want to say a big thank you again to all Sia developers and the whole Skynet team, I can’t describe the happiness I felt when I won first place. It opened a new world for me. Also congratulations for the other winners, I love playing with your submissions ;)

--

--