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

Loading player…

Marek Kirejczyk of Ethworks ~ Universal Logins

Ethereum DenverWed, Oct 9, 2019, 12:00 AM

Marek Kirejczyk of Ethworks Presents Universal Logins

Transcript

[Music] so let me start by saying it's great to be here great to talk to such a wonderful audience as yourself so the topic universal login I give you two quick slides of background so what I do is I run a one-stop shop for a blockchain project we do a concept designs the app smart contract development recently former verification custom block chains and bridges and we are lucky to work for some of the great brands in our space and we are lucky to work for some great brands outside the blockchain space and as we did many times we encountered the same problems it's really hard to unboard it your users to achieve especially newbie users and you might not remember that anymore because you buy your ricci reom a while ago you buy your crypto along ago and now you're just switching back and forth between different currencies but and I'm not making this up this is from the real tutorial you can find on the internet this is 17 steps you need to take by atrium and it's not very different for any other currency and it's not very different from any other tutorial you can see on the web so ready here we go so I need to choose the wallet I'm gonna choose a Mademoiselle kiddies later and Madame s happens to be the only wallet that I can do it with I'm gonna save a keystore file because I know I need to backup because you know it's a good practice and everybody tells me I should do so and I'm gonna store it in a very safe place perhaps a drawer because you know drawer is the right place to store all your money I'm going to open a wallet and I'm gonna copy a wallet address for using later boom I go to exchange I pick the exchange I'm gonna use coinbase I need to register I need to setup two-factor authentication because I'm aware of the security issues so I want to be on the safe side I'm gonna verify my account and I'm gonna upload my ID to go through kyc and then I'm finally can deposit some money and buy eater almost there I still need to confirm to send either to my wallet boom once it's on my wallet ah not yet I need to confer with two-factor authentication that I want to do a transfer and I can finally go to each gun and keep refreshing either scan until I see the transaction went through and so I can go to crypto kiddies and start buying and selling so the problem is the problem is to partner one part of the problem is usability it's really complex software ecosystem with multiple steps that we need users to learn we need to use exchanges we need to use we need to learn people how to use exchangers and multiple steps they need to go through and we - we need to ask users to install plugins learned wallets and so on but even then even if we ask users to learn all the seventeen steps we still end up with not-so-good security because we still have situations that we need to backup or we need to order Hardware wallets that we still need to store somewhere and one could say we could use the multi-sig wallets but the problem with multi-sig wallets there are still pretty hard to use as of today so the solution we would like to propose is building something that is already familiar with with the users something like web 2-0 experience that people already know and use like everyday and that's where universal login comes in so an idea of flow I just pick up the name boom I'm already registered I can start using application and here is a quick screenshot screencast from the demo application we built last year and to show on Def Con here we go [Music] boom I'm already all boarded so what happened to explain that I have to explain you what the universal login is all about so universal login create technical concept for first technical concept is we build personal multi-sig wallet so everything we do we do with a smart contract that is deployed it stores all the balance and do all the interactions with the blockchain second concept is matter transaction so meta transaction enable a bunch of different usability features and most important one is ability to interact with a smart contract without having any eater on the different keys that I store on the different devices so the only balance the only eater balance or the only token balance that I need to store as I store on the wallet itself on the smart contract and finally universal login itself is ability to give a name to wallet I created and use the name to log into different services give them their own keys and give them ability to interact with my money with my confirmation so here is here is the second part of the presentation I'm gonna I'm gonna use another application so let's say on the left there is a mobile application I'm using the same name but now it already exists so I can connect and confirm from the first device and boom I can start interacting with the application from both of their devices so then here is the summary of the flow we just go there and if account already exists I can use the other device to confirm that I want to connect this particular device this particular application to D my contract wallet and one more technical summary so we have wallet contract in the middle we have a bunch of different keys that are in bunch of different on bunch of different devices and we have a real layer that helps us relate transactions so we sign a transaction using the key relate to relay to relay a real layer wraps into each Ihram transaction push it to the wallet push it to the blockchain to the wallet contract and boom transaction happens on the technological side the stack looks like this we have smart contracts as the heart of the system we have a real ire which is JSON RPC server that provides an RPC API and we have a Java Script SDK that allows you to easily communicate through the relay with a smart contracts on top of that there is a demo application that we did you just so good are we ready for some coding any questions so far yeah someone's very excited excellent so I'm gonna show you how in 15 minutes let me just grab something to drink so in 15 minutes we're gonna create a new application we're gonna create a development environment and we're gonna create a wallet and realize some transactions for it are you ready good I'm gonna need to do okay I'm gonna delay it a little bit further I need to attach microphone now I true you can ask you hear me an expert on microphones here okay I think it that should good can you hear me can you hear me wonderful so let me go let me go to my development environment okay can you see it can you see it good as you see I have a numpty catalog let me let me start with an empty catalog and we're gonna create a new application can you see the font size is fine can you see it should I enlarge it a little bit let me do that is it better now okay scream if it's still too small so we can see application is empty and I'm gonna create a new application called ETH Denver just gonna use all the defaults and I'm gonna add a package that is called universal login SDK good so that's gonna installed it's going to be pretty fast and in top of that I'm gonna add another package and it's going to be a development of dependency and it's gonna be called universe so login opps from operations it's gonna take a little bit longer to install and what this package does it creates development environment that runs mock mob blockchain can ask for you deploys ian has deployed a couple of test domains deploys a mock token and i love you really easy quick start quick jump into application now it's gonna take a moment to install and there's going to be one problem that i wanted to show you so you know if you decided to hack around with it so the ops project has a dependency on ganache ganache has dependency on web 3 and web 3 doesn't work for coupled versions in a row and there is a way to force to force package JSON to use particular version ok then save so this is how it looks like now and if we oh yeah we're gonna add two scripts before doing that we're gonna do like this so we're gonna have a start script that basically gonna start our application easy-peasy and we're gonna have start death script that's gonna start development environment so it's gonna do universe so login start bath then and I would like to tell you that that when I do this it's gonna work but I ain't gonna and the reason is exactly what I told you in a moment so what I need to do is I need to add resolution section in my package JSON and I'm gonna say we're free it's gonna be 1 0 1 0 betta 35 which which will happens to be the kind of last semi working version they're making me stay or something yarn ok resolving okay we can use that time to create a new file which gonna be start but start is good and we're gonna just console.log something for now good we have we can now run dev environment boom you can see ganache it's up and running and eyes deployed talking contract deploy relay has been started and I can do now yarn start we're gonna run our I think I need to treat the size yarn start that's gonna run our application boom good so what we want to do is we want to mmm we want to create an instance of SDK so we're gonna import that so note we're gonna write in pure JavaScript you can use typescript if you prefer you can use yes see well it's gonna be a six actually okay and we're gonna require it's really hard typing here you know univer can we have some help you okay there's gonna be some ugliness to that so we're gonna add that default here and once we do that we can we can create an SDK itself so we say new universal login SDK and it's gonna take two parameters and the first parameter is gonna be address of the relayer and we have a real layer over here on port three three one so HTTP local host and port number and the second one is going to be e to room note so very similar just a different port so I'm gonna copy paste that up too fast and the port number is here one eight four one eight five four five good and now that I have an insta Kay what I can do is I can create a contract now creating a contract is super easy all I need to do is to create and turn until how I would like to name my wallet contract and there is already domain registered my login eth and there is just one thing I have to remember about its it's a function that returns promise so I'm gonna need to pack it package that so a sync function create I create wallet and that's pretty much it now this function returns to two values one is the private key so it's going to be a new private key created for this particular device and the second one is going to be wallet address and what I'm gonna do is I'm simply gonna display both so we have private scheme and we have wallet address now to run it properly we're gonna need to well call the function but create wallet and we will need to provide education I need to do is make sure that if Irish shows up we're gonna display it boom let's see if it works boom I just created a multi-seat personal wallet and there is a private key so what I'm gonna do is I'm gonna save those values to use for later so we're gonna have private key and the private key is the first value so I'm gonna copy paste it and by the way we are now five minutes into coding and we already created a wallet try to do it with web 3 and I'm gonna also store contract address so and by the way if I try to run again it's gonna fail and the reason is that the name is already reserved so I cannot create the same name again right but what I can do is I can try to transfer some either so we're gonna write a function transfer eater that's gonna use it's gonna transfer some value from the wallet to anywhere else and before I do that I'm gonna display the balance of all of my contract see see how much easier do I have so SDK has a provider and provider has a get balance function and by the way it returns promise so all I need to do is is ask the function and display the result and here we go and we're gonna ask this we're gonna call this function this time so that's contractors wallet address you can use it on amass then okay not very readable so let's to string and you can see there is some balance and the reason is that we already have that the development environment already put some tests eater on our contrary so we can play around so okay I'm gonna now try to [Music] transfer that somewhere so what I'm gonna do is I'm gonna call execute execute function and it takes two arguments private key it's the first one and the message is the second one now what's the message message is very similar to idiom transaction so it has a - it has a value so let's say just one fail for now it has a from but from this is interesting from is actually our contract others and it has one additional parameter that you probably never seen before which is gas talkin so real I are gonna pay for us and we have to tell him what is the token that we would like to pay and we're going to use a token that was already deployed we can do it with eater we just provide zero X zero two zero zero address but let's make it more interesting as you could see before we had this as I mentioned before we have this gas token deployed well that can be any year C 20 token that relies supports and am gas token is here we also need a to address so I propose we're gonna use just zero zero zero but we ain't gonna use when I get the right number of zeros we're gonna use 0 0 0 0 1 because 0 0 0 is a little bit tricky and often times there is more than you expect err and let's see if it works okay I think there is yeah so let's do that and [Music] yes and see if it works something more in violet argument to arrive by anybody see what that might be mmm balance the string balance the string execute private key message perhaps it's the other way around [Music] I'm not sure anymore okay good and that needs a way to work all right because otherwise it's gonna boom and you can see that one was transferred actually I transferred twice in the first and the second transaction because development environment is the same right so there was no await in the first example now there is a way so we do two transfers so I can look at the time and tell you that we are 15 minutes into presentation we already did some transfer use meta transactions deploy a wallet so it seems like we're doing pretty good so I think we can stretch it and try to transfer token token is traditionally a little bit more complicated so I'm gonna create a new function mm and it's gonna be called transfer token and before I do I'm gonna create function get talk and balance so we can see what the balance of the token is of our contract before we actually so it's going to be need to be a function wait get talking balance and we're going to see what is the token balance for the contract address okay now this is where it's oftentimes get a little bit more trickier because now we have to interact in between multiple contracts but I think we can tackle it just fine so all we need to do is have a token contract and what we want to do is we kind of call balance off so let's say this is address that we want to see the balance of and that's going to be a balance and we're just gonna display it now the problem is we need we need this token contract so that's that introduces a bunch of new things so we're going to need to have a contract abstraction and we use eaters as a default provider so so we're gonna need that and we're gonna need an API for the token so we're gonna require that from universal login ops projects and we're gonna need to create an instance and if any fingers we can do it here as accounts because we have because we have all that we need as cons right so that's gonna be a new eaters contract and the first argument if I remember correctly is the address so gas token the second argument is the interface is the ABI so talk an interface and the last is providers so SDK provider and if we are successful we should be able to display token balance of our contract are we successful yeah there's a typo here uni bar so login do you follow me can you find typos can you see when I'm wrong boom again not very readable so we're gonna okay good so you can see the balance there is some token balance on the wallet but it already been subtracted multiple times because we pay for the with the token for all the transactions because relayer place for our transactions and get the refund from the contract in this token and the reason why it gets in this token is because we told him to so we're doing really well so why not push it somewhere and we're gonna yeah let's just copy that and see if we can transfer talk so so we're still transferring token to the same address now value is 0 because we well sorry actually 2 is now what who can tell me what the two should be now anyone I can here talking smart contract did you say yeah so we're now doing a transaction to two against my Tron track which happens to be gas talking as well we're still doing from the same contract we're still gonna pay with the same token but we also need to create a data now data is that encoded call to the function transfer of years C 20 so data equals it's gonna be a tough one so we're gonna need to take interface of token contract and from its functions pick the transfer function and encode and we're gonna need to give parameters and if you remember transfer HC 20 token transfer have two parameters who remembers what are the parameters so the first is two and the second is amount so two didn't change and amount let's do seven this time instead of one so let's see what's gonna send that seven very token again so there is a typo gastroc and where is God talking God talk yeah okay so here it is good I think we're now in spend like 15 minutes getting set up in the project setup in there is decay doing the eater transfer doing a token transfer and we did it all under 50 50 lines so I think that pretty much gives us thank you okay so some of you are impressed good I can we can do it again so you can see I'm not cheating we can also see what is the token balance of two so we can see it's really transferred it's not only subtracted or anything good good twenty-one good yeah I think we will go now to the presentation so I just want to say if you ever would like to bring it to the TAS Nets it's really easy there is a just you just need to change the gas token address and you're also gonna need to change this address and that address and at any point of time you can go to the to our documentation and it's older so it's gonna take another three minutes but I think we're running out of time so I don't want to I want to take those three minutes good so I'm so very happy to tell you we get a lot of traction we started project last year there is a bunch of project already building in top of that even that we are still early stage a bunch of projects that were inspired but our work we're doing a lot to promote it even though it's not production ready and I think we need a couple more months to get to production we promoting it with showing what we're building so you get the idea we build this development environment so we can try it so you can hack with it and see give us feedback and see how it works the important thing is what we building is open source it's open we try to standardize it so anyone can build on top of that anyone can build his own implementation anyone can integrate that into his own product on the technological stack as you as some of you probably noticed we're using ETH Jas in top of that we build a library called waffle there is already getting pretty popular which is a testing library for smart contracts building top of eaters building top of it yes and I'm super happy to tell you that one month ago we started our efforts with formal verification so we can formally verify our work so to make sure that there are no any bugs that might lead into losing money by someone in the future and I would like to say a special thanks to Alex who's been working with us all the way through on it Alex Van de Santa was also the person who originally come with concept and I would like to find enterprise and each room community found which funded a lot of for development and for last year if you would like to learn more go to universal login io go to our github and we would love to see you contributing we would love to see you hacking and with I'll be sticking around for the next three days today and another two days and we'd love to help you if you have a project that you would like to use to try it out it's lovely if you don't have idea we have some idea what we could be how a wallet could be built on top of universal login and we would love to build a team if we see people interesting in doing so so and follow me on Twitter if you would like to get updates on the topic and I think we still have a couple of minutes so if there are any questions I would love to answer does anyone have any questions questions questions questions oh yeah there are two questions over there can I ask you sir to come up to the mic and ask a question so when you address usually user why is it the top true so it's a very good question so the development environment already deploys a token and put some development eater and put some development token on to the contract of course in the real life you have to transfer the money first to be able to do anything but we imagine there are some use cases that if you get verified you can get some free tokens as an incentive to start doing things and those first token can can pay for the very first transactions that you want to do so or imagine you have an icy IO tokens that you get and you don't have an eater you can actually start using them right away okay following your question in that case I guess in the very beginning okay so question the first time user ever on board because they don't have good know anything so you points to some generic culture where the top provider trying to put some money but once something happens and the user start getting you as a design pattern you have two points to use a specific control which has users own one thing follow the question but every user have a his own contract yes that answer the question or not yeah otherwise like people you know know everybody has his own contract yeah and as you know as you know we're working on contractual deployment so that actually the contract is deployed only wants the funds already I think there was one more question did you ever have a question okay okay one more question anyone has last one question if there are no further question that well thank you

Automatic transcript — names and jargon may be misspelled.