New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

SpankChain: Payment Channels in Production by Ameen Soleimani & Arjun Bhupati (Devcon4)

DevconWed, Oct 9, 2019, 12:00 AM

Speaker

Ameen Soleimani

Visit the https://archive.devcon.org/ to gain access to the entire library of Devcon talks with the ease of filtering, playlists, personalized suggestions, decentralized access on IPFS and more. https://archive.devcon.org/archive/watch/4/spankchain-payment-channels-in-production The original custodial payment hub architecture; Our motivation for upgrading to a non-custodial hub; The new perun-style hub architecture; How we conducted the upgrade; An overview of features: Streaming payments, Currency auto-conversion (+ price negotiation), 2-token exchange, Custodial payments, Fees; A discussion of various design decisions: Payment Channels vs. Plasma, Perun vs. Hashlocks, Unidirectional vs. Bidirectional Virtual Channels, Emphasizing the “Card”, de-emphasizing the wallet; BOOTY Maximalism vs. ERC20 agnosticism; Future Roadmap; Networked hubs; State channels; Integration into Wallets like Gnosis Safe; Delegated signing keys / permissions; Anticipated Ecosystem Impact; SDK - Everyone gets payment channels; As a foundation for state channels; As a focal point for experimentation. Speaker(s): Ameen Soleimani, Arjun Bhupati Skill level: Intermediate Track: Scalability Keywords: development, devex, plasma Follow us: https://twitter.com/efdevcon, https://twitter.com/ethereum Learn more about devcon: https://www.devcon.org/ Learn more about ethereum: https://ethereum.org/ Devcon is the Ethereum conference for developers, researchers, thinkers, and makers. Devcon 4 was held in Prague, Czech Republic on Oct 30 - Nov 2, 2018. Devcon is organized and presented by the Ethereum Foundation, with the support of our sponsors. To find out more, please visit https://ethereum.foundation/

Transcript

the stock is payment channels in production and it's myself and Arjun and we're gonna talk about what we've been doing for the last year or so little overview of what's bank Shane is show of hands who knows what's bank Shane is good branding all right we don't have a booth but we all have pink hair so just come come find us this is a quick overview so today is the 10th anniversary of the Bitcoin white paper let's see how we're doing so this is something that Satoshi said in a mailing list said I would be surprised in 10 years from now if we're not using electronic currency in some way now that we know a way to do it that won't inevitably get dumbed down when the trusted third party gets cold feet and Satoshi knew what was up because he knew that micro payments for adult was where yeah the party was gonna be show of hands who knows how payment channels work all right if you don't find the slide leader for DEFCON 4 this is a tale of four payment channel systems that we've made part 1 the demo so this was August 31st 2017 it was pre ICO started working with Sergey in Russia yuccas Tov of machinima and the magic word is Hodel this is what it looked like it was called vine oz this is me doing a video walkthrough where I asked Janice Griffith to spank herself and she refused until I said the magic word which was Hodel it was not pleased it was not pretty please it was total so we did this demonstration just the show that our payment channel system worked in advance of actually doing the ico because we wanted to improve the technology it took three tries there's a bunch of bugs and then so each of these times we had Jen's Griffith there at our Hollywood mansion ready to do this demonstration and then could not get it working the the second time was actually because 0x was doing their ICO at the same time and we should not get any of the transactions through it's very very sad the second system we launched after the ICO we launched on April 2nd which was one day later than our target date of April 1st and it was the simplest possible payment channel implementation looked like this actually this is what is still alive on our site because we had to revert it which I'll get to in a minute but you you had a wallet and you send money to the wallet and that's like a legitimate etherium wallet and then after that you clicked load up your spank card and you send the money the payment channel was represented by the spank card and so this was a unidirectional ether only custodial payment channel setup so the users had payment channels with the hub that we were operating but the performers did not they had to click withdraw through a separate interface and in the time between they got the money and they hit withdraw we held the money and so we had custody again I was working with machinima libraries and contracts and we brought on Keo Ken the metaphor for the spent card was a hit something that we've learned about payment channels is nobody gives a [ __ ] it works like a card so we represented it like a card you everybody knows how a card works you put money in you spend it and when you're done you take whatever is left so now I never need to tell any of the users what Hema channels alright fun fun things we encountered along the way so querying in fira was non-deterministic we would get a transaction in and we would see that it had worked and then we'd query in fira and in fira is like you know eventually consistent so half of inferiors like yes this worked and the other half is like i don't know and so we yeah we had that problem truffle timeout is two hundred and forty seconds so in production when you have transactions and you have a variable amounts of you know gas and sometimes your transactions just timeout and that sucks you have to go trace them down so fast forward to June 6 or June 9th sorry we hardened our wallet then we shipped our open beta so this was this the same wallet roughly actually this is the wrong picture yes this is this is when we upgrade later but anyway we got hacked actually we never talked about this one didn't really seem like a big deal but we actually got hacked before the most recent hack for a lot less money because we in the process of migrating to a different infrastructure we let our guest node firewall slip for two minutes and in the two minutes within 30 seconds the thousand five hundred dollars and eath that we had on our hot wallet was drained by because the guest node was unlocked and somebody just sent a JSON RPC request to send themselves all the money so then we didn't upgrade we launched that September first move fast and break things they said so the upgrade was a noncustodial wallet had prune style peer-to-peer virtual channels which we call threads now - it has the contract had support for ethan IRC 20 so on September 1st we launched the wallet which looked like that so we integrated the wallet and card into just one balance and basically just showed a pending transaction until all of the wallet funds were there and so we actually took the liberty of when you send the wallet the money we automatically deposited into your payment channels because we figured there's no other reason why you're sending this thing money and we joined forces with connects to work on the hub so now I was gonna ship payment channels but then I got hacked so the hack we lost $40,000 we got it all back and we made a friend so this was the post that we published in the aftermath of the hack so the hack exploited a re-entrant sea bug and an intern and an integer overflow which allowed the hacker to call back into with withdrawal function and basically give themselves all of the money it was wasn't quite the withdrawal function it was a function that allowed them to exit a channel that had not been joined by the counterparty but they opened the channel and then exited the channel that had not been joined but that function they called back into it because it only deleted the on chain data about the balances after the transaction had been sent and in the course of sending the token transfer the actual token contract was not what we thought it was it called back into the function and gave the attacker all our money there was another bug so when I called the attacker up I said you know I'm Ameen Soleimani Co spank Shan do you know why I'm calling said uh yes a little bit nervous so from there I said you know congratulations on being the real winner of the EFSF hackathon very impressed with your work can I have all my money back if you give it back I'll give you a $5,000 reward for you know your contribution to exposing our vulnerabilities which we really appreciate and they said that seems reasonable texted me the private key and then they said well actually there's another bug in your contract and that will allow me to get back the 4000 booty which is our stable coin pegged to $1 get it booty peg right so they said yeah well we'll get you 4000 booty back and I said well if this person can get the booty then somebody else can get the booty and my plan involved getting everybody back online and I was like okay [ __ ] it like let's let's let this person do it and I said look if you can get this back within 24 hours I will pay you the dollar price $4,000 for it and within an hour actually 65 minutes later I had my 4000 booty so I sent them 4000 eath as call them back up so hey yeah pleasure doing business with you and they were kind enough to do pro bono audits of two of our other contracts too they didn't find any vulnerabilities in the spank bank and gave me some notes on the Mollick Dow so that was cool so in the aftermath connects we work together they prepared a transparency report and we did in full team line-by-line audits of the contracts and hub systems everyday for several hours and identified ten total attack vectors and published all of it as part of the transparency report this is what it means to be in production guys get ready so then we did a reboot we decided to rewrite the contracts from scratch and we made significant improvements to our UX while we were doing it and this was a combined team effort of connects TQ Ken and spank chain all working together for the last like two weeks non-stop we were we were trying to get it done by DEFCON we figured if we if we code non-stop between now and DEFCON there's some chance that we'll ship this by DEFCON and then we got pretty far but we will probably have to ship it next week so did the reboot a couple things that I want to go over on the reboot because they're really cool so before we we had a payment channel system right and payment channel systems you you open a channel and join the channel so everybody knows this sort of standard flow but we reimagined it because we'd been dealing with this for a while and there was a bunch of really annoying user flows so for example when the user wanted to deposit money into the channel they would have to call the create channel function and then the hub would wait until it saw that happen and keeping in mind that we wait several block confirmations like five block confirmations so it's not just like fifteen seconds it's like a minute and a half right and then after that the hub would join the channel and then they would deposit the money and do an exchange and so it took several minutes of waiting for the user right another annoying flow was especially more annoying for the performer when the performer wanted to join a channel they would also have to call create channel and the performers don't have any eath and they're not supposed to have any ones getting paid so they shouldn't have to and so we actually ended up writing a little but like when the performer was about to start a show we we would send them a small amount of ether so that they would then be able to open the channel and that was crazy and then we would join and in the performer withdrawal was even worse so when the performers wanted to withdraw especially in the upgraded version they they earn booty because we we used fini denominated eath in production for a while and then we you know I don't know if you guys have been paying attention I know we're not supposed to talk about prices and stuff but everything crashed miserably for the entire year and so anybody who had any money on spank Shane lost a bunch of it and that sucked and so realized you know stable coins are actually really helpful so performers we started earning in booty and then when they cash out they want to cash out neat so I can send it to whatever exchange and get it in their bank but the the process of going from booty in your channel to eath in a wallet was really annoying because you had to either close there's a couple ways of doing it you could close the channel and then you'd have the booty and then you would send that to the hub and hub would give you back Etha or you would wait for the hub to deposit eath into the channel and then you would swap in the channel and then you would close it but then the next time you would still have to go through that process of creating the channel and joining the channel again and it was a mess and so what we ended up being able to do is get every combination of deposits withdrawals and exchange in a single on chain transaction so performers when they want to start a show now they just sign it a thing and the hub will deposit into their channel directly one transaction they don't need any eath for every operation that is not the user depositing into their own channel to fund it the hub will be able to do it so long as they have a user signature and that keeps things in sync and that's it's gonna be a much better model and I'm really excited to launch it so also wanted to announce our decentralized exchange which will be called [ __ ] swap I'm gonna I'm gonna give a demo of this actually in a second and I don't want to I want to talk about the future other things that we're building affiliate system with instant pants and other great use for payment channels we're very excited to integrate with the gnosis safe multi-sig wallet and we're looking for partnerships for Fiat off-ramps so that performers can earn booty in a channel and then spend it with a card then they don't need a bank and then we went and this is I don't know if you guys all saw this but we're also very interested in entering the crypto teledildonics space and using the Daddy the the the work that team daddy made in the status hackathon that is a dildo that he is holding on stage which which is controlled by the etherium a net-like yeah it's pretty it's pretty cool so let me show you guys something neat this is this is gonna be our exchange interface simplest ever standard interface best UX on earth you push the button you get what you want here's how it works as you as you increase power you can't see them shooting out of the card because the resolutions whack but normally normally what you'd see is the little globules which shoot out of the cart and then they make this big glob and then when you when you hit confirm it like pulsates for a second and then it disappears I was trying to get it to like coagulate and then drip but you know we're limited by the technology all right that's all I got and now I'd like to invite our June up and here's his presentation cool thank you hello hello I'm Arjun I am the founder of connect we worked with spank chain we're going to continue to work with spank chain for obvious reasons I'm gonna zoom out and give a little bit of context about everything that we're doing and then that way you can see where we are now and where we want to be in the future one thing that we sort of asked ourselves when we started working in this industry was in if in you know a year or two years every single thing that we do in scaling becomes obsolete which it will what is the point of doing scaling research in the first place or at least building scaling systems right now and the truth is that there are a set of problems that can be solved immediately that are associated with the things that you cannot do in the world right now spank chain is a great example of this right doing instant peer-to-peer payments for the adult industry was not really possible doing payments for the adult industry was really really difficult and and now we can do them so what can't legacy financial systems do legacy financial systems can't do very very small things legacy financial systems can't serve high risk users and they can't really do peer-to-peer anything that you guys can think of that falls under these things please come talk to us because we're really interested in figuring out how to help what is connects a lot of people I think that wears like a subset of spank chain it makes sense because we've been working together so closely for so long really what we are is just open source an opinionated infrastructure for scaling specifically for scaling micro payments we want to help the projects that have this problem today and collect data and hopefully money to be able to solve the scaling problems in the future Jeff Coleman is definitely gonna disagree with me on this but I really do think there is a ton of value in doing imitation and actually collecting real user data this is sort of a view that Amina and I share and big part of the reason why we're working together so what did we learn from spank chain we we partnered up really closely with them and there were some really phenomenal things that came out of it one of the biggest things was that the adult industry is really really cool it's really an awesome space they are very very open-minded very willing to learn new things and most importantly there are a ton of problems that exist over there that can be solved by crypto and solved by auction in general highly recommend you guys check it out if you don't already the second thing that we learned and and again I'm sorry counterfactual guys and all of the other researchers but that so so there is a lot of theory in scaling research well and it's really incredibly valuable to do these exercises and and learn what sorts of things are possible within a logical framework the thing that happens though is that when you put this stuff on main net when you put it in front of real users almost all of it breaks we went through like I mean I mean didn't mention this but we actually also between you know implementation implementation three and implementation four went through like three rewrites of like the framework that we wanted to work with and like we we as connect sort of initially came to spank chain with like hey we've already built this whole thing like why don't you guys just integrate it and none of it would have made sense like literally none of it and the reason that that happens is because your users are crazy they they don't really do any of the things that you expect them to do they have entirely different needs and most of the time they don't fully understand your system and so until you spend a bunch of time working with them until you spend a bunch of time collecting data from them you don't really realize that oh you know for instance users really don't care about paying ten extra cents of gas costs but they do care about coming back online to sign transactions turns out signing transactions that leads to like a huge drop-off paying gas most of them really don't mind that much the last thing that that we learned was actually I think I covered it yeah so so what's next we sort of did this thing with Bank chain where we worked on figuring out what one node would look like how do you solve micro payments for like one ecosystem that has a bunch of users clustered around it now the goal is to go from 1 to n so basically copy pasting this same framework in a bunch of different places and and then connecting a little bit into a network you can see here we have like while it's connected to channel managers which are contracts connected to hubs this is how our existing system works normally at this point it's also connected to another wallet and then - well let's can pay each other but there's no real reason why you can't take pretty much exactly what we have right now and just keep going with it adding more and more hubs to the mix until they're not really helped anymore they're they're nodes and this looks a lot more like lightning or ratings we think that this is really valuable because the the user experience that we want to deliver is you wake up in the morning you put 50 died or something like or maybe Booty actually you put 50 booty on to your wallet in - it's like a daily spending account like a checking account or something like that and then you never pay gas again you can earn money you can spend money pretty much anywhere you never actually have to pay gas until you would draw your funds at the end of the day so we actually had two announcements so I appreciate can sort of a Ludington but we did have two announcements that we're really excited to do the second announcement is that we're officially partnering up this is probably not really surprising to anybody who especially the people who thought that we were the same organization this whole time but we we have partnered up the way that this partnership works is we've actually done an ownership swap we now own a certain percentage of spank chain and spank chain now owns a certain percentage of us we both think that this is a really really cool way to incentivize mutual collaboration in the future more projects should do this in order to stay aligned we they want to see spank chain succeed and spank chain really wants to see us succeed how does how does it shake out spank chain is going to go and focus on all of the note bits basically optimizing the user experience optimizing how all of the amazing things that you can do as a single node in our network and we are gonna go build the rest of the network so optimizing on how we can connect all the notes to each other so you could kind of think of it as like you know sort of like one hub and then many hubs and then we're sort of the [ __ ] that is in between yeah we're really incredibly excited to be working on this and an incredibly happy to be up here sort of letting you guys know that this is this is our plan in the future we're open source we're free infrastructure we don't have a token we just want to figure out this problem and we want to figure out this problem and use the data that we get from this problem to figure out many many other problems in the future so if you have an interest please please please reach out to us please go check out spank chain if you haven't already they literally have the best user experience in crypto they're also one of the only companies that is like has real users and is struggling with the real problems that come with having real users and and I think that that is all I've got yeah thank you very much very curious about I think like there have been many talk about projects like merger or acquisition takeover Center how do you guys this side like organically across I guess ownership evaluation at that point we we sort of just kind of like met up at Amin's house one day and we're like we really want to do this and and and sort of decided what would be a fair price for both and like one of the great things about like doing this kind of a swap is like we both want to see each other succeed so neither of us is really incentivized to score each other over but that was that was basically what went into it more more deals should be done like that by the way just hanging out at someone's house in general yeah well my my investment thesis was like invest in all the things that use state channels and so we as a company you know in working together we can work with the teams that we know are going to deliver and we know that if they can deliver something for us and they'll be able to deliver something for everybody else and regarding the numbers I mean it's like any negotiation you pick a number that makes you both happy and then move on with your lives

Automatic transcript — names and jargon may be misspelled.