Ethereum
(Ethereum Homestead)

State channels are a hot topic in the blockchain world. The Lightning Network will reframe the Bitcoin blockchain to minimise the amount of data broadcasted to everyone by having a final netting of many thousands or even millions of transactions into a single on-blockchain transaction.

Such a step-change puts cryptocurrency on an even footing with the likes of Visa, and by allowing micro-transactions without fees, also opens up possibilities for internet of things (IoT) or micro-payments for web-based content.

Ethereum's version of Lightning, called Raiden, just finished its first proof of concept which involved sending tokens from a Raiden client in Copenhagen to one in Mumbai mediated by a node in Florianopolis. The opening, closing, and settlement of channels took place on the Ethereum testnet, while the actual transfers happened off-chain.

Heiko Hees, CEO of brainbot technologies and creator of Raiden, contests that Ethereum is better suited to Lightning-like payment channels than Bitcoin.

He told IBTimes UK: "In Bitcoin the scripting language is rather limited so it's way more complicated to set it up. Setting this up on Ethereum is straightforward; any developer can easily understand the smart contract involved. The other difference is that until Bitcoin implements Segregated Witness to fix the transaction malleability issue, they cannot do Lightning."

Hees explains that a payment channel is implemented by having a contract on the blockchain, and the contract needs to know who the receiver is in that channel, and who the sender is. Then the sender deposits some tokens with that contract and the contract holds them in escrow. An off-chain tally of transactions are signed with digital signatures and when those signatures are accepted some goods, for instance, can be exchanged up to the value on deposit or in escrow in the smart contract.

Hees said: "The important thing is that I sign you the accumulated balance - that's what I owe you in total. At any point you can go to the smart contract on the blockchain and see I signed you can have £5 and then the smart contract will send £5 to you and send the remaining tokens to me."

But taking an example of playing a poker app, where you want to play multiple rounds of poker with many people, you would run into problems because of the deposits.

"While this allows to have multiple transfers off chain, it only works until the deposit is exhausted and one needs to have a deposit with every possible recipient. It's a good solution to e.g. pay for 1,000 page views on your favorite paywalled website, but it is not suitable for payments to many different receivers."

"So what we do instead is, say everyone has opened five channels with five random people, and if multiple users do that, what you get is a connected graph of channels. Think about Facebook; you can probably find a connection between any two people using multiple hops of other friends. Basically it works the same.

This multi-hop approach means there can be many transactions concurrently which don't interfere with each other. This means it scales linearly with the number of participants on the network; the more participants, the more ability to transfer tokens.

"But the problem is that if I sent some coins to you I have no guarantee that you sent those coins forward to the person I want to pay. Therefore you need a hashlock with some cryptography to make sure you cannot run away with the money.

"This, combined with those channels that are bi-directional, allows the tokens to flow in both directions, and then you can do payments between any two participants," said Hees.

State channels also provide privacy because transaction data no longer has to be broadcast to the network in toto. This potentially makes things like Raiden interesting to privacy-conscious corporates. "Yes, I actually know they are interested in this. We are already talking to them about it," Hees said.

A blockchain design which can facilitate transactions without the need for consensus or fees attached is a good fit for IoT devices and the nascent machine to machine economy. Hees thinks the coming wave of non-incumbents and startups building apps for IoT will probably opt to work with an open technology stack.

"I think that's very good from the perspective of IoT developers, and especially as the IoT economy will benefit from interoperability between multiple devices which could be senders or actuators, and the blockchain could be a common rail to put the infrastructure on. Look at IBM, Samsung, Microsoft, SAP: I don't see how they could easily decide on this, so blockchain could just emerge as a common standard."

Raiden is aiming to demonstrate that the system can scale to as much as 100,000 transactions per second. Hees said this proof may happen by the end of this month but it's hard to give guarantees. He said the system can allow transactions as small as a millionth of a dollar. In addition to IoT, he said other likely use cases include general machine to machine, so talking to APIs is another one, if you think about apps which talk to many APIs.

The other obvious use is in the content industry where micro-transactions have been tried without success in the past. "One can assume there will soon be prototypes of blockchain systems to implement efficient micropayments for websites, videos or content in general. And maybe this will also work in the traditional advertising market, so an advertiser could pay really directly without going through a platform that directly paid the amounts per click. So an advertiser could pay a content provider directly without going through a centralised platform which takes part of the revenue"

State channels have also been described as "cryptographic courts" which are there in the background but only need to be invoked if there is a dispute. Hees said: "You can have any business logic off-chain and then you just need to monitor the transactions. If there is a dispute, if someone signs the wrong state update, then you could bring that on the blockchain and say, hey this guy tried to have an invalid state update and he would lose the deposit.

"Having logic that can be checked on the blockchain, combined with game theory, whereby punishments can be expected for ill behaviour, allows you to really have complete applications out of the chain and the blockchain only as an arbitrator."

Hees pointed out that such applications can be fast, scalable and keep their state private, while still inheriting the security guarantees from a blockchain. And while businesses do not want to have their transactions on the blockchain, they might want to use the blockchain to have a deposit, to have arbitration contracts in case something goes wrong.

Therefore state channel based applications secured with collateral on a blockchain might be superior to private chain setups, as these lack the collateral to give real execution guarantees, are costly to setup properly and most importantly cannot leverage synergies with other applications, he said.

"They might also want to use it as rails to interact with other services; they could interact with those other services off chain, but nonetheless there needs to be guarantees that those services act as expected.

"That could be guaranteed by the blockchain, which allows you to challenge invalid state updates. I see a whole ecosystem that could emerge where jurisdictional-based technologies are used by businesses to have interoperability between them."