“Raiddit” — Scaling Reddit Community Points with Raiden
TL;DR
With “Raiddit” it is possible to do 100,000 transactions (and many more) in a short amount of time. There is no limit or set amount of time that it takes to do 100,000 transactions, since the solution scales linearly. The more users, the higher the throughput. On top of that, Raiddit does so in a fully decentralized, low latency and off-chain manner with minimal blockchain interaction, thus keeping throughput high and prices low. For a detailed explanation of the solution and a video that fulfills the demo requirements from Reddit, take a look at the dedicated website and the open source Raiddit repository.
Key properties and features of “Raiddit” in a nutshell:
- low latency
- cheap transfers
- high throughput that scales linearly with increase of the user base
- off-chain minting
- off-chain burning
- lightweight in-browser solution possible via the Raiden light client
Introduction
The Raiden team has been hard at work over the course of the last month in order to make a proof of concept and demo for the Reddit Scaling Bake-Off. For a detailed overview of the challenge and the requirements, you can take a look at the official Reddit post. Raiddit is a payment channel solution based on a modified version of Raiden. To understand how Raiden and payment channels work in general, this website is a good place to start. Due to the fact that fast and cheap token transfers is the core value proposition of Raiden, we never worried about Raiden struggling to process 100k transactions. Some of the other requirements were a bit more difficult to solve with vanilla Raiden, so we had to come up with ways to fulfill the requirements for on-boarding users very cost efficiently as well as minimizing the on-chain actions and costs related to burning tokens. However, the biggest challenge lies in the fact that Reddit users (although we all like to spend a lot of time there) cannot be expected to be online all the time. This problem is inevitably hard to solve in a system that is designed to rely on local states between two parties.
Below, we provide a brief overview of our solution and the results we achieved.
The Demo
To show that our solution works, we’ve created a small demo video. In the demo we are simulating a network with only 100 nodes. We do this, since it makes it easier to demonstrate how the protocol works if we do it from one central point in order to collect data to show. Raiddit itself is a decentralized protocol that scales linearly, so the throughput increases with the amount of nodes participating. With 100 nodes we get ~25 transactions per second. If the number of nodes is increased to one million, the number of transactions per second will be in the ballpark of 250,000 transactions per second. In Raiddit burning works in the same way as transfers so burning scales similar to transfers. If it’s not clear by now, we will make it perfectly clear: Raiddit scales linearly — the more users, the more transactions per second!
Fulfilling the Requirements
As all requirements are already listed and explained in the official Reddit post, we won’t spend time going over them in detail here. Rather we will take a high level look at how our solution tries to solve each of the requirements. As already mentioned, check out the Raiddit website to read an in-depth explanation!
Scalability
As can be seen in the demo, the scalability part of the challenge posed no problem to Raiddit. What’s really cool about how this solution is implemented is that it scales linearly. So the more people participating in the setup, the more transactions can be performed.
We did have to make one fundamental change though — traditional Raiden requires users to deposit funds on-chain in order to make sure that counter parties can be paid out at the end of a channel life cycle. This is costly and slow since it relies on on-chain transactions. To circumvent this, we decided to use virtual channels where Reddit issues claims that represent tokens and the distribution thereof. Because of this, no tokens are being minted on-chain as part of a channel opening. If we combine this with virtual channels, we arrive at a situation where channels can be opened without performing a single on-chain transaction and thus making the system scale very well in regards to minting and on-boarding. At the same time, the price will be kept to a minimum.
This leads us to burning of tokens. Burning happens by having both parties in a channel agree on decreasing the total deposit of one of the participants. This is done by having both participants sign a message that updates the state of their channel and thus leaving less total tokens in the channel left over to be paid out on-chain if/when the channel is eventually closed. The system currently works in the same way for subscriptions, but could in the future be expanded to have a special field that specifies exactly what a burn proof is intended for, i.e. a subscription, a cool tag next to your name or some Reddit gold.
Decentralization
Since Raiddit builds on top of Raiden and aims to stay true to the vision of Ethereum and Web3, it is decentralized by default and no single centralized point of failure exists in the system. Claims are indeed distributed with Reddit being a centralized point, but this is in accordance with how the current community points system works. We are very satisfied with the level of decentralization in our solution and the fact that the users have full control at any point in time.
Usability
Following a decentralized design also means that users are responsible for their end of the state. That is obviously not always the most convenient and user-friendly approach. In theory it is possible to store the local state anywhere and encrypt it to keep it private. However, the focus during the last month has been on other challenges rather than solving this particular requirement. Transactions complete in seconds and can be considered finalized when completed since the receiver will have an always claimable on-chain proof from its counter party.
We have put a lot of effort into changing the original design of Raiden in order to make Raiddit as cheap as possible for the end user. It is completely free for users to open channels and send payment with Raiddit and Reddit can pay for the gas fees related to closing the channels, should they desire to do so. This low cost approach comes at the price of introducing some amount of trust and centralization to the protocol, as Reddit is expected to generate the claims that represent tokens in the system.
Interoperability
Active development of the Raiden project has been ongoing for more than 4.5 years and Raiden has been live on the Ethereum mainnet since December 2018. During this time we have kept on making the protocol more and more stable and robust. From the very beginning we’ve focused on making a simple API that is easy for users to interact with without understanding the complex architecture and code that makes Raiden work. The same goes for our documentation and we have spent a significant amount of time during the Reddit challenge to focus on creating documentation that makes it easy for users and other projects to understand how Raiddit works and how to use it.
Interacting with the Raiddit API is just like interacting with any other API and it is straightforward for third party applications to do so in a permissionless way. By only having to interact with an API, developers can build on top of our solution in whichever programming language and whatever existing infrastructure they want.
Security
Due to the architecture of Raiden and thereby also Raiddit, the system is very resistant to forging, manipulating and censoring of transactions and balances. The messages exchanged between parties in Raiddit are called balance proofs. These messages represent the amount of tokens that one party owes the other party and this amount is always monotonically increasing. This means that it’s always most profitable to submit the most recent balance proof for both parties, since they represent the highest amounts of tokens to be paid out. In the same way, since the Ethereum blockchain by definition is permissionless and Raiddit gives users full control over their funds as well, there is nothing stopping users from settling their channels and leaving the system in order to get their tokens paid out on-chain. As already described, users have full control over their funds with Raiddit and no third parties hold anything in escrow at any point in time. This means that after the initial community points claim has been received by Reddit, even Reddit can go offline and users are still able to claim their tokens on-chain.
Other considerations
As already mentioned, Reddit is still required to sign the token claims. Reddit is however not required to submit any transactions to the blockchain themselves in order for virtual minting to take place. As soon as Reddit has signed and distributed the claims they have no control over the tokens and they can at any point in time be claimed on-chain.
Naturally, our solution is open source and so is the underlying technology that it’s built on! Links to the modified repositories used for Raiddit, can be found here:
- Client: https://github.com/raiden-network/raiden/tree/raiddit
- Services: https://github.com/raiden-network/raiden-services/tree/raiddit
- Scenario-player: https://github.com/raiden-network/scenario-player/tree/raiddit
- Contracts: https://github.com/raiden-network/raiden-contracts/tree/raiddit
Our solution is fully decentralized and local consensus between nodes is required to achieve this. However, being decentralized and having local consensus comes at the cost of not being able to transfer to or via offline nodes. This is because there is no one who the sender can get consensus with. At least not without relying on trusted third parties and undermining the censorship resistance of the protocol.
Closing words
We believe that our solution lays a great foundation for a system that can scale in the range that is expected for a user base the size of Reddit’s. More specifically, we think payment channel networks are especially well suited, because of their low latency, cheap off-chain transfers and because the network’s throughput increases with the number of users.
Work still remains to be done for this solution to be production ready, but we hope that it serves as a good showcase to Reddit and other people interested in how Ethereum will scale for mass adoption. To us, this challenge has been a good way to battle test our own protocol and find out where it shines and where improvements are to be made.
The Raiden team
Disclaimer: Please note, that even though we do our best to ensure the quality and accuracy of the information provided, this publication may contain views and opinions, errors and omissions for which the content creator(s) and any represented organization cannot be held liable.
The wording and concepts regarding financial terminology (e.g. “payments”, “checks”, “currency”, “transfer” [of value]) are exclusively used in an exemplary way to describe technological principles and do not necessarily conform to the real world or legal equivalents of these terms and concepts.