How to develop with Paratii.JS?

Check out its official documentation, GitHub repository and simple tutorial.

There is a webpack minified browser build to be used directly in your web pages, or you can use paratii.js as a package in your Node.js application.

After you require the Paratii object and set default/custom config + your account, you’re ready to go.

Paratii = require(‘paratii-js’)

let paratii = new Paratii()

Your newly configured paratii object can now read data from the blockchain. For example, you can search for videos about cats:

let catVideos = await paratii.vids.search({keyword: 'cats'})

Which will return a paginated set of results. For publishing a video, we provide a convenience function with a simple interface:

paratii.vids.uploadAndTranscode( {

title: 'My video',

file: '/tmp/myvideo.mp4'

})

The semantics of this is straightforward: it will publish the video in /tmp/myvideo.mp4 to the Paratii “cloud”. The function will return immediately an eventEmitter instance which will report about progress (and eventual errors) in the process, along with a promise that resolves with the multihash for the ready-to-stream video. The pattern of returning a promise combined with an eventEmitter will be recognisable for those familiar with web3.js.

Below is a short commented walkthrough on the library’s main modules and methods:

Hooray! This video was published through Paratii.JS, and is being streamed over IPFS, through the Paratii Player. If you play it, your browser will become an ephemeral node in the underlying p2p network.

What can one #buidl with it?

While the code works, it’s still unusable on the Ethereum mainnet. Primordial scalability issues (when it comes to public chains) are intentionally unaddressed, and no external security audit has been conducted. There is a lot of work ahead until this becomes a viable system.

However, the core functionality for prototyping applications around decentralised video is implemented. Thus, it made sense to push this preview forward and give developers a chance to get familiar with the library. We hope they will check it out, experiment / prototype, report bugs and help us improve on the way towards a mainnet beta release candidate.

One will find functions for writing information about videos and ownership to Ethereum, uploading and fetching videos over IPFS, requesting and receiving the result of transcoding jobs, besides accessing a blockchain index that allows for reading and querying information.

There’s a bunch of simple ideas for hacks here, if you’re looking for inspiration. They range from a simple web-interface for mirroring videos from another network to a Toshi-based bot for tipping creators of videos you receive via chat.

Do I need tokens? When will it be ready™?

You don’t need any tokens to use the library and take advantage of most of its functions (for instance: staking-specific functions will still, of course, require tokens). In production, some baked-in monetisation options that depend on Paratii’s token-curated registry will prompt staking in order to work. You’ll still be free to use the library without tokens or to build whatever interface on top of it.

Although the code is miles away from being production-ready, it’s already useful in many senses. Check out this simple web demo for an idea of what can be done pretty much out-of-the-box. The library is being updated as the token-curated registry behind Paratii evolves in its implementation, and we will incorporate monetisation features in it along the next months — for those looking for a competitive, cost-effective solution to distribute video to millions of users, this will likely not be there until at least next year.

Notes on agnosticity & further steps

The idea of an open streaming engine revolves around modularity. Ideally, we won’t have IPFS/libp2p “hooked in” as the sole storage solution for files, but rather offer interchangeable Swarm/Storj/[insert your own]-based video persistence. We currently provide some “custom” transcoding nodes for use, but are in the process of integrating Livepeer to experiment with their transcoding protocol and network. Here, too, having something like a wrapper (akin to Snickers, built by our advisor Flávio), that chooses among the most adequate provider for each job request, is the end we aim towards (e.g. a more expensive and faster service for live/breaking news; something cheaper and slower for old documentaries; a specific one for VR). Live video streaming is also an upcoming feature, with a single call giving an endpoint where one can push a live stream and get an ID to play it back.

Reaching the desired level of interoperability with sister networks, in production, will likely involve using 0x for token abstraction, which is one reason why we’ve been eagerly exploring uses of the decentralised exchange protocol. As you may be thinking, this is not a vision that will unfold completely in the short-term. We’re building technology for the long-run.

Last, but not least, Ethereum clients do not offer much functionality for searching and indexing, so we defined an API and coded a REST service that indexes the data on the blockchain and IPFS. This index is part of a replicable package that encompasses also a transcoding node and an IPFS gateway. We run some of these ourselves, and are in the process of making the software straightforwardly available for anyone that voluntarily wants to join the network this way. As for rewards and incentives, please bear with us until our protocol specifications are finalised and public.