Raiden Network Explained: Continuing the Blockchain Revolution

How State Channel Networks Continue What Blockchain Began

1
Raiden network explained

The promise of Bitcoin – and, essentially, the majority of other blockchain-based technologies – was simple. Bitcoin was developed as a decentralized currency and a payment system. While the decentralization part has mostly been fulfilled, it is the payment part that is getting increasingly more attention. Ethereum, with its support for ERC-20 tokens, has an even harder task: support payments for what is now more than 3500 different types of tokens. In this article, we will explain the Raiden Network: what it is, how it works, and how it will augment the Ethereum blockchain.

What problems does Raiden solve?

In its current state, blockchain technology has a lot of limitations, making it incapable of being used as a global payment network. Limited number of transactions per second have in recent months troubled both Bitcoin as well as Ethereum network. While Ethereum’s throughput has been two- or three times higher than Bitcoin’s, with recent ICOs happening on the Ethereum network even that has showed not to be enough. Then there is the problem of finality. Ethereum’s average block time of 15 seconds – and the fact you need to wait for a few blocks before you can consider the transaction final – make it impractical to use the network for instant payments.

The reason for these problems is the need for global consensus. Every payment between two parties has to be confirmed by a global network – every participant in the network has to agree on every transaction. This kind of consensus is expensive, making every single transaction expensive. It also requires every transaction to be publicly visible on the blockchain, which might not suit all the participants and all use cases.

The aforementioned limitations – scalability, transaction finality and transaction privacy – are the ones that state channel technology is trying to solve. It was first proposed as an extension to Bitcoin called the Lightning network. Raiden network takes some of the ideas from the Lightning network and implements them on Ethereum. Both Lightning and Raiden are currently still in development and we have yet to see which blockchain will be the first to get an implementation of a state channel network – allowing for fast, private, secure, inexpensive decentralized payments.

How does it work?

Some technical facts

The current client is being developed in Python and can run on a Raspberry Pi. Will be able to run on cheaper devices when written in a compiled language. Light client will be written in JavaScript, being able to run in a browser. The network will support up to a million transactions per second. It uses UDP protocol to communicate.

Raiden brings the payment network off-chain. The reasoning behind this is, not every payment needs to be agreed to globally – we only need to have both participating parties to agree to it and to have a proof of the transfer of assets between them. This brings us a different perspective on consensus – instead of global consensus we can use local consensus between participants.

This is achieved using state channel technology, built on top of Ethereum. While Raiden enables us off-chain payments (transfers), smart contracts enable secure on-chain settlement. Let us imagine two participants, Alice and Bob. They want to open a payment channel, allowing them to transfer assets between them. They deploy a smart contract on the Ethereum network, saying they are opening a channel between them. A payment channel is a bidirectional channel used for asset transfers. Both participants need to make a security deposit to the channel – the smart contract is holding these assets on their behalf. The deposit is then used off-chain for payments between them.

Once that channel is open, the participants can send assets to each other. Only the current state of the channel is saved. Let’s say Alice wants to send 5 tokens to Bob. She signs the message “5” and sends it to Bob. All balances are updated off-chain. Bob now has the proof he received 5 tokens from Alice – if he wanted to spend them, he could go on-chain and close (settle) the channel. If Alice wanted to send another 3 tokens to Bob, she would take the previous value of the channel (5), add 3, and send the signed message “8” to Bob.

The only time the participant need to go back on-chain is when they want to use their tokens – that is, use them outside of the Raiden network. Let us say Bob wants to claim the 8 tokens he received. He goes on-chain and calls the channel’s close method. The only information that the channel receives and writes to the blockchain is the net outcome of all transfers – the information about individual transactions stays private. The closing of a channel opens a settlement period – a time window allowing for dispute resolution. Let’s say Alice closes the channel, but lies about the amount she has sent to Bob, presenting to the blockchain only the proof of the first 5 tokens she sent. The settlement period gives Bob time to open a dispute and prove Alice is lying by presenting the second signed message. The smart contract, which has the control of the deposits until the end of the settlement period, then grants the correct amount to Bob.

The Network

In reality there are not many use cases when one would want to send a lot of transactions to only a small number of participants. We want to send a payment to anyone on the network, and it would make no sense if we needed to open a channel between all of them. And this is exactly what Raiden allows us to do. It is designed to be a payment network, allowing us to route payments through different nodes that are participating in the network. That means Alice, having a channel with Bob, can send a payment to Charlie as long as Charlie has a channel opened with Bob. This works through an Ethereum smart contract called a channel manager. While each payment channel is a separate Ethereum smart contract, channel manager is a global contract, used for deploying channels. It has the knowledge of all currently open channels between all network participants and this info is used to find the shortest (least expensive) path through the network. The routing nodes will collect a small fee for the transfer, each node publishing its fee to its peers. The fees are expected to be extremely low, some suggest fees seven orders of magnitude smaller than the current Ethereum transaction fees.

The state channel itself has no knowledge about the network. When Alice pays an amount to Charlie through Bob, the Alice-Bob channel only knows about Alice-Bob transfers, it has no idea about Alice-Charlie transfers. We have mentioned that when closing a channel, a net amount of all the transfers on the channel will be publicly visible on the blockchain. However, because of the network property of the system, this means there is no way of knowing which participant the payments came from, which essentially makes it private. Using a route with multiple hops makes it completely private even off-chain – only the first mediator will know who is paying and only the last mediator will know who the payment goes to. The protocol uses a mechanism called hashlock to prevent one of the mediating nodes to keep the tokens instead of transferring them to the final target.

Making things easier for the user

While the mechanics behind the network sound somewhat complicated, this will not affect the usability. The end users will not have to manually select participants to open a channel with or a path to route the transfer through. The participants will only need to open a software client and tell it the amount of tokens they want to deposit – the amount of tokens they are willing to use on the network. The client is going to take care of opening the channels for the participant to have good connectivity. It will also take care of finding an optimal route to the recipient and transfer the tokens to the appropriate Ethereum address.

Participating in the network will not necessarily require participants to run a full Raiden node. While it will probably not be available as soon as Raiden network is released, the Raiden team is also developing a light client. It will allow participants to just start their computer or phone and make a payment without running a full node all the time. This however means that the participant will have to authorize a third party service for doing dispute resolution in their name. When the participant will go offline, they will first send the proof of balance to the dispute resolution service and pay some fee for the service. They can than go offline and be sure they don’t lose their asset.

What can I use it for?

So what kind of assets will we be able to send through the Raiden network? The protocol currently supports only ERC-20 compatible tokens. ERC-20 is a standard token on the Ethereum network, used by all cryptocurrencies issued on the Ethereum network, except for ether. Each asset type (each separate type of token) will have its own channel manager running, forming its own network. The requirement for ERC-20 compatibility, however, does not mean you will not be able to send ether. It is possible to create a smart contract, encapsulating ether in an ERC-20 token. Since Raiden is designed to be open and expendable, such a contract will probably be built, together with a wallet enabling users to send ether along with any ERC-20 token in a completely transparent way.

While a payment network is the primary use case we think of when discussing a state channel network, the concept of state channels also allows for off-chain smart contracts. Off-chain smart contracts are smart contracts, that are not deployed on-chain, but have provable execution. This will allow for everything that can currently only be done on-chain to be executed off-chain.

Micro-payments are another possible use case. While browsing the internet, we could pay for the content using small payments over the Raiden network – something that high payment fees of today, either with cryptocurrency or using a credit card provider, make impossible. Machine to machine transactions, API economy, etc. – there are whole fields of economy that do not yet exist today which such a network will enable. The Raiden team is currently also developing raidEX, a decentralized exchange built on Raiden.

We have already mentioned the advantages of Raiden over the Ethereum network itself. But are there some advantages of Raiden over Lightning network? The first obvious advantage is that Ethereum’s support of Turing-complete smart contracts make such a network easier to design. Also, channels in Lightning are designed to have a lifetime, while a Raiden channel can run forever. This means less on-chain transactions, making the Raiden network less expensive to run. Compatibility with different tokens even make it competitive with today’s credit card companies. Raiden network promises a throughput up to a million transaction per second, making it more than enough to handle Visa’s average 2000 transactions per second.

Raiden development

What everyone reading this article probably has on their minds right now is: when? When will the platform become available? When will I be able to use it? In February 2017 it was expected for a minimum viable product to arrive in March. We are now nearing the end of August and no date seems yet to be set for the release. Since then, the timeline has split. It seems we will first get a developer preview, before the final product is released.

What is causing the delay? We have no official word on that, but we know building software is hard. Building reliable, secure, decentralized payment network without global consensus is even harder. While we would all like to see this technology as soon as possible, it is better to get a secure network without any shortcuts and compromises. Nobody wants to lose assets because of a hack, and we should be prepared to wait a little bit longer if needed. However, it does seem the development team is very active and it is possible we will at least get the developer preview sometime soon.

Raiden network is an open source project, developed primarily by a company called Brainbot technologies. While Raiden core protocol itself does not need its own token to work, the light clients will rely on services of others, e.g. Raiden full nodes, pathfinding helpers, monitoring services. This means it is possible there will be a Raiden token to pay for these services. We do not yet have an information whether Brainbot will hold an ICO for the token – if they will, we definitely look forward to it. Seeing that developers are committed to bring us a world changing technology rather than using shortcuts to bring them a quick buck makes us very optimistic about the future of the project and we are looking forward to get our hands on a developer preview.

Conclusion

The speed and transaction throughput of today’s blockchains is simply not enough for them to be used as a payment network. While Ethereum developers are already working on a solution to scale the blockchain (sharding, proof of stake, etc.), there is no need for global consensus to confirm a payment between two participants. The Raiden network will eliminate the need for global consensus, scaling up the network by reducing communication as much as possible to still have secure and provable transactions. State channel networks will continue the revolution of decentralization that blockchain technology started, changing our world and the economy forever.

 

David Starina