EthCC 2: Henri Pihkala
Ethereum Paris·Wed, Oct 9, 2019, 12:00 AM
EthCC 2 EthCC, the Ethereum Community Conference is created by the community, for the community. It brings together great minds and forethinkers, and allows the community to grow. Follow us : @AssethFR https://ethcc.io
Transcript
a project but today I'm here to talk about something called model plasma mono plasma is a new special purpose of change scaling solution for one-to-many payments we created mono plasma because we needed it but it's reusable so we wanted to spin it off as a separate little contribution to the etherium scaling space I hope you guys find it useful here are some of the things you might want to use mono plasma for revenue-sharing and that's actually something that we're gonna use mono plasma for and I'll talk more about that a bit later other use cases include paying out dividends or staking rewards doing frequent air drops all kinds of loyalty reward schemes may be pension payments even and so on basically anything where you repeatedly fan out value to a large and dynamic set of addresses and want self-service withdrawals so this talk is only around 15 minutes so I'll turbo charge through why we needed mono plasma for streamer and then explain what it does and what it doesn't do and finally we're gonna see a live demo so awesome let's get started to help understand why we needed mono plasma I'll briefly explain the basics of streamer so streamer is a pub/sub messaging network for real-time machine data such as data from you know IOT sensors smart cities connected cars crypto market data and whatnot so it's it's not a blockchain it's a companion network for one such as a theorem it basically delivers messages from data publishers to data subscribers in a robust decentralized scalable way and there's all kinds of nice cryptographic stuff going on such as you know sequences of messages can be signed and made tamper proof and so on so that's kind of like the base layer now on top of this base layer there's a marketplace gap which allows these data publishers to sell access to the data streams they are producing and the thing we needed mono plasma for is related to the marketplace so let's drill down to that on the marketplace we're working on a new feature called community products essentially we want to enable large groups of data producers such as end-users owning some connected gadget like a Fitbit or a Tesla to pull data into this collective data product on the marketplace now pooling the data is not the problem the problem is when somebody buys the product there's there's this payment there's revenue and that revenue needs to be shared among the data producers into that collective product now if there's just a handful of them like in this picture this is no problem to do on chain right and but if there's let's say let's say 100 your transaction size will start growing right and you'll start to approach the block size limit and at some point this becomes impossible to do on chain now in our use case there could be hundreds of thousands or even millions of data producers into this collective data product so distributing payments to these huge crowds is just nowhere near possible to do on chain today so we built mono plasma our requirements were these we need to distribute these individual lump sum payments to large groups of recipients a little bit like doing an airdrop every time new revenue enters the system the recipients must be able to accumulate value over time and withdraw when they want by doing an Unchained transaction the recipients must be able to join the system without doing an Unchained transaction or placing a stake now this is a little bit different from other payment channel stuff out there and in fact it's crucial for us because in our case the users are mainstream and users and we can't have obstacles for joining such as having to you know go and buy eath on day one and finally the system should be trust less and transparent now we didn't really find existing solutions that would fulfill these requirements so we rolled our own obviously we were inspired by the different plasma variant and payment channel stuff out there but we basically threw out everything that we didn't need in order to find the simplest possible mechanism that does what we want and only that while maintaining good security properties and trustless Nasser today we don't have time to cover all the little differences and similarities between mono plasma and other solutions in the same family so I'm gonna focus on the main difference which is this so we sacrificed generality in favor of special purpose right this is not a generic payment system where everyone can arbitrarily transact with each other know this system is unidirectional that means that there are no transfers between account on the side Channel in other words tokens cannot be spent on the side channel now why is this useful well since tokens cannot be spent on the side channel there is no double spending problem which simplifies things immensely the account balances on the side channel can only increase they are your QR your cumulative lifetime earnings right they can only increase monotonically and hence the name actually mono plasma so if the account balances can only increase what about withdrawals then well withdrawals are tracked on chain instead of object so the on the off chain side channel that keeps track of your lifetime credits your positive balance and the on chain smart contract records your lifetime debit your negative balance so the withdrawal balance at any time is obviously the difference and to withdraw what you need to do is to prove your positive balance the positive component to the Unchained smart contract as it already knows the negative component and you do this by providing a miracle proof just like in many other plasma like solutions so let's look at a simple example let's say our earnings on the side Channel are 100 and we can provide a proof to the smart contract and the smart contract has already seen us withdraw 30 so in this case it would let us withdraw 70 from from the smart contract and update its state to say withdrawn 100 so now if we provide a proof again to prove we've earned 100 the smart contract knows we've already withdrawn 100 and obviously it will give us no more tokens so as you can see the withdrawal proof mechanism is is very simple but quite elegant let's cover some other aspects of mono plasma so there's an operator validator model the operator is in control of the off chain state and in mono plasma he's actually the only party who can cheat and the job of the validators is to make sure that he doesn't both the operator and validators maintain the off change state in a Merkel tree and the operator periodically publishes the route hash to the Unchained smart contract to enable withdrawals from that state so this is all familiar from many other plasma variants as well one difference however is that there is no challenge period slash exit game as there can't be double spending instead there's a simpler non interactive freeze period that allows time for the validators to exit people's funds from from the last validated honest block in case the operator is called cheating so this means that earned funds do become available with a few days of latency which is fine for many use cases including ours mona plasma lives in the streamer github at streamer - dev / mono plasma and it's already been forked five times yay awesome it ships with a revenue-sharing demo which showcases the functionalities of the framework so enough talk let's see if all of these works time for the live demo let me just Mirror Mirror my screen here alright with this mic I need three hands but let's see how we manage so here I have in my terminal I have the operator running I'm running against ganash might as well be the main net but speeds things up a little bit for this short demo in another tab I have my validator running and in brave I have the demo UI so this is basically like a control panel so it's a revenue-sharing demo I can inspect the state of an individual in the revenue sharing pool I can see the state of the overall pool now everything is zero still I can see a list of the blocks published by the operator I can do transactions to add revenue to the pool and I can add people addresses a theorem addresses to the pool so in my meta mask I have configured two addresses here I have Alice and Bob and we're gonna start with Bob today I'm just gonna go ahead and copy paste Bob's address over here and add him to the pool so now we see that there's one member in the revenue pool but that's kind of a boring demo so let's add some more people to the pool here I happen to have 99999 other addresses that I'm also going to add to the revenue sharing pool to show some scale here so let's go alright now we see that there's 100,000 aetherium addresses in the revenue sharing pool but no revenue just yet so that's where Alice comes in you see alice is rich she has 1 million unicorn tokens on her account so she's gonna add some revenue to the pool by sending some of those tokens to the mana plasma smart contract like this let's do 100,000 now the operator should publish a block here for that state we can see that it's still in the freeze period which is 20 seconds in this demo in real life it would be in the order of a couple of days so we can see there's now hundred thousand tokens in the pool they are still frozen when the freeze period is over they will become in this into this category available let's do that a couple of more times just to show how the value accumulates there so we have like incoming revenue into the pool for as long as we want let's do a couple more and say 600,000 all right now we should have a total of 1 million tokens in the revenue sharing pool and in this demo these tokens get distributed evenly among the members in the pool so we have 100,000 members so everyone should now have earned 10 tokens in the pool so this gets us back to Bob now let's switch to Bob in mano plasma here we can see that Bob currently has zero unicorn tokens in his own chain wallet over here but let's inspect Bob's State on the side Channel we should see that Bob has 10 tokens on the side channel they are now in the mono plasma smart contract and the side channel knows how many he has and what he needs to do to withdraw them maybe he wants to spend them he can provide the miracle proof to the smart contract to withdraw those tokens the easiest way to do that is to click this withdraw button over here now this does a transaction and that includes the miracle proof and when I click this confirm just watch watch this number over here ooh so earnings available goes to 0 total withdrawn goes to 10 now that may not seem so exciting but actually something very very cool just happened here if we go back to his wallet we can now see that Bob now has ten tokens in his wallet so what just happened let's summarize a little bit so we added a hundred thousand members into the revenue pool we did a few transactions to add tokens a million tokens to the revenue pool and then one guy out of 100 thousand decided that okay I want to withdraw and he withdrew his share ten tokens by doing a transaction providing the Merkel proof and now he can spend his tokens on chain and do whatever whatever he wants there's one little thing I'd still like to show you before we finish and that's this big red button over here that says steal all tokens so when I click this button the operator will commit fraud right he will try to steal all the tokens for himself and that should trigger the attention of the validators I'm gonna click this button we can see that the operator publishes a fraudulent block with just one member in it himself obviously and it's still in the freeze period so now is the time for the validators to act and try to prevent this so we can check check back into our terminal and this valid validator oops this validator was configured to exit these five addresses if something bad happens and so it has done and now when the freeze period is over and the validator the operator tries to you know close the the fraud and withdraw the tokens that we can see that that transaction would not succeed anymore awesome so this was just a quick scratch and off the surface so tomorrow there's gonna be a mono plasma workshop at 10:30 so if you want to learn more and especially talk more about how to apply mono plasma in your projects then be there thank you and good luck I think we're pretty much out of time for for this session so come grab me or let's meet at the mono plasma workshop tomorrow
Automatic transcript — names and jargon may be misspelled.