Interview with Jeff Coleman of State Networks at DEVCON1 in London

4 Mar 2016 · 27:06

Jeff Coleman, a consultant focused on state channels, discusses the concept at DEVCON1 in an interview with Epicenter. The conversation covers the latency and scalability challenges facing Ethereum DApps, how state channels work as a solution, what is needed for their widespread adoption, and how they differ from Bitcoin's micropayment channels.

Speakers

Topics

Transcript

hello everyone right now i am with Jeff Coleman who is a consultant based out of Toronto today he's going to be advocating and talking about a very important topic which is called a state channel and it's one of the ways by which blockchain technology could scale to the billions of people it needs to scale do before we get into that team let us have an introduction from Jeff so my name is Jeff Coleman I worked with a company called ledger labs in Toronto Canada I've been very active in the block chain space for a while since 2010 and I do a lot of writing a lot of consulting a lot of speaking and some research some of which I presented here

at the conference and I'm very passionate about the idea of state channels I think it's something that everyone should understand and be aware of and even though we're a little bit familiar with some of the ideas in it already I want people to understand that it's a really very simple concept and it can make things a lot better ok so so in that sense the problem with the current block changes when you weren't on a build an application on the cerium you faced with two things one is the latency of the blockchain yeah waiting for the blocks for sure so for instance if you think you need like three confirmations depend so the latency depends on how much security you want out of a

transaction but you want say if you're on three confirmations then it's a minute that's a lot for one operation and then the scalability or the cost of an operation so right now it might be below below and ISA let's say one tenth of an eater but it might easily explored into a big number if each idiom becomes popular for sure and it's not only about what confirmations it's it's not so much about finality and conclusion and security being only possible and watching it's just that when we do do things on the blockchain that we have to wait for confirmations and of course it's great with athyrium that those confirmations come about every 15 seconds instead of going like 10 minutes or something the

greasy with Bitcoin but there there is a way of thinking about it that will help you restructure your your applications so that even then you don't have users clicking a button and then waiting for 1530 seconds well something figured something out in the background okay so what is a state channel state channels are very simple they're an idea that we're already familiar with in the form of payment channels payment channels are an example of state channels but it's important I think to think about them in the general case because a lot of what we've seen about payment channels or stems called micro payment channels in the Bitcoin world it's a little bit it sounds complicated and it sounds messy and that's just because of the way that those have to be implemented in the

Bitcoin scripting language and when we start thinking about them in terms of state channels we see that it's actually very simple so I'll just jump in and explain the three parts that make a steak challenge there's just three parts the first part is you have some state you have something that could be tracked on the block chain it doesn't have to be money it could be any information and this information this state that's trapped in the blockchain is going to be dealt with or interacted with by a defined group of people so there's some flexibility that could be more than one person it could be two people but there's going to be a defined group and that defined group is going to get together and agree to take that state

and lock it up and lock it up into a smart contract so that's step one you take the state you lock it up into a smart contract now the smart contract it has two parts to it one part is if everybody who's involved agrees then the state can be reconfigured so for example in Bitcoin this is done with multi signatures so multi signatures are away for different people to sign off and say yeah we all agree that this is the way that things should actually be but then the important part of what makes it a state channel is you have another part which i like to call the judge and the judge is something that can say you know what even if everybody doesn't agree or we have some conflicting points of view these are the rules for how I'm going to

settle this and what that means is that in part two of the state channel so you've locked up the state now that you have the parties who have agreed to this state and you have some something that's inside of it some money some property some agreement now you can send messages just directly between each other promising what you're going to do with the agreement and you know that the judge on the block chain will treat those messages as the rules and it will take those message and it will enforce them so that if you make a promise to another person even though you haven't put in the blockchain yet if you disappear or if you go away they can take that promise and go to the judge and say this person promised me that I could have this amount of money or this person promised me that that this state

would be changed in this way and the judge will take that promise and then not just listen to the one person will say kind of weight and turn to the other person say do you have anything to say did is there another promise here that change this agreement later and if it did then we'll change that and because you know that the judge is always going to decide exactly what you've agreed on it means that those messages are actually final so even though you haven't sent them into the bloch and yet because everybody knows what the judge will decide just as soon as you have the promise you can count on it as being done so that's part 2 part 1 it's locked up on the box chain with the judge part 2 you're sending messages between people there you can think of them as promises

or agreements and you're signing off on them and you can't you can't update the the state without the agreement of everyone who's affected everybody has to have to sign off on these agreements and agree to it so it's it's still trust less it's not you're not you're not you're not trusting the other party you're just interacting with them you still have the full guarantees of the block and then part three is when you're done with everything and you want to close it out and this might never happen you might keep this open forever but if you're done with it you want to close it out then as long as you all agree you don't even have to use the judge you just as long as everybody signs off and says we're done with this arrangement we agree that this is the final consideration of the state this is how

everything should be you just submit a transaction and instantly the state updates and go about your way but if there isn't complete agreement if if one person has disappeared and and the other person is trying to figure out what to do or if one person says this is the case no this is the case and they can't agree then they'll just submit the promises that they have to the judge and the judge will take the latest promise that that trumped all the other promises and say okay this is the one and I can tell because everybody has signed it so you're guaranteed that this state is going to be closed out in a way that corresponds with what everybody's agree with so let's take an example and the example I want to take is a a company running on the idiom blockchain let's

say let's say they're five of us and we start a company so it's my hair it's Jeff Alice Bob and Carol the five-oh-first start a company and we create a smart contract that represents our company and we issue shares and the five of us are frayed owners in the company so its twenty percent twenty percent Alice requested every one of us gets free and then all of us put you know a thousand Eastern or websites five thousand eaters in the contract see how the contract has tokens if I was owned those tokens and it has five thousand ETA in them and it's all long in a smart contract yeah and and the way that people would normally think about this is you have kind of like a list kind of like a ledger in the block chain

and you're going to record who has this and any time you make any changes you're going to submit a new message to the Boche yeah so this is a normal way to think about it is now let's say my head wants to sell or ten percent of the company to the next person which is I don't know table so the normal way to think about it is our mayhem will now send sell it to Tim and then send this message to the blockchain the block chain will confirm it will take a minute yeah it will eat up gas but the transfer would be done yeah and what you're saying is instead of mayhem sending the message to the blockchain what these five people are we to do is to lock up the current state in the blockchain and then do all the transactions they want

that want to change this current state outside the block chains is outside the blockchain yeah so for example in this case when I'm transacting outside the blockchain if i want to send the shares to tim i basically sign a transaction that says you know transfer they claim for these shares in that locked up state on the blockchain to tell me and tim has that received for himself right right so in this case there's kind of two different ways that you could be doing something here so either remember that's the state in a state channel is with a defined group of people so either Tim is part of that defined group in which case he's going to be one of the people passing

the messages back and forth and then all you need to do is you're basically sending that promise to Tim and Tim knows that if he went to the judge he could cash in on that promise but maybe he knows that there's going to be more changes in the future so he doesn't want to go back to the judge all the time so he just holds on to it for now and then maybe he'll be trading it back and forth or maybe the maybe there's if there even a market for these shares and you're going really fast back and forth making lots of changes so that's one way the other way is it could be the group agreeing that the company is going to give shares to Tim and Tim isn't part of the group so in that case as long as as everyone in the group who could

potentially be affected by this is signing off on this this new share issuance whether they're creating some new shares or maybe they're selling some of their existing shares and maybe they're going to do this frequently and they're going to make a lot of changes as long as they've set up that judge correctly they can do this in a way that most of those interactions don't require them to send a message into the block chain so that could be for the the tokens it could be for the the ether that the company controls anything that it wants to do and and this is where the concept gets really powerful because even though those people just have an agreement amongst themselves if these agreements are connected together this is the idea in Bitcoin of the Lightning network or hub-and-spoke payment

channels but it applies to state channels as well if you have these connections that are all adding up together you can make it so that maybe that group doesn't have an agreement with Tim but they have an agreement with a hub and the hub has an agreement with Tim then if they send a promise to the hub and the hub is part of their there group and then the hub has a different agreement with Tim and the hub for words on the promise to Tim and the promise to tim is dependent on the promise from this group to the hub this can be done trust lessly so that even the spending of the ether to maybe a completely different company that Tim is involved with or that somebody else is involved that they've never interacted with

before that can all happen with just this special passing off the block okay and the big advantage it is that since you're not the transaction is not in the blockchain the latency Falls to basically the speed of light it is exactly it's literally you're just setting a message so you have to sign the message you have to so that the judge can later verify that it was actually authorized by you and then you have to send the other person they have to check the contents and make sure that it's a valid message that they're convinced the judge will accept it and process it correctly and then if the state affects them they have to sign off and agree yes I agree to let this affect me and then send back the confirmation and you're done so it's almost as simple as just sending a message to a web page

in back and you don't have to sit around waiting 15 seconds for blocks and also we know that storage and transactions and computation on the block chain is expensive because everyone on the network has to do that well in this case if the judge is being appealed to every one of the network has to do that but in most cases because the participants already know what the judge is going to say and there's some additional cost to using the judge they'll prefer to just all agree unanimously and all sign up and say yeah I agree that that's the case even if one of them is maybe in the wrong like if one of them may be tried to defraud the other and the other person comes back and say hey I have proof that you tried to defraud me and if I take this to the judge he will

punish you and the person will say no no I'll pay it back in full right now because I know that if I go to the judge I have to pay it back anyways and get some additional punishment so for example if you have some deposits that the judge is the power to destroy our conference key so in a sense DVD reason this is possible is is because of I think Nick starvos concept of red code versus trifle it's like the normal the normal system of jurisprudence that we have is wet code it is reliant on human subjectivity of the judge but in this case when you go into a smart contract based system like a serial the whole code is dry and it's completely deterministic given a particular set of

inputs the output of a computation is completely to mind so if there's something on the blockchain you can exactly predict and the block chain is a judge you can exactly predict what the judge is going to do exactly and now because I let's say the five of us are in this company and I know that I am exchanging messages with each other even if i want to defraud you i know in the back of my mind that there's the judge and he's dry cold and I know that he's going to do beside in your favor and it's going to cost me money to run this thing on the blockchain so basically I I end up not a fraud of you right so it's kind of like you can extend the metaphor

into kind of a social metaphor and think that if every criminal always knew that the police would catch them they're probably a lot less criminals because they the police would actually have a lot less work because they're so powerful incompetent and it's kind of the same situation with state channels where you have to write a judge to whatever whatever you're going to do the judge has to have all the rules that say exactly what happens in what case the judge has to be able to verify and prove just in a program that everything happened but as long as the judge has that code for how to handle the situations you'll probably never have to use it because people already know in advance what the judge is going to say and they're just going to agree to it anyways rather than have the additional cost of involving the judge that's

that's that's that's a really bold ideas it's extremely powerful extremely helpful and almost every application that i see built on etherium could be modified to work this way so a lot of times when you see something like maybe you see someone with a smart lock and they've got something where they're going to send a message into the botching to authorize someone to use the lock well that's not necessarily something that you need to put on the blockchain if you're going to have millions of these locks over the place that's a lot of noise and message is going in there what you really want is you want it so that there's a lock of who's able to control the the smart lock or whatever it is that you're trying to control on the

block chain and then you just send a promise to this person and they can send that promise to the lock and the locks goes to itself okay so if this was submitted to the block that botching then the judge would agree so I can actually just listen to this now I don't have to wait for a block confirmation and that that just means practically speaking that and to a certain extent people already already do this where every time you walk or unlock the door you're not going to send a message to the box chain every time you invite a new friends to give have the permission to lock and unlock the door you don't have to send a message to the block chain but you still have the security of the box chain because in the end if if there's not a very clear digitally

signed approval that that the lock knows that the judge would respect then it's not going to do anything and if there is any confusion where maybe somebody says you know what I did I did give you this update but then I later revoked your access so maybe I gave you a promise and says that you could read my home but then I found out something about your credit history and that you defrauded people in the past and I immediately revoke that access well because of the way the channels work every time there's an update everyone is aware of the update so the lock would be immediately notified you don't even have to wait for a block to shut out this this person that you previously agreed to and it will instantly know to be instantly alone cool awesome

so what are the barriers to moving to this kind of architecture why don't we hear of it more often so it's just slightly more complicated than the way people are used to building applications so normally the way people think about a blockchain application and this is this is totally reasonable totally makes sense is there thinking what do I have to store what code do I have to enforce the rules on what's being stored and then how do I build a user interface that interacts with this and you need almost all the same things to do the same application based on the state channel it's just that instead of that code being the normal way that you interact all that same code is going to be there but it's going to be inside of

this judge wrapper and the judge is going to have the ability to enforce all of those rules and check all of those things and you're going to have to structure it sometimes you have to additionally take into account which people are interacting with which people because the normal way that this block chain application is designed is the block chain is at the middle and everyone is interacting with the block chain well if you're going to go into a state channel you probably don't want everyone to interact with everyone else that would be a little bit crazy you want to make it figure out who do is everyone actually have to interact with and you might if you're the one who's running the contract you might end up running your own server that's kind of a hub that everyone else interacts with and then the hub and the interactions

with that can be decided by the judge that people are still confident that the interactions are trustless you're not being given the power to change things if if you have some kind of disagreement or some kind of internal fraud or maybe you've mismanaged your institution people's funds are not going to go up in smoke this is going to be among type situation but you just by being available and being in that role you facilitate things between them so you have this additional wrapper around the idea and then of course you now become responsible for passing the messages yourself because in the traditional architecture everyone just watches the blockchain if something changes the application changes you now have to figure out additionally how to send these messages back before so it's a little more complicated it's not as you

bad it's a little more complicated because what essentially starts to happen is you need to interact with the blocks in order to lock this state and unlock later right just in the very beginning when you set it up and at the end when you clears it out but for the for the for the client software's on like that's the only five people they do need to interact with the blockchain twice and then there needs to be maybe a central server that coordinates all of all of the five people so it becomes this kind of hybrid model that like a decentralized Network and maybe a centralized server on top and then people communicating with the updates to that centralized server so it's it's kind of maybe a more complex architecture that we will get to in the next couple of years absolutely this

this will have to be built out and we really are going to want all these different things to be connected to each other so for example in terms of even just the payments use case you don't want to have to be setting up and on setting up this interaction every time you start to use a new website or start to use a new service you really want to be already set up with maybe just a couple of really well available well connected reliable hubs that you know we're not going to go down when you're trying to make a payment because remembering when they go down they can't take your money but it might delay you because you might have to go and say to the judge hey you know I have this promise and this person is not here and I need to get this money and you can

always do that you always have the recourse but doing that it's going to slow things down so you want to be connected to just a few reliable things and then maybe they're going to be connected to a lot of other reliable things and those are going to be connected to the users and you want to have this this whole topology set up so that if I'm interacting with someone I don't have to already have an existing business relationship with them we're going to help somehow be able to connect through our network and then through that network be able to instantly transact so when I've been looking at some of the ideas and I realize that because we are so early in the development of smart contracts that the kind of contracts people are making today could be in serie completely trust less but the developer

still wants to retain control over how the contract behaves because they might be a bug in it so if the developer wants the discretion of having the power to update the contract just to avoid the pulse now if in a state network you are also assuming that once you have locked the contract you can't change what's happening because the smart contract itself so maybe the maybe like the ways by which we script smart contracts or our confidence in smart contracts has to increase to the point where we can say that look we are never going to touch the actual smart contract on the blockchain so let us do everything on change so well this is the really important part about etherium so when people are used to talking about payment

channels in the context of bitcoin remember this judge that i'm talking about in bitcoin you don't really have the ability to write a judge and put them on the blockchain so you're trying to simulate a judge with all these additional timing things and things like this in a theorem you have an actual judge and you can update that judges behavior so you can change the smart contract while it's an operation you just have to define ahead of time what the rules are so like a really simple thing that a lot of people can do if they're writing a smart contract and they want to have the ability to change it make sure that they put in place the rules for the chain so it's not that they have authority to just jump in and change everything around while somebody's using it maybe they have to

notify people and then there's a certain time delay before the change comes into a fact that way people know that a change is coming and they can look over it and see if it looks legitimate or if it's just taking everybody's money so put some kind of additional barrier in there the other side of things of course is that when you're doing these off chain transactions you're doing a lot of verification yourself so that code has to be very reliable and very secure so definitely we're not going to see this belt out overnight it's going to take time to make sure that we figured out all the edge cases and produce standards and find the best possible ways of doing this but once we have because of the complexity that's possible in ethereal then what we're going to find is that you can make very

complex changes even just inside of the promises that you said to each other maybe there's a new kind of condition you want to enforce as long as the judge can understand a general enough kind of promise you could just write that condition into the promise that you made even though you didn't know what the condition was going to be when you set up the channel so what do you think is the first like any big idea needs to start with the small application where you not some a small team of developers can build something useful demonstrates utility you have in mind something small where you could wear you foresee this being applied first convened scaling or destinations to be clear this is already being applied so a lot of the larger more complex applications that people

were designing they absolutely have to take advantage of this approach so for example auger is definitely taking advantage of this approach that's definitely a key part of how they're structuring their application people are definitely working on implementing this for payments in the payment scenario where you're going to have this hub-and-spoke network where you can rapidly send between people a lot of people are talking about this anytime they try and do micro payments or they want to update something really rapidly so a lot of people are using this this idea today what I think people need to start wrapping their heads around is that this really is the default way of doing things this is the way that everything should normally work you know the the block chain is absolutely

amazing and powerful but it's also very expensive everything that's done has to be processed by all these different people and as long as you know that that's reliable you don't have to put everything through there you don't have to dump all of your details on the block chain and in fact not everything belongs on the block you know it's not it's not a big bin that you just want to throw everything into what you need to do is just put the simplest most important part on the block chain and then build your application in a way so that it relies through that and you know a lot of people talk about oh the gas limits are really low right now in athyrium it's hard to write complex contracts chances are if you're running into the gas limits you probably haven't structured your application or retarding

the architecture through exactly absolutely cool so are there any great articles or blogs that our listeners could go and read in order to discover more about Street chance right now there's not a lot of content out there there are a couple of articles that people have written about mostly talking about how you can take the idea of payment channels and make it a smart payment channel and a theorem which i think is kind of the backwards way of thinking about it state channels is just a very general technique and payment channels are just an instance of that technique and even in input point I think people are aware of that to a certain extent but right now there isn't a lot of good detail out there there is I know someone maintains a list on github of all the new papers and

information that I've been written about payment channels specifically and I've seen a couple of great blog post unfortch I don't remember who thereby at the moment but you could find them if you google for them talking about smart payment channels and the idea of using smart contracts in channels but probably over the next couple of months were going to start to see people write up really more detailed explanations and help people understand that this is a really basic critical tool on how you watching so for our front of you that would like to follow the idea of state channels and follow you in your evangelization of this idea they can reach you well I have a short blog that I occasionally throw things up at at Jeff Coleman CA obviously the company my company that I'm connected with leger

Labs has a website as well right now it's fairly minimal but we might throw some stuff up in there later if anything interesting is happening put some links on there and but at the end of the day this is mostly going to be about you know do a Google search every once in a while and just see who's come up with something the cool thing about a distributed ecosystem like the world of blockchain is that people have new ideas out of nowhere it's not someone you were even already following it's just all of a sudden somebody pops up and they've got this great way of describing something and explaining something and they just really change the way that everybody's thinking about it I think that's amazing it's absolutely fantastic it was great to talk to you Jeff absolutely thanks for talking