Preface: I thought getting into Theta was going to be a simple quick guide but this has turned out to be more complex then I initially thought. Also I have made Beginner's Guides to Cosmos(ATOM) and LOKI so check those out if you are interested.
So what is Theta? I know your wondering the same thing. I have a brief history with Theta and it's gas currency TFUEL as I have been apart of the Sliver.tv/Theta.tv network for months now. But as I started to learn more about the crypto world as a whole and how Blockchains operate and I wanted to revisit how this currency works.
Theta Labs is the company that created the Theta token and TFUEL token. They also created Sliver.tv (which has been re-branded to Theta.tv). Theta Labs has a few patents on video content delivery that I won't get into here.
In order to understand what Theta is trying to fix or solve we need to look at Video Streaming as a whole first. In 2019 Video Streaming made up more than two-thirds of all internet traffic. That is a staggering amount of data just for video streaming. In the current environment we have Content Delivery Networks (CDNs) which are the backbone to video streaming. These CDNs create 'hubs' which are Point-of-Presence (POPs) around their viewers all around the world. But they realistically can't be close to everyone in the world. This is referred to as the Last-Mile, the last mile the video takes before getting to your device (it's not a literal mile measurement though).
The cost of running these CDNs POPs is insanely expensive. Look at how much data it requires to stream each type of content. Theta.tv does support VR video as well which instantly increases the bandwidth needed to stream it.
Theta Labs solution is to reward the viewers for taking some of the strain off the CDNs. If Theta can pay less to the CDN's for not have to stream data and the user picks up that task then the user can be rewarded for their effort.
How is Theta and TFUEL utilized
Currently there is Theta.tv which is a video streaming site, like Twitch. But instead of just streaming the data from CDN's it is shared by the peers watching the video stream. While you view streams and subsequently share the stream you earn TFUEL. TFUEL is the gas token on the Theta Protocol. The Theta token is the maintenance token on the protocol used for 'staking'. If you have a Pre-Guardian Node setup and tied to an account that has THETA on it you will earn more TFUEL for "mining", which is in fact just a stand a lone streamer/cacher.
Theta's Blockchain 3 Main Concepts
Multi-Level BFT: BFT is Byzantine Fault Tolerance which means even if a node is malicious the other nodes still can talk to each other. The modified BFT that Theta uses is setup in a 2 tier method. Tier 1 is the Validator Committee (10-20 nodes) which produces blocks as fast as possible (1,000+ Transactions per second). The 2nd tier is the Guardian Pool which is made up of thousands of Nodes. The Guardian Nodes are what everyday users run on their PC (I have a guide about how to set it up).
Aggregated Signature Gossip Scheme: If there was an open all-to-all broadcast between all the nodes it would cause a lot of overhead. So with an Aggregated Scheme the Guardian Nodes keep combining partially aggregated signatures from it’s neighbors and then gossips out the aggregated signature.
Resource Oriented Micro-payment Pool: It is an off-chain payment pool. It allows a user to create an off chain payment pool that other users can withdraw from using off-chain transactions.
What does Theta do? Well we are going to focus on Theta.tv for this part. You can think of it as a kind of Proof-of-Work consensus but it's not. If you are a viewer on Theta.tv you are watching a certain video stream. You are then automatically relaying that stream to others trying to watch it. And if you are closer to that other user than a CDN then you will earn TFUEL as a payment for helping them reduce their CDN costs.
It is built in a mesh network, because any one viewer could stop watching a stream and then stop sharing the stream. So there is always the CDN there in the background to pick up the slack that the viewers can't handle.
Theta Labs really put the time and effort into making the Guardian Nodes and normal users on theta.tv incredibly effective. So when someone connects there is a handshake step that happens. During that time it retrieves a list possible peers for the stream that is playing. It then does a availability and speed test to select the best subset of neighbors to share the stream with. Just because you are physically closer to another user watching the same stream doesn't mean you will be a neighbor. It comes down to distance yes but not physical distance, it’s the amount of hops your device takes to get to the CDN. And it also takes into effect your data speed and uptime.
The web client (theta.tv utilized WebRTC protocol for the stream delivery to peers. The problem is that you have to have it open to be running and it may time out and need to be refreshed from time to time. That is why Theta created the Guardian Node. It is a stand-a-lone desktop app that can run in the background to transcribe the video and run 24/7 without user intervention. It only runs on Windows at the moment but Theta Labs is looking into dedicated hardware, like IOT devices, Smart TVs, and the like to relay and re-broadcast the streams to peers.
The Theta Blockchain Ledger
So the BlockChain Ledger was always going to be tricky because if you the user are sharing seconds of a video to peers each section you send would be a transaction. And eSports has shown that they could get a million viewers on a concurrent stream. That would be millions of transactions a second at it's peak. Proof-of-Work Blockchains would not be able to support that.
The Ledger would also need a highly fast consensus because if a viewer is giving TFUEL donations to the streamer or the Streamer is giving out virtual gifts they need to be almost instantaneous.
Theta Labs decided to go with a Proof-of-Stake consensus with it's algorithm based on the BFT protocol. BFT is the Byzantine Fault Tolerance protocol. It has great consistency because it takes the Ledger as good if two thirds of the nodes running the ledger are honest. So it would take a lot of malicious nodes to pose a threat to the network.
So Theta Labs has come up with a multi-level BFT consensus mechanism that addresses those problems. It allows a very high transaction throughput of over 1,000 transactions per second. The way it works is there 2 tier Nodes system as described above. The 1st tier are the Validator Committee, which is 10-20 Nodes that produce a chain of blocks as fast as possible. Then once produced the 2nd tier, Guardian Nodes, can finalize the blocks and convince each honest Guardian Node that two thirds of them agree and see the same chain of blocks.
Since there could be 10-20 Validator Nodes and thousands of Guardian Nodes, the Guardian Nodes could take a substantial amount of time to reach consensus. So in order to keep the Guardian Nodes in line with the Validator Committee they need to only agree on the hash of the checkpoint blocks. So as long as two nodes agree of the hash of the block with overwhelming probability it accepts the block.
Since most payments on the Theta blockchain are tiny (micro-payments) and need fast confirmation so this scheme suites it well.
There is so much we can talk about with the Ledger but I think that is a great overview so far. There is one more topic that needs to be discussed and that is History Pruning of the Ledger.
The state of the Ledger and the token balance for each account is stored with a process known as Merkle-Patricia.
Each Node in the tree is given an attribute called 'reference count'. The reference count is equal to the number of parents each Node has. In the initial state each Node only have 1 parent so every Node starts off with a reference count as 1 (figA). When new transactions are added to the block (figB) a new Merkle state is created and new roots. When that is done the reference count for the children nodes are now 2 and the previous parent nodes (figC) are set to 0. At some point when storage space is needed to be saved everything with a reference point 0 is deleted (figD). Kind of think of it like de-fragmenting a hard drive.
What's great about the Theta network is that it could easily be used to stamp out piracy. Since tokens are used to stream and cache it can be used to authenticate certain content or as premium content.
The Theta Protocol doesn't have to be used just for streaming. It can be used for other plans as well. Regular content delivery, something similar to file sharing.