Dan Robinson: Rainbow Network – Off-Chain Synthetics Exchange or “Multicolored Lightning” (#289)

28 May 2019 · 1:12:22

Dan Robinson, a research partner at Paradigm, joins Epicenter to discuss his Rainbow Network paper, an off-chain decentralized synthetics exchange built on payment channels. He explains how the design borrows from the Lightning Network, relies on trusted oracles to let participants trade liquid assets off-chain, and could enable leveraged trades and new kinds of prediction markets, alongside his earlier work on Plasma Cash and Plasma Debit.

Speakers

Topics

Transcript

[Music] this episode of epicenter is brought you by cosmos cosmos is building the intent of the blockchains an ecosystem where thousands of blockchains and interoperate creating the foundation for a new token economy if you have an idea for adapt visit cosmos network sloshed epicenter to learn more and to get in touch with the cosmos team and by Microsoft Azure do you have an idea for a blockchain app but are worried about the time and costs it will take to develop the new Azure blockchain dev kit

is a free download that brings together the tools you need to get your first app running in less than 30 minutes learn more at aka OMS slash epicenter hi welcome to epicenter my name is Sebastian Cujo and my name is Sonny Agarwal today on the show we interviewed and Robinson who is currently a research partner at paradigm and but you know he's had a quite an interesting journey throughout the entire block change space he spent time at chain and was there when it kind of got like acquired by stellar and to worked on that and he then he left to work on joint paradigm which is hedge fund Dan has a lot of

really interesting experiences throughout the blockchain space and you know he'll mention himself but you know I think what he's really good at is taking ideas from one section in the blockchain space and like applying it to another so you know for example like he was the one who came up with the idea of plasma cash and I think you know he was able to do that because of his like intimate knowledge of you know the Bitcoin system where what some of the interesting things about how Bitcoin does its utx owes and was able to apply that to the development work going on at plasma and so the main process that we actually talk about today is his rainbow networks proposal and I think that is

like a completed great example of this where he takes a lot of ideas from you know plasma and inter ledger and lightning and kind of like combines them together into this very interesting proposal yeah and it is a bit of an early project at the moment it's it's a white paper and maybe like I think there's a blog post about it or something or its mentioned in a blog post but yeah reading the white paper probably a good complement to the show because it is kind of technical I guess and requires also like mental mathematics to understand like the payment channels and how they work but in the white paper there are some tables there that at least help you to get a better understand about like how these payments and how these these assets are moving from one party to

another in the channels but yeah yeah interesting character and kind of the link with the previous episode of last week is that Dan actually is the person who got Jill Carlson to work at chain which she mentioned in the episode yeah and like you mention it is a bit of an early project where he mentions in the episode that you know he actually has no plans of implementing it himself but and so you know normally we represented we've been trying to bring on projects or maybe a little bit farther along on their development cycles but you know I think it's actually very interesting to also bring occasion some of these earlier projects because something interesting about this rainbow networks thing is that it was actually a little

bit of a rediscovery where this was actually what the Lightning team was originally working on so Tadgh driger he actually worked on a project called mirrors before coming up with lightning and that was I you know from from the brief you know like the mirrors website is all gone and everything now but you know but I was digging around archive.org the internet archives and you know I'm like oh wow this is actually very similar to the mirror stuff and so it'll be like you know a shame if some of these ideas like disappeared into the night again and so you know if anyone in this after listen to this episode and reading the paper is like inspired to you know take their shot at like trying to implement

some of this stuff I'm sure like you know Dan would love to like chat with you guys about this and like help you out as much as possible yeah absolutely so once you tell us about this cosmos event coming up in a few weeks yeah sure so they're in Berlin at the full node office in Berlin cosmos will be having two days of an uncontained on conference where we talk about different things going on in the cosmos community as well as just in the cosmos development and inter train work and then we have a two-day hackathon where people can come and hack on you know anything they want relating to interchain interoperability

and so a lot of the epicenter guests our hosts are going to be there at both of these events and you know even moderating some panels and stuff and so yeah if you if you guys are interested in are in the area in Berlin and want to come hack on some stuff please definitely come check out the hackathon I think this might be even the first time all five of us are in the same place so we're still waiting on some confirmations but we might all be there which would be a historic event so what is this taking place and how can people learn more the event is going on the unconference is going on from the 13th to the 14th of June and then the cosmos hack atom is from June 15 to June 16th

and you can learn more by going to hack atom - Berlin dot cosmos network ok and we'll add links to that in the show notes just one more thing I wanted to mention before we do this interview is that I am so happy to be back with my studio gear that has been locked up in a storage bin for the last swords Locker for the last year and some months so yeah I'm effectively hanging up my my no matte shoes and have settled back into so the Paris Area and I'll be here for the foreseeable future so traveling through Europe going through some events

here and there also you know obviously like hanging out in Berlin a little bit but yeah it's really great to have my my mic again and my my sound card and like my proper lighting and set up and everything so really excited to be back and yeah I'm getting back to working on the podcast and like getting back and sort of like into the Europe blockchain seen more in a more concrete manner so we forgot to mention how you can actually register for the event that's taking place in Berlin before the cosmos hackathon that Sonny just mentioned so effectively there is an event happening in Berlin on June 13th and 14th it is called inter chain conversations and it is a two day event with keynotes

workshops panel discussions and sessions on protocol design cosmos blockchain interoperability and blockchain inter communication and all that fun stuff if you want to register please go to epicenter rocks slash interchain Berlin that'll take you right to the Eventbrite page where you can register the cost of registration is one hundred and sixty-five dollars but for the first ten epicenter listeners who register and use the code epicenter you'll get $65 off so tickets will be $100 places are limited so if you're planning on going I would suggest that you register sooner than later links will be in the show notes so come hang out with us at full node in Berlin it would be great to see you and with that

here is the interview so we're here today with Dan Robinson who is a research partner at paradigm and the author of the rainbow network paper nice to have you on the show Dan thanks for having me on yeah so you know I think I met you for the first time I think two or three years ago at one of the IC 3 events and back then you were working at chain but then since then you've found yourself working on many different projects throughout the entire space and so we hope to touch on a bunch of them in today's episode but you know to start off with you know your Twitter bio famously says lawyer comma coder and so

you know could you tell us a little bit about that and like how you you know how you got into the crypto space and into you know coding in general coming in from a very different field yeah sure so I think it says coder coder comma lawyer karma supporter slash lawyer in that order and primarily I don't I don't consider myself a lawyer anymore I'm retired from the bar but I did go to law school and I spent a couple years as a securities lawyer in New York before I got into working as an engineer full-time and then now as an investor and you know I think it's sort of a common story where I wended up I went to law school without really realizing really thinking hard

about what I wanted to do and while I was in law school realized with kind of a sense of growing dread that I preferred programming to to working as a lawyer and that's around the same time I got into in Bitcoin and was following Bitcoin and then when it came out ethereum yeah you know I just sort of knew as he was even before I started at the law firm that I think it was probably a relatively limited time but I wanted to try it out how did you share to you know get involved with coding like you know just completely self-taught yeah so when I was in like middle school I started just sort of programming as a hobby and didn't do it too much like did it worked on sort of projects through college while I was in

law school I took a cross registered into a couple courses cuz then I I kind of realized I really liked engineering so I cross registered into a couple CS classes but I what I wish I had done and there's sort of the my regret from college isn't I don't really regret necessarily my I mean you know I didn't major in CS which I think I caught up for the unser for the most part but what I regret most is there's a lot of kind of academics yes theory that I really do enjoy learning about a sudden it's kind of I've been lucky didn't have jobs where I can kind of learn and catch up on that but if I could go back I think some of those sort of the really like the fundamentals of computer science for example in programming language theory

those are areas that I ended up really liking and funny enough end up kind of being relevant and parts of job that's really interesting because as someone who is I mean I didn't study computer science but I'm quite technical because I've been coding also since I was in Middle School I often regret now that I'm in the blockchain space and there were all these like sort of legal issues coming up that I would have studied law yep although it means that everybody comes and asks you these questions and first of all even even you know real lawyers don't even know the answer to yet about what securities laws apply to what money transmitter laws apply to and lawyers aren't really necessarily any bad at thinking about those and thinking through those issues then relatively

talented engineers are they just a have more context and be know when not to give an answer so you're less likely to get sort of a stupid answer from a lawyer probably but ultimately you know I think that's the idea that you're treating it as this kind of like arcane thing this is how we think of like medicine like I have no idea how to I don't think anyone who hasn't been to medical school could I wouldn't trust them to sort of open up my heart but for a law like you can actually really you know it's just like literally arguing on Twitter I actually think lawyers kind of over rate the extent to which there's this kind of cast that you need to join in order to be able to talk about it with any kind of qualification so last week on the podcast we had Jill Carlson

and so she also got her start at chain and she actually said that you're the one who introduced her to chain and that's how she got started there so I guess how did that case how did you get started with chain yes so I left law very intentionally with no you sort of took a leap off a cliff without sort of a job in hander in mind in part because I wanted to interview for places and have them not think that I wasn't serious about it about leaving my law firm job so I did do a boot camp called recurse Center which is a was a really great program it's a three-month self-directed coding sort of like retreat in New York City

and you can work on whatever your world is actually taking that right oh cool yeah yeah and they I'd recommend it to anybody who knows who you know already knows how to program but wants to sort of get better at stuff and when I joined that I was like oh I'm gonna be a web developer or a data engineer or something I was thinking like just let me just do the most sort of like boring normal employable engineering skills but funny enough they kind of there got introduced to all this stuff around programming language theory and functional programming that led him to a lot of what I would sort of obsessed with while I was a trained on an IV and programming language theory and all these other sort of projects and I I like learned rust there I and it sort of sent me down these weird rabbit holes

that as well as I script currency stuff that end up being fighting enough sort of much more employable than just being a normal engineer Alex in my experience so now you're at paradigm can you give us a high-level overview of paradigm and what your role is there yes so I'm in research at paradigm which has sort of two meanings one is kind of the investment meaning of research like diligence and investment sourcing investments following general trends in the space and the other is kind of contributing to protocol research so still working on some open source projects working on sort of like elaborating on some ideas like his paper

which I came out with a couple months ago called the rainbow Network so that was something that you know I think it's this was sort of great that the paradigms bored me and working on this kind of thing and let's we sort of continue this kind of open source research that I've been doing what was the reason why I like a fund would be funding like this pretty practical research into these networks is is there like a thesis here this particular project just came out of my own interest and the funds interest in decentralized finance and protocols around that and then also my interest in off chain scaling and to some extent I think it's

it's hard to really get a deep understanding for something unless you try to really like either implement it or innovate on it and so it was sort of my attempt to like actually really solidify some stuff that I was maybe like guessing about I'm saying you know maybe this could work and I thought I really have to actually try to design this as a system before I can really get a good understanding of it so as part of the firm generally having a prepared mind around newer research yeah and so you know based on your interests in often scaling you know I was like kind of telling sebastian earlier you're like the lair to god like you know you've worked on like basically every single layer to solution that like a lot of though there are two solutions

that you know people are working on today so you know just for some context like ask so you actually ask before you join paradigm you were there during that process when chain was sort of merged with that Lightyear had to create the interstellar company and so and so there you actually started working on a project called starlight could you tell us a little bit about what that project was and what the goal there with what that was sure so starlet was an adaptation of lightning like payment channels on the cellar network and so that was something yeah that had been sort of a it was originally the design was originally

developed by jed McCaleb and jeremy rubin and a couple others from stellar and so I was sort of product managing working on turning that into her into a full spec and and implementing and releasing the demo for it so that's just it's just payment channels but done on on the seller protocol I sort of built on top of what was currently there and that that kind of work trying to figure out how to apply to sort of like hat together a smart contract system on top of a system that isn't really designed to support it that was something that I think I learned a lot about working on IV while I was at chained and writing IV compilers to like every which platform

and so yeah as that served me well I think [Music] this episode of epicenter is brought to you by cosmos the Internet of blockchains cosmos is live and we couldn't be more excited to see so many projects already building on it blockchain technologies are evolving fast and development shouldn't be one size fits all as a DAP developer you need the tools that will allow your dad to scale grow and evolve over time the cosmos SDK is a user-friendly modular framework which allows you to customize or adapt to best suit your needs it's powered by tenement core an advanced implementation of the BFT proof of state protocol cosmos takes care of networking and consensus and allows you to focus on building your application in

your language of choice if your iam smart contracts will be supported soon and the SDK makes it simple for you to connect to other blockchains in the cosmos network if you have an idea for a DAP and would like to learn more about the cosmos SDK or if you'd like to connect your existing data cosmos visit cosmos network slash epicenter for represent our listeners the cosmos team will reach out to answer your questions and help you get started we'd like to thank cosmos for those supportive epicenter so moving on to and some other work that you've done tell us about the work he did in plasma cash and plasma debit plasma so I was first sort of like learned about plasma well they released they released his white paper on it but I sort of dug deep

into it around this is January of 2018 and I was looking specifically at at plasma MVP which was this kind of plasma that it had it was it was a relatively interesting and secure way to do side chains but had these sort of major flaws one of which was that if you if someone the the the operator of a particular plasma chain can sort of denial-of-service attack the network by just by not revealing any blocks and so there's a called a mass exit problem where basically everybody has to immediately take an action on the main

chain to get out of that and the other the other problem with it is that you have to validate basically the entire block on the side chain so you don't really get it as a scaling solution and so plasma cash comes out of thinking about well how do we pare down the feature set that this side chain allows in order to make it make the burden on the user much much lower and make the make we make it generally more secure and it actually takes a lot of ideas I think from payment channels and something that I worked on a little later plasma debit it carries that even further in terms of like really drawing an analogy between these payment

channels and payment channel networks like lightning or inter ledger and applying that to plasma the plasma cash building that'll put me on top of plasma cash so what is your like current involvement on the plasma project like are you actively involved with development or was this sort of you just I kind of proposed it and then kind of let other people carry like you know take it over after that yep so my modus operandi usually is is not to stick around to hug for all that really hard actual work and that's what plasma group a plasma group is a fantastic team and they they've been sort of like really carrying forward both the research and the implementation on plasma cash but I I'm so I'm so I'm so close with them and

I sort of like look at follow their designs and discuss it with them but we meet up at research workshops but for the most part they're the ones carrying that forward right yeah and so to the listeners we actually did an episode about maybe a year ago with Karl flourish about plasma cash actually so you know if you're interested in learning more about like the actual technicals of how a plasma cash itself works which Dan proposed and so you know take a look at that and then follow up with the plasma group to see what the latest developments are and so you know I also know you're pretty involved with the inter ledger project as well yet another secondary network you're involved with and did this come out during your top like so you know you gave a great talk

at the Stanford B pace conference back in January where you kind of talked about wiht LCS are harmful and some of the issues you see with the Lightning Network and then you proposed that inter ledger seems to be the solution to most of those issues were these issues you came across during your development of starlight and is that what pushed you to work in inter ledger yes so I learned about inter ledger a couple years ago mostly from Evan Schwartz one of the inventors of the protocol along with Stephane Thomas and they you know I originally sort of like they originally saw it as something that actually technically looked a lot more

like lightning that had these HDL C's sort of enforced in the protocol and then they kind of had this realization that you can do it another way and that you can do this this method that I described in that in that talk of instead of having these really complicated smart contracts just for it to enforce atomicity across a multi-hop payment you just send a really tiny amount over and over again and so the you can enforce atomicity just sort of like down to epsilon down to a particular limit and it's a very clever solution that that in particular is what I fell in love with about our dinner Ledger was that that one design but I think there's a lot of other really

clever designs that they've and and choices that they've made so yeah I learned about that from from Ripple working on starlight originally I was planning to implement it like lightning like H with H DLCs like so no mystery context then could you just explain what it an HD LC is yeah absolutely so an HDL C is a hashed time-lock contract it's a very specific smart contract a very simple one where this was originally developed for cross-chain atomic swaps so the canonical example is bitcoin and litecoin and the basic idea and Satoshi had sort of a simple a slightly more

complicated version or just simplified by like Siri on and on the Bitcoin wiki anyway I the basic idea is that you lock up some money on the on the Bitcoin chain and then you lock up some money on say the like coin chain Alice locks it up on Bitcoin Bob locks it up and litecoin and then there's this secret that Alice knows that can unlock both of them so Alice reveals the secret by by unlocking Bob's locked up like going on receiving the light coin and that gives Bob the information he needs to get it from Alice and you need to have a timeout so that Alice can't just withhold this this info information indefinitely but that's the you know that you've staggered timeouts on those

so it gets a little more complicated that's sort of the core idea and then lightning had the innovation of doing this inside payment channels rather than on the main chain you have you have if you're Alice's payment channel with Bob Bob is a payment channel with Charlie you can put HDL season those payment channels to ensure that a payment from Alice to Charlie that goes through Bob happens atomically it was a very clever idea that a Joseph Fernandez arrived ahead for lightning originally a deep reading Musial's use in payment channels but what any Ledger realized after originally designing their protocol to sort of require these enforced if she'll sees is that there's an easier way especially when you're working in payment channels and payments are super cheap updates are super cheap you can just have Alice make a small payment to

Bob and Bob makes a small payment to Charlie and then you just do that over and over again if any if at any point someone aborts the protocol you just stop and they've earned someone has only lost a relatively small amount okay so if I understand correctly here the idea is that rather than putting locking up money in these in these contracts you sort of send payments a little bit more like you send packets in Internet routing so your smaller bits and if one piece of that gets lost in transit well then you know you might want to take action or you know send it again or something like that that's right so it's a little different from packets

certainly because packets are designed to be lost basically the way that this protocol works is that you you you don't lose any packets like if you if you do you know exactly who was responsible for it but otherwise yeah it's it's it's basically the same kind of thing where instead of sending this whole payment as one giant chunk that could get stolen by one bad act or exiting the protocol you send it in tiny pieces so that if anyone misbehaves they can only steal AV can only steal from their immediate counterparty small amounts are somebody who they already have a channel with and therefore some kind of trust relationship one assumes even even again just for like if it's further as much as a penny and then that it's for this limited amount and only for a limited time are there any

other projects doing something similar like this because I feel like we've talked about this on the podcast before but I can't remember with whom I think you I think you had in her ledger on someone right yeah so so intro ledger does this as well intro ledger does this sort of like oh yeah this was about this idea of Zener Ledger's idea okay and it's such a it's such an elegant idea and solve some problems that I don't necessarily have to get into about about HDL seas but you can definitely see at my Stanford talk HPLC is considered harmful I wear it she'll sees these sort of ledger in four states you'll see approach that lightning takes leads to there being these denial-of-service attacks on the network at least there if there's multiple assets in play at least there being this free option problem and

this is also just much more complicated and this was the one that I really faced working on starlight was that trying to enforce HDL C's within payment channels on a platform that wasn't originally designed to really support that turned out to be like a huge hassle we had a cushion Decker on the podcast a couple maybe a few months ago now but yeah I actually asked him about this exact Doss attack and he you know I feel he had like an okay answer not that not the best he kind of like you know kind of kicked the can down the road on the answer to how to solve the boss attack that comes with HDL C's and so just to get it clear is so a starlight based on packetized payments or is it based on

atomic hdl-c s so starlight as far as I got on it was just for just payment channels so it doesn't have any method for sending multi-hop payments does it use HDL C's though it doesn't use h LC s so it's just payment channels so Alice and Bob so the way I think about lightning network and these kind of protocols of use these two layers the lightning is a composition of these two different technologies the first one is payment channels and that's just a way for two parties and typically really with payment channels I think it's best to stick with bilateral payment channels people have these more complicated constructions but only lightning only uses bilateral payment channels so you've these two parties Alice and Bob and they can make payments to each other

but they can't make payments to anyone else with that money and what we layer on top of it is some method for multi-hop payments some method for atomic multi-hop payments so that if Alice's a payment channel with Bob and Bob as a payment channel with Charlie Alice can make a trial payment to Charlie by making a payment to Bob and Bob atomically makes a payment to Charlie and so where in ur ledger primarily differs from from lightening is well at this layer is that the inter ledger method of packetized payments is very different from lightnings method of having this enforcement of a shell sees in the contract so what starlight was was just a payment channel solution and we didn't get to before before it left at least we didn't get to implementing the second layer I wish I think it makes

the most sense to do it within our ledger in part because it's not possible right now to do to really do HDL seasons on stellar would have to we would require a protocol update as far as I could tell and it's just so much simpler and requires you to sort of solve fewer problems I think so let's move on then to the rainbow Network so can you describe at a high level what this is like what is this new protocol and maybe how it pulls from these ideas from existing projects that you works on yep so the rainbow Network is an off chain decentralized synthetics exchange and it really again like mostly when I come up with stuff it's not a really original

idea to me it's just me sort of synthesizing ideas from different projects that I've had sort of the privilege of working on and working with much smarter people on and those projects very often sort of tend to be maybe more siloed and so they'll come up with something really clever like inter ledger dead and it won't necessarily filter out to the to the broader ecosystem and so rainbow takes from it takes a few days take some ideas from these on chain synthetics like maker and and uma it takes ideas from off chain protocols like like lightning Network inter ledger and plasma and just kind of kind of gets some really interesting leverage no pun

intended out of having combining these two ideas okay so could you just maybe just briefly explain a synthetic asset for those for whom that's unclear a synthetic asset is informally it's an asset that is backed by some collateral that isn't that ass that isn't that actual asset so it's it comes out of its a derivative and it come it comes out of this on the blockchain is one that's backed by another asset it could in theory be black back by credit the basic idea is that instead of you you actually owning an asset like me selling you an asset I can sell you just the exposure to that asset so I can just say like I owe you the price of one Bitcoin at any point in

time and a year from now like I can make I can make that payment to you and settle that without us ever actually touching Bitcoin so maker makers dive stable coin is an example of a synthetic it's a coin that is there's no dollars on the etherion like native dollars on the ethereum blockchain there's no dollars back in each die instead it's backed by this other asset ether and the promise enforced by these smart contracts that in some way or another this die will be redeemable it's not really redeemable in the maker system but backed by the value of this if that's locked up as collateral okay so would you say then they're like US dollars backed by gold would have been a synthetic asset well the one difference there maybe if

it's backed by a fixed amount of it it's not really a synthetic it's more of just like a like an IOU for that particular asset and so a synthetic usually is meant to be a synthetic version of something for which there's like a natural version so if you had like a you know like oil futures backed by gold or something then that would be that sort of a synthetic asset but yes is that the basic idea being that you get the exposures to this particular asset but you don't actually need to deal in the natural one itself the asset itself do synthetic assets always need over collateralization not necessarily especially if you're willing to take credit risk so you could imagine two parties if one of them

trusts the other I can give you a synthetic synthetic exposure to this particular asset yeah without it being fully collaborative but collateralized on my end a synthetic acid on a blockchain typically you want it to be fungible you want to be acceptable by anybody if it's an Unchained synthetic and so it does you think it really needs to be at least fully collateralized and the problem is if the synthetic price rises faster than the collateral price you could have a asset that's fully collateralized become under collateralized that's kind of the nature of the of working with synthetics but I think it's you know I sorry so you can have someone required to deposit more collateral basically to fill it up and that's what the that's what the maker system does and it penalizes

someone who doesn't buy with this liquidation penalty okay so let's go back to into with that with that context we can go back to your rainbow yeah so please continue explain your explanation on the rainbow so rainbow Network is a combination of this idea of synthetic positions with this idea of payment channels so a payment channel is an off chain agreement between two parties and I get again I always use two parties where they can make the sign these messages off chain in a way that these new balances can be settled on chain and so typically in a payment channel it'll be like we lock up some escrow some acid as collateral on the main chain five Bitcoin and then we have his balances off chain of like you know

Alice has three Bitcoin Bob has two Bitcoin and they can make payments to each other by signing updates to this so note this parallel between payment channels and synthetics both have this collateral pool where you have some money locked up in escrow that in some ways eventually can get settled between these parties and the synthetic it's based on the price of some reference asset and payment channels is based on these messages that have been signed off chain in this game that people play to exit the correct State and so the rainbow combines these two ideas and it says we can have an off chain payment channel but instead of if it could be backed by by Bitcoin I could be back

entirely by but instead of it's settling based on just the balances that people have signed here on the off chain it's also calculated based on the price of some reference asset so that means that two parties can enter into this payment channel where they say that's back entirely by efj but where the where they agree off chain they're doing these trades off chain and they agree when we settle this the amount of each that each of us gets the amount of collateral that each of us gets is computed in part based on the price of of USD the price of beef relative to USD so that's what allows them to do these two trade basically any asset they want even with only if as collateral on the main chain I think most of our listeners will have some fundamental understanding of

lightning Network and how payment channels work and there it's it's pretty I mean it's like pretty simply just a payment going for in one direction or another on a channel so it could be for a payment for something that's done completely offline like you know like a merchant payment or for some other cryptocurrency for example in the case of an exchange but in that case that other asset isn't being transferred necessarily on that payment channel so for example you know Alice wants to buy some Bitcoin from Bob sorry some some ether from Bob and she sends Bitcoin over lightning Channel and Bobby greases

and her the ether you know on our ether wallet in this case all of those assets are being are being transferred through payment channels on the rainbow Network correct well so what how rainbow is different is that you can trade yeah you can trade different assets that's right that aren't collateralized you don't have any collateral locked up on a blockchain in this particular asset but parties on this network nevertheless can trade them one benefit of this it gives you a lot more flexibility means you can trade for example fiat currencies in these in these channels there's not something you can do I'm generally sort of trust Presley on something like lightning unless you can have a

synthetic already on chain for that particular asset it also means that you don't need that to have these multi-hop payments and with Rainbow Network you you you can do these sort of multi hop trades but you don't need to do multi hop payments across multiple channels in order to trade any asset for any other asset so if I have this channel rainbow channel with somebody back entirely by youth I can trade dollars with them I can trade gold with them I can trade really any computable number I can turn into into something that I can trade with them and so that yeah so that's sort of benefit is not just that it can support any asset because you could you could theoretically have lightning Network across multiple assets and that's really what Inter Ledger's designed for is to

be a sort of like layer two that spans across many different base layer one chains but that even on one single channel it can trade any particular any asset that you want this episode of epicenter is brought to you by Microsoft and the Azure blockchain workbench getting your block king from the whiteboard to production can be a big undertaking and something as simple as connecting your blockchain to IOT devices or existing ERP systems is a project in itself well the folks at Microsoft had you covered you already know about the azure blockchain workbench and how easy it makes bootstrapping your blockchain Network pre-configured with all the cloud services you need for your enterprise app their new development kit is the

IFTTT for blockchains suppose you want to collect data from someone in a remote location via SMS and have that data packaged in a transaction for your hyper ledger fabric block team the development kit allows you to build this integration in just a few steps in a simple drag-and-drop interface here's another great example perhaps you're in institution working with aetherium and rely on CSV files sent by email one click in the dev kit and you can parse these files and have two data embed it in transactions whatever you're working with the dev kit can read transform and act on the data to learn more and to build your first application in less than 30 minutes visit AKMs slash epicenter and be sure to follow them on twitter at MSFT

blockchain we'd like to thank Microsoft and Azure for their support of epicenter could we like maybe walk through an example where let's say you know where we both have eat on aetherium and I'm trying to buy some BTC from you or some synthetic PVC I want exposure to be DC could you maybe walk us through an example of how this would actually work what would be the steps of doing this sure so I should I should first say that you know I I've so far kind of alighted the question of how rainbow channels actually do in force at the time of exit that that it settles based on this price the price of these

assets and there's a few ways to achieve that one of which involves a price Oracle but which don't they don't necessarily require one but but yeah so as well as I'll walk you through though the the general idea so if you've if let's suppose they start out with a te each and they want to trade 48th for one bitcoins that might be right now it's that's yeah it's about right well as it will say 40 so the they start out with it with Alice is a balance of a beef bob has a balance of 80 Eve so Bob wants to get Bitcoin because their names start with B so what happens is Bob's balance of eath goes down to from 80 to 40 and his balance of Bitcoin goes up from zero

to one this you know this all has to remain balanced within this it all has to always add up to exactly 160th the amount that's actually collateralized so then on the other side Alice she goes up to 120 Eve but she goes down to negative one Bitcoin so when we compute her balance at the time that they exit we say okay she's got 120th but then we have to subtract that by the amount of e that one Bitcoin is worth so the that that's kind of how you achieve that allows you to short this is Alice look at the short position in Bitcoin it allows Bob to get this long position of Bitcoin in a channel that isn't

collateralized by any Bitcoin and it actually allows people these parties would basically get leverage on a particular asset so that they know note that Alice has leverage on Eve she if Eve goes up her balance goes up by by significantly more than it would have when they were just sort of at at a 88th each so this actually seems very similar reminds me of the original bitassets system on bitshares back in like 2014 or so where they actually you know I think the technically the financial term for this is a CFD a contract for difference

we're basically happening right and so you know bitassets was actually using these CFDs in order to create synthetic assets so if people remember the USD was their most popular one but they also had everything from like you know bit gold to like bit bit are bit RMB and like they were essentially doing this synthetics and so essentially what you've done here is you've just taken this bit acid system but figure out how to make it work on a second layer system on top of payment channels rather than in on a contract on the main chain that's right and one thing you can do you like putting it on a payment channel apart

you know it's like we just make everything a little more efficient but it also opens up these new possibilities there's this nice kind of synergy between these these two things that yeah I think I think there's some there's some benefits from having it off chain so yes I mean I can and I explained maybe it's worth explaining now how a rainbow channel like actually works how it settles so there's three ways to do it to sort of construct a rainbow Channel one of them is basically using price Oracle's and smart contracts the second is to have physical settlement of this asset where the asset itself has to actually be delivered and the third is to have this continuous cash settlement of the curve the value of it on the channel so the first is maybe maybe sort of the most straightforward is if you

have some price Oracle if you have some reliable price feed that can be verified on the blockchain and if your blocking is like a theory and if it's you know turing-complete a sufficiently fully-featured that it can do this kind of calculation then people who are signing these messages off chain when it when it settles the escrow contract that is handling the settlement of this payment channel just computes the current balances of each of the parties based on their on their current portfolio in the channel and just sort of allocates the collateral appropriately so that's maybe the most straightforward yeah does that make sense I think it makes sense to me where so essentially you know whenever so back to that example you know I had 100 Alice had 120 Ethan Bob at 40 Eve but Alice

had negative 1 BTC and so whatever they tried to close a channel it basically sends it to the on chain Oracle that says okay the price of BTC is now 50 eath and so now you know Alice's what actually Alice gets out is actually only 70 eath and Bob gets out 98th yeah exactly so we just sort of computes that that's you know invisible wire a trust but this does have choir a trusted Oracle right it requires some kind of price Oracle some way to determining the price and so if you want to avoid that you can use one of these other these other two approaches so second one is physical settlement and so what that means is like traditionally when you when you've got a future or derivative you can

either cash set a litter or physically settle it and physical settlement literally just means like I'm gonna actually give you the asset itself so the idea here would be and we can get the Bitcoin in a second but maybe it's easier if they're trading some asset that's already on ethereum like Dai which is the bakery stable coin if they have some synthetic position and die and one of the parties is has a position of negative 100 died and some Eve and the other party has position of positive 100 died and some of you say then when they settle the channel the contract could require that Alice who anyone who's short a position like Alice a short died

has to actually send a hundred died Bob in order to close out this channel and if she doesn't then all the collateral goes to Bob so here there's still a risk that the channel becomes under collateralized or that that Alice goes it goes negative in here entered total balance but if alice is positive then she's incentive eyes to actually really deliver this asset to died to Bob because then she gets the collateral collateral out of the contract be that she's owed and if she doesn't actually do that then pop in its fourth it so that's that's this method of physical settlement it works relatively straightforwardly when it's another asset on the same chain and it's a smart

contract platform but it actually also works for Bitcoin so this is a cool construction so we could have a channel on aetherium where someone alice's short bitcoin she's got a balance of negative one bitcoin when they settle it the contract can require that alice sends one bitcoin to bob and then provides an SPV proof that that transaction occurred that is verified by the by the contracts when SPV proof simplified payment bear vacation it's a protocol described in the original Satoshi white paper basically you just review just reveal the inclusion of this transaction a miracle proof that is included in a Bitcoin block and then say like six blocks of proof of work on top of that

and this proof can be verified by a like client it can also be verified by the etherium chain for example itself so of course cosmos works using a using SPV proofs in this case is a bit quite this is a proof of work SBV proof but the idea would be Alice would have to send one Bitcoin to Bob generated SPV proof that it was included in the Bitcoin blockchain and then reveal that through the etherium smart contract with his program to verify it but so this only works with lock chain native assets right I can't do this for dollars for example that's right so it only works for blockchain native assets with his withers ID like summer C 20 or some asset whose SPV proofs are readable

by by the chain that you're working on so yeah so it's limited in its application certainly when you have that and you have either these SPV proofs to other systems or you know yeah what's the benefit of using a synthetic in this case instead of just using you know just trading on actual Bitcoin well it's it's that we can you can do whatever trades you want with your counterparty and you can trade Bitcoin with them well only having say Eve locked up as collateral right so it's much more flexible if you would do this in lightning you would have to have some Bitcoin locked up in a in a Bitcoin payment channel have some ether locked up in that and the eath payment channel and then do what time it came it's cross those but this is

generally more flexible that you can that you can do that so you mentioned this this third way of settling which is to have constant stream of payments can you describe that that's right and this is people have noted that like this this idea is kind of inspired by the inner ledger idea I was talking before and like this is just generally true that basically every every idea I've ever had was stolen by someone else was stolen by me from someone else who had like a really clever idea I just sort of apply it to everything I can I can find so this is the idea here is we have some particular balance on let's let's say we're doing that Bitcoin and we don't have we can't use price Oracle's it can't verify SPV proofs of other chains there's no other assets really on Bitcoin so we just have

a Bitcoin backed payment channel on lightning and Alice and Bob have this channel with each other well they can do a rainbow channel on top of that and the way they do it is you informally agree at a higher layer you said which is not enforced by the contract you say you know like where now I'm gonna be like slightly long USD and you're gonna be slightly short USD so we basically created Bitcoin four dollars on this channel and then as the price of Fiat changes you like every five seconds update assign an update to update the payment channel so that you can update your balances so if it was five Bitcoin and five Bitcoin and then someone traded for Bitcoin for eight as I say one Bitcoin for $8,000 so it became a

balances of four Bitcoin and $8,000 and six Bitcoin and negative $4,000 then you'd the current update still looks like five bitcoins buy bitcoin as far as the lightning protocol is concerned and then if fiat crashes then alice's balance goes down because part of her balances in fiat and bob's goes up what happens to just sign a new update same like now i'm worth four point nine Alice's four point nine in Bitcoin and Bob has five point one if you do this every five seconds then the risk of your counterparty cheating you by not signing a new update is what hope sort of negligible what happens if there's a flash crash or a flash like rate rise in prices and the

counterparty decides I don't want to play this anymore yeah so that that's the risk you take so it may not be a great idea for like for incredibly volatile assets but you can look at sort of what the with the max price difference is and over over like five seconds that's pretty which is um you know even you probably could sign an update every five seconds so lightning you may even be able to do it every like two seconds I think that that shouldn't necessarily be too too much of a risk and so you just have to sort of tolerate that that free option that you're giving them but it's because it's only a free option for like a couple seconds so no this is one of the areas where you get this new benefit from doing it in with payment channels from doing this

protocol off chain this is not a protocol that you could do on chain because it requires these updates every five seconds so because you've gone off chain you can now have this new way of doing a contract for difference relatively trustless contract for difference because you've just like dramatically lowered the cost of a ping of a transaction of a payment channel update here relative to doing this protocol on chain here you still do need a price Oracle as well right or at least some way of you and your counterparty agreeing on what the change in price is yep that's true so you can you can independent you can look at whatever price you want you need to you do need some way yet for you for you to know

what the price is and to have one that then you sort of agree with your counterparty on but so that could be like the median of a bunch of different exchange feeds right but each of you can go look at those independently and if you lie or you know a those don't have to be signed by the exchanges right so unlike with maker where you actually need this process of taking these exchange feeds and having Oracle's report them to them to the blockchain this is something that you can just do subjectively you just you just look at it and if something goes wrong if these if you like sort of detect these feeds have been tampered with you can just sort up the protocol and so another thing that you mentioned in the paper that makes this third method interesting is that it can actually actually already

be implemented on bitcoins lightning network which you know you can't really do with the first two because a lot of like scripting capabilities yep that's right and so I've talked to a couple people who are working on lighting applications who are kind of interested in doing something like this mm-hmm and so does the channel that does the payment channel that a rainbow channel is based on right does that actually have to be a literal singular channel or could it be like an IO P connection and or like an ILP channel or could it be like a multi hop lightning lightning thing can that act as a singular rainbow

channel yeah that's absolutely right you can have sort of a virtual rainbow channel that is settled in this particular way I fear yeah if you like Alice and Charlie don't have to necessarily for channel with each other they just have to be able to pay each other over this over this method so yeah it could be it could be a multi hop lightning connection between them it could be an ILP multi-up ILP connection between them I think you'll probably get screwed on fees if you try to do that via V if you try to update too frequently and it's a multi op payment but yeah that's that's certainly possible okay so this is great when we have me and you who want to create a you know rainbow channel between us could

you tell us a little bit now how do we take these rainbow channels and turn them into a rainbow Network and what is the benefit of such a network yeah absolutely so suppose we want to use this protocol for trading right and so someone wants actually go I just sort of like sign up have enter into one of these channels with a counterparty and then just trade whatever they want on that right so there it's they put in some Eve and then now they're trading like USD with it the trading Bitcoin with it I the problem here is that maybe the counterparty to that trade doesn't especially want to be at take the exact inverse position of the trader at all particular times right so like if

they're trading with somebody you need to actually have it with sort of just naive rainbow channels you need to actually have a channel with somebody who wants to take the opposite position so if you want to go leverage long Eve you have to sort of diminish their youth position if you want to like go long Bitcoin they now have to go short Bitcoin and that so that that's sort of a challenging thing if it's just sort of like this immediate counterparty so and note remember these are these are bilateral agreements so like if I've got money in this channel with someone they're the only person I can directly trade with I but there's a way that they can balance out that exposure by making that that person my counterparty can

make the opposite trade with someone else they can hedge their position so you can hedge this on a like actual physical exchange or in pit mix or something right so like the like if Alice's Channel with Bob Bob could go whenever Alice goes like extra long Bitcoin Bob could go short Bitcoin on on bit Mex or something in order to end up saying flat across these these positions or they could do it in another rainbow Channel they could be could have a channel with someone else where they do that so the architectures that I sort of imagined for this would be probably you have like a couple very large market makers that are responsible for just hedging people's positions and like they

sort of like take all trades and then they just have so many trades with so many people that and that they can kind of net out a lot of their exposure and then maybe trade on some centralized exchange to really hedge away the rest and then there'd be sort of users who are just connecting and they can just trade in whatever they want and their counterparty is taking a spread for free either and then and that counterparty either hedges directly with any sort of like a market maker themselves or they connect to another to a market maker and hedge with them so these market makers turn into sort of the hubs in this rainbow Network that's right but so question though you know this is kind of I guess a similar question that you know a lot of people concern when it comes to lightning as

well is this requires a lot of liquidity lockup for the hubs here enlightening it requires you know the hubs do have a lot of lockup with all the people that they're serving and here it seems that in order to like connect to people in a you know two opposite rainbow channels with each other I have to as the market maker lock up collateral on both these channels and this doesn't seem a very capital efficient way to do this that's that's absolutely right and something I've been talking about with some of the plasma people and so plasma in part is a and especially plasma cash and plasma debit I consider them there is there an

attempted solution to this particular problem with lightning which is this extra capital lockup which I would absolutely also a problem in in rainbow but so I've been talking to them and it's still sort of an early stages of of really trying to solve this problem but to figure out how to let these parties let these market makers basically maybe they maybe they facilitate that trade initially but then they can kind of get out of the position by matching Alice if Alice really wants long Bitcoin exposure and Bob wants short Bitcoin exposure matching them together rather than the hob having to lock up their own liquidity in order to maintain this that this fully collateralized hedges trade

so that yeah so that's definitely where I sort of actively working on I think some techniques from plasma will help I think the other possibly you know some sort of like novel ones so yeah I talked to some plasma peoples and heart from Boomer as well I know I was thinking about this so a lot of people to become brokers instead of dealers yes I I definitely would not use any legal terms about what anyone is doing here to get like you know I make no representations about what anyone would be with the legal status of anyone actually implementing and operating these notes would be but yeah that's that's that analogy does seem seem about right so what's the application here what

would one uses for where do you see this being used in the future and I guess my follow-up question is if and when it gets implemented which I think you've spoken about in your paper yes so the basic idea I think for it is off chain exchange is decentralized exchange and so it's a relatively efficient it's a like duper deficient not necessarily a capital efficient yet way to do trustless trading and you know we know that trading cryptocurrencies is one of right now one of the few applications for which there really is product market fit people seem to be doing a lot of it it's also works as a multi asset payment

network so you can make payments in any of these assets in any asset just like as if it's as if it's like me over in a ledger or as if it's like a lightning Network so that's that's sort of another another possibility there as for who's gonna implement it you know I'm not gonna implement it I think in part you know I have a full-time job working uh during during research here at prepared I'm and it wouldn't necessarily yeah I think I think you know there's there'd be a lot of challenges I think to really getting a rainbow like launching it and bootstrapping it that aren't necessarily as it really really sort of like big problems but are necessarily is technically interesting to me and so

yeah so you know again I think anyone is welcome to the to the ideas like I said like few of the ideas are really original to me they're mostly combinations of other people's stuff so people are absolutely welcome to to work on it and I've had some encouraging conversations with people who have been inspired to to work on at least sort of similar things and some people so it may end up getting implemented and you know I'm I definitely chatted with people who I think would be great if they do implement it but one last question about rainbow channels before we move on is in the paper you you mentioned that you know it's called rainbow channels because rainbows are just multicolored lightning have you talked to any

meteorologists about this place I didn't see a source on that one yeah I mean I I was thinking of looking it up but I just knew in my gut that that's how rainbows work so it's it's so the basic idea of rainbow right isn't because in one channel you can have many assets so it's kind of a multicolored thing and I also I like it because like I really like it look at the rainbow theme I have my rainbow shoes here I think it's it's a it's fun branding for it it sort of matches generally to get the ethereum thing and because yeah sort of by analogy in some ways so that to the Lightning Network certainly was the other thinking there I mean isn't a rainbow light refraction in raindrops it

has nothing to do with lightning does it doesn't it that's your opinion man watching engineer nada not a meteorologist okay well let's let's move on to our last and final topic which is the IV smart contracts and language was something I discovered doing the research for this episode and is actually quite interesting I tried it out and I mean uh it's kind of like fiddled around with with the tool that you have it's you built you talk to us about IV and what were your goals here sure so IV was a programming language developed a chain where I used to work and when I come up came on it was it was already people sort of had the basic

design for it and it was compiling to our proprietary VM the chain VM and so that I worked on relatively soon as as soon as I started was working on it and really focusing on that language was also compiling it to Bitcoin script and the reason is that there's no you know it's pretty hard right now to write a smart contract in bitcoins Bitcoin has the scripting language it's a low-level stack base language but it's just kind of awkward and unwieldy to use and even more to like think about people don't people when you

sort of like read a Bitcoin script contract it's just a bunch of like opcodes and you kind of have to like work out in your head what it means and I think that was holding back the space in some ways maybe conceptually just people having to like actually when you look at the lightning boxers like these this really long Bitcoin script programs that yeah they don't even really explain what they do when how the how the logic works and so Ivy's kind of a simpler way of of expressing those and reading those as well as if you want writing them so mostly I see it as an educational tool and one that maybe was I was trying to sort of help people understand like the functionality of Bitcoin script and how with these important Bitcoin script programs actually do so yes all right so I came out with this with the so I

worked on this tool and chain was very supportive generally for me working on everyone there really likes Bitcoin so they were supportive of me working on it so with with one of my other colleagues boy Meyer we released a this playground for the for ivy and sort of a very limited SDK and compiler for it I found that really enjoyable and I think it helped me thinking about bitcoins good to help me thinking about sort of smart contract programming language design but really again it was meant I think to mostly teach about both Bitcoin script and the limitations of Bitcoin script so when people try it out and I can say imagine if we had this opcode here's the kind of program you could write it was a hard kind of

argument to make when people are stuck in the low level of just looking at these stack based languages I played around with it a little bit as well and you know I really like it as a contracting language for like if you're talking about like real financial use cases it seems like it's a very declarative language and so you know I like to phrase that I haven't tried this yet but I have a feeling I could maybe get an account like teach an accountant to write this write using use an IV because it's very simple it's just like a set of like you know very very English readable and like just saying that oh this is the constraints that like this money is spendable if these constraints are met so like you know if this much time elapsed or whatnot and so I think

it's a really cool language but you know it never really saw much wide adoption right and so you know I you know I people have played around the playground and stuff but like do you know of anyone like actually using this to like deploy real Bitcoin scripts in the real world yes I mean first I really hope nobody is using it to deploy real Bitcoin scripts on main net because you know you're it's it's well we we work as hard as we could to kind of get rid of a bunch of the bugs in it is definitely not it hasn't been fully audited and there may very well be bugs it's someone that you could do if you you know could find in the compiler so I hope nobody's and there's a lot of warnings on it you know this is for our educational purposes no please

don't use it on main net the reaction from the Bitcoin community so I was somewhat worried and as someone who I consider myself you know like part of the Bitcoin community and I got a foot in the Bitcoin community and I really like them but also in aetherium and then I got friends and you know like we're gonna ripple with with inner Ledger and Bitcoin cash some people like I I was I was a little worried that the Bitcoin community would react negatively to this and say like we don't want smart contracts my contract languages are dangerous or like sort of criticizing it and we didn't get that reaction at all but maybe got slain worse which was people saying aha look at this I know the

reaction was very positive but it was this is great look at this see Bitcoin already has smart contracts we don't need to change anything and as I said before almost my entire goal with with the language was to show to show the imitations and you know I appreciate that you like the language like I find it I find it somewhat frustrating because there's a lot of features that I'd really like to add that I think would be would be useful mm-hmm if you can't because not at least not in the Bitcoin version because of the limitations of Bitcoin script you don't have you don't have covenants you don't have a string concatenation operator on data other than the true the new transaction hash and I was sort of hoping by by showing this and using as an educational tool that I could say

okay here you go like and here's what the cool thing that we could do if we had a if we had more expensive off codes but for the most part you know I said I still hear people sort of referring to it as look see we can do some more contracts on Bitcoin with Ivy but it's like you can't say you can't do anything more you know it doesn't add any features a Bitcoin certain because it's entirely compiled to Bitcoin script but also yeah I mean like like look at how limited it is like you can do it you can do a couple things you can verify a few things you basically write a multi-sig custom multi-sig or like hdl-c or something like lightning with it but yeah then so so as far as people deploying actual applications so the only choose from are contracts that are

used on the Bitcoin Bitcoin main chain are multi SIG's which are generally very simple constructions and lightning that's that's basically yet I guess Arwen I think has a different payment channel protocol so um yeah maybe like just a payment channels in general for those um I'm actually not surprised I think that people aren't using ivy in production because I wouldn't suggest that they do you know like loudly was able to write really efficient Bitcoin scripts in there there's only a couple scripts they have to actually write so I wouldn't want them to like write it in Ivy and not actually figure it all out by hand and test it so because it's something that you write once and then use it over and over again what I really like to see I think and this is a blog

post I've meant to write for a while is trying to explain the Lightning scripts it's an educational part was trying to explain the Lightning scripts using Ivy and that's something that I think I just would have to do and haven't had the time to any plans of maybe having Ivy compile to more expressive systems like me for example you know Bitcoin cash does have the check data sig or even like something with EVM where like you know it's a much much more expressive VM but it was still nice to have this very easy to use language yeah I've talked to a couple of people who are actually adapting every once in a while someone comes to me and say and they want over debt IV for Bitcoin cats like CoffeeScript for blocks yes yep yep and I've actually so I wrote

IV compilers - I wrote one to the EVM I wrote one to two chained vm & TX vm which were the VMS that we worked on at a a chain I went to Michelson which is um Tess vs. smart contract language and for a while I was just like implementing compile IV compilers fun I think honestly like I I think it's it's not it doesn't have enough features even even when you sort of like add these other app codes to really be be fully useful as a smart contract language so I I'm you know like I wrote a test one - that works on ethereum and you can do some cool stuff with it but you couldn't you couldn't implement plasma in it you couldn't implement payment channels well you could've my payment channels in it

but not really like necessarily the right kind I do think there's room for a declarative programming language for ethereum but I've sort of moved on mostly from programming language design and for better or worse so I hope someone comes out to do that but I think there's still going to be a big left to do it okay so where can people find you and where can people learn more about everything you're working on sure so if you want to learn more about Ivy you can go to Ivy - Lang la ng org and that's the ivy playground that I mentioned which allows you to sort of an in-browser IDE for writing these these

Bitcoin scripts using Ivy you can find more about the marat about the rainbow network by going to rainbow net dot work and that's the rainbow at this where the rainbow network paper is hosted and generally you can find me on twitter at at ben robinson on twitter and that's my dmz Ropin and i love to hear about people who are interested in these and these same topics okay great thanks for coming on the show Thanks having me we release new episodes of epicenter every week click here to subscribe for hundreds of insightful interviews with some of the leading minds in blockchain and crypto you can also listen to the audio version of the podcast on itunes spotify stitcher and

other podcast apps click here for a full list of places where you can listen thanks for watching at the center and we hope you'll join us for our next episode