In our previous article, we touched on ChainLink, which helps connect on-chain smart contracts with required information from off-chain resources. This addition means that the parameters of smart contract usage can be expanded greatly into every corner of our everyday life, from insurance to travel.
In this article, we delve into a cryptocurrency that targets a different, but equally important, limitation that Ethereum has been plagued with: scalability.
At time of writing, Ethereum can process about 10–20 transactions per second. It takes about 15 seconds for a block to be formed, and requires multiple confirmations for it to be valid. This brings up the total time for a transaction to be confirmed to about 3–5 minutes or more, depending on the amount of gas paid. The reason for this is that all nodes need to be brought up to date about the new transactions.
While 5 minutes that may not seem like a huge amount of time, people these days are used to the standards set by centralized servers. I myself used UOB’s Internet banking to transfer money to a friend, and it took about 2 seconds for him to receive the money. With Ethereum’s blockchain, this kind of speed is not possible.
Raiden Network (price as of writing RDN $4.12) aims to solve this problem through State Channels. This was born out of the realization that the current blockchain requires every transaction to be verified before it is added to the chain, but it is not necessary for a large majority of transactions.
A state channel is an off-chain, private channel between parties. How it works is that the initial state is locked into the Ethereum blockchain, following which they conduct all their transactions off-chain. The final state is then locked into the blockchain.
This is much like opening a tab at a bar. Rather than paying each time a drink is ordered, there is a tab that is accumulated throughout the night. At the end of the night, the total bill is presented to the client, and he signs off on it.
By doing so, both the patron and the bar benefit. The payment is done quickly and efficiently, and the bar does not need to keep registering each transaction individually. Rather, it does a single bill with all the required information.
Applied to the Ethereum blockchain, it means that not every node needs to know about transactions between the patron and the bar. It just needs to know the end result of all the small transactions: (amount of alcohol) was served, and (amount of payment) was received.
If there are disputes about the final state, each party can upload their final, signed state to the blockchain for verification. Each state has an increasing nonce, which makes it easy to identify which is the latest and most accurate.
How does Raiden Network work?
Raiden avoids the bottleneck that Ethereum blockchain consensus presents by using these state channels. These payment channels allow for secure transfer of value off-chain using any ERC20 compliant token.
The parties first start by locking in a certain amount of ERC20 compliant tokens on the Ethereum blockchain. This amount is held in escrow, which means that no payments higher than the amount can be executed. As tokens are transferred between parties, the balances are adjusted accordingly. No on-chain tokens can be claimed before the state channel is closed, to ensure that there is no risk of double spending.
Alice and Bob set up a private state channel, and each lock in 10 RDN. If Alice sends 9 RDN to Bob, she is now only able to send a single RDN. If Bob then sends 10 RDN to Alice, she can now send up to 11 RDN, and Bob is able to send only 9 RDN.
If Alice and Bob are done transacting, either party can initiate the closing of the payment channel. Payment is then determined by the smart contract when signed copies of the final state are sent, and the tokens are distributed accordingly to the parties involved.
While it is possible to open up multiple payment channels, it might not be desirable for a regular user: the funds are all locked in escrow, meaning that opening up multiple state channels would lock up more and more funds which cannot be used with other parties.
Alice wants to transfer RDN to Charlie. However, she does not wish to open up a state channel with him. She does have a state channel open with Bob, who in turn has a state channel open with Charlie. The Raiden Network finds this link, and uses her escrow with Bob to transfer payment to Charlie.
To ensure that the payment cannot be hijacked halfway, a multihop transfer is hashlocked at the start, and requires a key to open. When Alice receives cryptographic proof (signed transactions) that the payment has been made to Charlie, she has to release the secret key which allows Charlie to take the payment from on-chain.
In the above example, Bob is considered a facilitating node: he is the one that makes payment between Alice and Charlie possible off-chain. To incentivize him, he will be compensated for in RDN tokens. The payment is cheaper than paying gas on the Ethereum network, and is kept competitive as the Raiden Network will help Alice choose the optimal multihop route to take. If Bob sets his fees too high, Alice’s payment will be routed through another payment channel that charges lower.
The Raiden Network allows for secure, fast and cheap transactions to be conducted between parties. This brings Ethereum one step closer to being integrated in everyday life, as it could replace centralized third parties such as PayPal for doing micro-transactions. In addition, it scales according to the size of the network: the more people are in the network, the more transactions can be done. This means that it will not face a bottleneck issue as the network grows, but rather grow linearly as the number of participants increase.
The value that Raiden Network brings to the Ethereum ecosystem is the main reason that brought it to CryptoGrinders attention, and we look forward to what they are going to do in the coming year.
Click here for the next article on the Request Network!