Dev & Tell | trevormil - Blockin
Developer DAO · 29 Jul 2022 · 34:05
Trevor Miller, a computer science student and Developer DAO member, presents Blockin, a TypeScript and npm library that aims to be a universal sign-in standard for web3. He explains the difference between connecting a wallet and signing in, how EIP-4361 Sign-In with Ethereum works, and where it falls short for multi-chain applications. A live demo shows signing in with several chains and verifying NFT ownership, followed by questions about chain drivers and wallet integration.
Speakers
Topics
From Developer DAO; community: Developer DAO.
Transcript
uh welcome to what's going to be another great dev and tell so if you didn't know devontel is a 30 minute window for members of the dow to showcase something you're passionate about or i've been working on this can be an awesome project you've been working on demonstrating unit testing best practices automation goodies smart contracts how to structure a project basically if you got a passion for something this is your opportunity to share it with the community and today i'm happy to have on uh trevor who is going to be showing off his project blokken take it away trevor thank you yeah so hello i'm trevor miller um let me just get my screen shared real quick um let me know if you guys can see this and if the audio is good
uh yep yep we can see it and audio is fine yeah and let me just check if i switch tabs can you see this too yes wait okay so welcome um today i'm going to be presenting my project block-in which aims to be a universal sign-in standard for web 3. um before i start let me just say that whoever wants to ask questions we don't have to wait till the end just interrupt or if you're confused about anything uh just let me know i will um stop periodically maybe for questions and then have a q a at the end too if you have any i just have a question maybe you could put in like a link like say twitter or your website if you have one um in the chat and you know
for us to get more information about the project yeah for sure um would that be which channel uh so there's uh on the side uh if you uh the top right side there's a little chat icon if you click that the the chat is embedded in this um in the actual uh uh developer's voice now yeah if you put your mouse over the resource you'll see like a square box that'll open the chat all right cool i'll put in three links or two links actually um first is the demo site that you can follow along with the second is a documentation site um
and yeah and then those will have links to the code and everything needed for like the npm and stuff like that awesome thank you all right so let's get started so i'm trevor miller trevorville.eth and i am a computer science student at virginia tech um i've been building web3 for about over a year i think since like last january-ish um but this is my favorite project so far i have to say and i've been a developer down since mid and actually if any of you guys remember at mid time there was like this issue with um
some of the images not loading and it would just be like a continuous loading spinner and i actually was lucky enough to get one of those and in compensation i got sent the one with id number one so i held that for a while and um so a little fun fact and then how did blocking start basically i took an intro blockchain course at virginia tech and my um my group it was a group project and we basically had to do like a deliverable and like a paper by the end of the semester and that's kind of how it started and i continued it on throughout the summer and built it out to actually something usable for um web3 devs
okay so i'll start with a little background for connecting versus signing in so connecting is what you like are probably familiar with with typical apps you connect your wallet via metamask and then send like a transaction signature every time you want to like add or update to the blockchain but signing in is more used for like off chain stuff like maybe like a private database or just anything off chain and for those you don't need to put it in the transaction format you just need to like verify that a message was signed correctly right um so for signing in you use you sign like this generated message and
then if you can authenticate who you are you can be granted access to that off chain database using your like ethereum address for example um an example of this is if you guys have used openc they use transaction signatures for stuff that like actually updates the blockchain such as like nfp transfers or sales but then they have their own private back end for stuff like likes follows um stuff like that and that um they have this like sign-in mechanism where you're like authenticated for 24 hours if you've ever used a c you might be familiar with that so these are two different things um
they can use be used in combination so you connect your wallet and then you sign the message with your connected wallet pretty much um so the execution flow is pretty similar um to a signing a transaction you will be prompted to sign like a uniquely generated message with your private keys such as like this one on the right um and then one thing to note is this won't be added to the chain it's just check for signature so like if you try and broadcast this message to the network it won't be um formatted correctly but if the message signature pair is deemed valid a resource provider can safely grant
access because this that only the person who signed it should know the private key so they can grant access to the public pretty much and this is exactly like a web 2 username password combination and then lastly after being authenticated the resource provider can choose to handle permissions however they want so like once they know that this person is who they say they are or this address is who they said say they are you can maybe handle future logins like session tokens or json web tokens or you might just want to have them sign it in every time which is also an acceptable solution and
if you if you guys are familiar with signing with ethereum this is the standard message format for ethereum and signing in it was defined in eip4361 and basically it looks like a this message to the right it outlines everything in a human readable way um and basically the user knows exactly what they're signing into what's gonna happen and then also it has different protections against like replay attacks but like because the announce is generated each time and stuff like that and it's currently gaining a lot of popularity with web3 apps because many web 3 apps are fully on chain through
smart contracts or stuff like that they all also might want to use some private database for either for scalability privacy anything there's a bunch of reasons why apps would want to use something not launching so with block in we identified a couple um places where sign in with the theorem does fall short though the first problem is that neutral applications not belonging to a specific chain or like existing web 2 applications like netflix or maybe like university will have like a big user base who all don't prefer the same blockchain so for example um a neutral application who wants to
tap into like some bitcoin users and some ethereum users they can't only use signing with ethereum because then that just doesn't um the bitcoin users won't be able to interact with their app so sign in with ethereum is limited one chain and block can help solve this by expanding it to like any game um and then this transition from web 2 to web 3 will be made a lot easier with blocking because of this um signing theorem doesn't require or it doesn't limit to just one chain so that's the main problem we identified with uh sign with theorem but some other smaller problems are that
the dev tools and libraries that signing with ethereum currently offers are not the best and block in helps create a easy easily integratable one and then many use cases of signing in are not actually natively supported with ethereum or signing with ethereum and such as like nft sign-ins or stuff like that you have to do everything separately and it kind of just like a bunch of hoops to jump through to reach like a relatively simple simple goal so block in kind of combines all these into one step so what is blocking and kind of how does it help
block in is a typescript and npm library and it aims as i said to be a universal sign-on standard to support any blockchain and i do want to note that we extend signing with ethereum so anything you can do with sign in with ethereum you can also do with blocking um we just take that base and add some existing features or some more features to expand the usability of sign ins pretty much so as you can see on the right um we have a bunch of different chains this is the demo site that i dropped a link to in the chat and basically it allows um neutral applications can now let their
users choose what chain to sign in with and it'll all result in the same granted access because it their private database all they need is like an authentication so they can treat every single chain's signing algorithm as the same so as you notice here um the it's not all evm compatible but which they don't have to be so previously signing with ethereum was based solely on like the ethereum signature algorithm and um ethereum like addressing format but now blocking helps expand it to other l1 and l2s so you can
sign in with pretty much any blockchain and then we also envision that in the future you can even do like a hybrid approach where you can allow your users to choose between like an existing username password web 2 approach or let them sign in with like a web 3 approach such as block in as you see here and then the last thing is that block can natively support signing and verifying ownership of nfts on any chain that supports them so that is a cool addition to signing with ethereum that we support so
let's look at an example use case i'll keep coming back to this use case throughout the presentation but think of just netflix and think if they want to transition to web3 they'll have they normally have like a family plan and like a standard plan right for traditional netflix accounts um you can think of that as maybe an nft in web 3. so maybe you have a standard plan nft and a family plan nft and what netflix can do with block-in is they can deploy one of these nfts on every chain that they want to support and then just let users sign in with block in
on their own chain and it'll query their respective chain to check for ownership of that nft which will all result in the same sign in access so if they don't own the asset on their respective blockchain their sign-in attempt will be denied and they like won't be granted family plan access for example and basically this will allow any user who wants to transition to a web through approach um to not have to choose favorites for blockchain so netflix won't be limited to just ethereum users they can support maybe algorithm users bitcoin users a lot of users okay so now i'm going to
maybe do it like a little backwards i'm going to show you the demo of what it looks like first and then we'll get more into the technical stuff um so first let me just open this up just this is the nft that i'm going to use for verifying ownership of with this address the lobby lobster and so let me go over here to the demo site um so if you see here this little up in the blue banner is what the end user will see so they'll have like this little um display for their like address connecting and signing in so you can select whatever chain you want to sign in with
um so for this instance we'll do ethereum and then you can connect basically how existing apps will um so for here we connect with metamask and as you can see i'm connected now um and now if you want the user to sign in you click the sign in button and it'll pop up with this nice modal very similar to the web3 model that you saw with connecting but it kind of displays everything in a more ui friendly way just so that the user is not overwhelmed by like a super long and technical message and basically this will allow the user to customize
their sign in request so for example if they want to like sign in with like the blue banner asset think of these as like different plans like this could be like the family plan this could be the standard plan for this site we'll do like blue banner red banner um so let me first select these and you can see that if i sign in with both the blue banner and the red banner i'll get access to it'll grant me access and i'll get a fluent red banner you can allow users to just select only one banner and just think of these as like different dynamic privileges you want for different sign in so maybe you have an admin role or something like that
so as you see there and the other neat thing that i mentioned was the signing in with assets right so for example here it um it has this asset id which obviously isn't correct so if i like attempt to sign in with this asset it'll um block in will actually deny me service because i don't own the asset right so you see down here the address does not own the requested asset but if i sign in with that lobby lobster address that i have here i will be granted access because block in will check and verify that i do actually own the nft
so you see and then you're successfully granted and um signed in so that's like a little demo of how block-in works from the end user perspective and um it'll it's pretty much the exact same thing as like signing a transaction but instead you're sending a message and then getting access um the last thing i want to show with this demo is that if you switch chains for example let's say like to algorithm um it'll customize the display and then it'll also customize the message to maybe to your um algorithm account and like address and then also
verify within algorithms native signature algorithm so instead of using the ethereum signature verification you use algorithm signature verification so yeah that's the overview of block in like the demo um i think now is a good time to stop and see if there's any questions on anything um i know i kind of went fast but and i'm not the best public speaker but does anyone have anything so far no man this was great uh this is this is pretty awesome uh i guess one question from me is um as you were as we were building this like
what kind of challenges did you face technical or otherwise a good question so a big thing was that it is very difficult to come up with a good solution that can support like any blockchain um so we a big struggle that we ran into was how to dynamically support apps that support like multiple chains so like it would be pretty easy to just like build like a library just for algorithm sign in right or just for ethereum signed in but it's kind of that um
but switching off and switching between users um i think that was the biggest problem and then um it was also a little difficult because we were kind of in all different directions with um within the class project itself so we pretty much we um started off in one path kind of focusing on like more just like authorization assets or like nfts and then we transitioned to more like sign-in messages and stuff like that so it's kind of just putting it all together but i'm pretty happy with how it turned out and everything yeah excellent man and uh you mentioned that uh you foresee that maybe there's an opportunity to
kind of mesh this in with a web to uh sign in as well like uh could you speak more on that and maybe like an example of what you think could be a use case of that yeah sure um so i don't have a like an implemented example but if you can maybe just imagine like for example here instead of like the chain select instead of like one of these chains you maybe do like a select um like web 2 or select like sign in with username password yeah and then like when you select that instead of like a connect sign in option here you'll just enter your username password and you'll all be granted the same access similarly as you would be signing with the chain it's just um authenticated via password instead of
your private oh i see i see okay cool cool and uh is it just you working on this project or are you with a with a group of group of folks um it's two others it's i've done a lot more of the debt work over the summer because the my project mates have internships but um we all envisioned to like keep maintaining this and it was pretty even throughout the whole like development process awesome uh does anybody in the crowd have any questions for trevor uh what are some existing competitors that might be
similar yeah so like kind of like wallet connect it's a little bit different um right well okay you have to like sign it every time um but maybe there's other ones out there so maybe you've heard of like magic connect um and i think there's like a couple others but magic dot link uh that one also claims to be like a seamless you know web3 experience for like you know single sign-on for uh different d apps and other platforms also um like multi-chain support etc um yeah what are some competitors or is that completely off um i would say that we focus a lot more on like signing with ethereum and the other ones kind of focus more on like um
a single sign-on solution um if that makes sense we are um i'd say it's more i'm i'm i'm not too familiar with like the magic.link or anything like that um but what i envision our like competitive advantage would be is the modularity that we provide basically as you'll see later in the talk how we can build like a whole ecosystem like open source of block in um and actually keep it um i'm trying to think the best way to
phrase this but um if that kind of makes sense uh yeah it does yeah it's like open source it's a little bit different than the other ones and i'll just put it i'm not affiliated with magic but yeah um that you can compare um but here you go okay yeah i'll um take a look and do more i can get back to you on that um but i'll i'll explain more of the it behind the scenes in the the rest of this presentation and maybe that'll answer some some more of it i like that it's open source um if there's other open source projects whether it's like a web wallet or it's a like a mobile wallet uh so that's something that if
you know a wallet was interested in they could you know plug your code in and have that you know feature or whatnot um interesting yeah um we'll get through that with the chain driver implementation that i'll explain later um but um so basically what does block in like the library provide it provides the react ui components that you saw on the demo um really customizable you can like customize the model however you want you can customize this display however you want the second thing is functions to help create verify and manipulate walk-in sign-in challenges
um basically just parsing grading stuff like that the third is change driver implementations which we'll get to later and then the fourth is starter templates and tutorials um so as i've mentioned how does it work behind the scenes basically customize to blockchain specific logic um and then also you can specify nfts to sign in with so you might be wondering throughout this how does block can actually handle all this blockchain specific logic blockchain actually does is through a chain driver interface where we define about these 15 functions where you
which need to be implemented in order to successfully verify assign an attempt and basically whenever blocking needs to call a block uh blockchain specific function it'll just call the currently set instance of this interface so we have a set chain driver function which you need to set before you call one of these functions and basically it'll just call the currently set chain driver and this chain driver can be set and unset as many times as needed so in our demo example we have the as you see on the right the switch case for whatever chain the user is on and it'll
dynamically return which driver to use to implement the logic so um some may need api keys for like blockchain queries um such as like looking up ownership of an entity some functions don't it's kind of just whichever ones you need you might need an api key and so the thing here this is more of what um we're getting into with the question um does everyone need to implement their own change driver so the answer is no because blocking does provide some pre-implemented change drivers as npm libraries so if you see here we implement like our own
this is the ethereum chain driver we this uses morales sdk and ethers js it can and it can support like the main evm chains we also provide a block and algo driver as an npm pack package that uses um pure stake and algo sdk and it's pretty easy to implement like you can see this is only 200 lines of code and a bunch of these functions are just like calling um ethers or just calling morales you don't have to like implement a lot of the stuff it's kind of just choosing which choosing how to handle each function so all you have to do with to get access to one of these is to just
npm install it and then import and then like kind of create an instance with your own like morales keys um and then then you're pretty much good to go with all this blockchain specific logic um if these change drivers aren't what you're looking for or you want to like add support for a new chain it's pretty easy to do so and it's only about 200 lines of code and so over time we hope to have like a whole collection of open source gain driver implementations both built by block in and the community and then basically if you're just building a dap you just select plug and play which npm libraries which change drivers you want to include in
your application all you have to do is just instantiate it each time okay and then lastly we have just a little talk in the future plans for block-in we plan to continue to add new features to library support for more change and more if you guys have any suggestions let me know or leave a comment on github our intentions are for this to always be a public good so fully open source no monetization no token kind of just a library with code and then we're looking always looking to onboard applications and expand the block system it's a relatively new project so we actually don't have any
current dapps using it so it would be pretty greatly appreciated if you all could help spread the word about blocking we think it would be useful to many developers in web 3 and especially with using sign in with ethereum and stuff like that so that's about it i know i went fast i have a minute left for time but i'll open up to q a feedback anything these are the sites if you guys want to learn more um the doc site is pretty thorough if you have any questions too could you leave maybe like a contact info like whether it's email or linkedin like in the messaging and yeah for sure yeah okay awesome
yeah and i was going to ask about questions about the funding but it looks like you covered it in the previous slide so it's completely open source no uh you know monetary gain but i guess how do you continue to fund the development if that makes sense yeah um honestly we haven't really thought that far it's pretty new um but probably if it does like take off and get big probably third bitcoin or some other public goods funding um that's kind of what we have in mind i mean once we actually have the core base code and the foundation of it um working and kind of um
bug free there's not really much else to maintain except for adding new chains and once we um with the chain driver implementation we're able to actually like outsource that so like if other people want new chains they can just implement their own chain driver um so maintaining it in that sense like support for new chains can be outsourced and just open to the community um the core library isn't that big actually and won't take too much maintenance once it's like fully um working and has some uh battle tested and becomes battle tested got it so yeah fully open source yeah because like sometimes there's some
projects out there open source but then i guess that you know maybe it does something like where it's it needs to communicate with servers and then it has like a rate limitation and you need like the key so then there's additional way of having that project continue if that makes sense yeah yeah we're it's relatively new like i said so we'll get around to that when it comes but we're excited and just continuing to maintain it as you know so uh anyone else have questions uh yeah i mean the the last thing i was gonna ask is um if people do wanna help out i mean you you are uh we are here in the developer dao um what's the best way to kind of
get started are there open issues people can pick up or anything in particular you're looking for in terms of skill sets um i think the main thing that could help right now is just adding more chains and adding more even like more implementations of existing chains so for example we use morales sdk for the like ethereum driver right now but um that for like the paid version that's 40 a month and you might just want to make like an implementation just for ether scan which is free um so pretty much if you want to add support in that way that would be amazing adding new like change driver implementations and then
um you can either let us know and we can like either host it on the block in like github itself or um maybe have like a kind of like a repository of just like all the implemented ones um the other thing i guess is just if there's issues on github or um if you're really interested i can add you to like a chat with other our core team and we can um add you to like our little jira board and stuff like that if that's of interest to you guys yeah that's awesome man have another question um is there any
open source wallet out there that maybe you're thinking of like trying to implement um this feature on there so maybe like mycelium or uh electrum or like i know it has to be like ethereum baseball like an open source wallet out there where maybe you build an ad to that wallet and then have like a demo on how it would work like on a mobile device um i know you need also another uh you know the app um that that can connect with um but like you know there's someone where i'm trying to go with this yeah yeah um that i haven't thought of that before but that would be really cool um with regards to like built into the wallet itself that
would be really cool yeah you want to pick and then plug in your code so that wallet that was open source maybe like a different branch or you forked it and then add that functionality that makes sense yeah yeah that would be really cool um i can have to definitely add that to the list and um i do want to know that like the connect thing is also fully customizable um where is it so like here with ethereum on our um block and demo site um this this handles it through like web3 model but you don't you don't need it you can handle it through any way you want it's kind of just how any way you want like at this algorithm
handles it through wall connect um so you can connect to any dap right now just on the front or wallet on the front end but um yeah actually actually it being inbuilt would be really cool i'll i could definitely um look into that and maybe just get like a demo or um something just to demonstrate it because that that's a really cool idea yeah awesome yeah yeah plus one to that awesome awesome stuff gang uh so unfortunately we're at time here um but uh thank you trevor for coming on and showing us this awesome project uh really looking forward to seeing his development here so with that i want to wish everybody a happy friday a great weekend wherever
you may be and we'll catch you back here next week so i'm going to be dropping a link in the chat here uh for folks to claim their attendee pops and trevor i'll send you your kudos via dm um but other than that uh we'll catch you all here next time
Related talks
- Connect Wallet !== Sign In - t.mirror.xyz awkweb.eth
- ENS, Identity in Your Apps I Greg Skrill
- Dev & Tell | Yamen - LUKSO Network - The New Creative Economy
- ENS 🛠 Identity in Your Apps
- Builder Show w/Steve Dakh from Ethereum Attestation Service (EAS) w/Austin Griffith & Eda Akturk
- Lessons from 10 Years of the Ethereum Identity Stack
- How LUKSO will UP!grade the blockchain user experience
- The Grand Vision for ENS
- Universal Ethereum Logins
