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

Loading player…

Unlock 🛠 Getting Started with Unlock

ETHGlobalSun, Oct 9, 2022, 12:00 AM

Join Julien Genestoux of Unlock for a workshop titled, "Getting Started with Unlock." This workshop is part of ETHNewYork 2022, a three-day in person hackathon that will feature hackers, mentors, enthusiasts, sponsors and speakers who are all gathering in New York June 24-26, 2022 to talk about the future of money, finance, the web, ownership, the way software works and the way power is distributed. We're excited about a new frontier. ---------------------------------------------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com

Transcript

[Music] hello and welcome to the unlock demo and uh workshop to learn about a bit more about how unlock works and what unlock is so unlock is an open protocol for memberships basically it allows any creator on the web to monetize their content games application shop or communities using nfts using memberships these memberships are as i said represented as nfts non-fungible tokens on the on any theorem compatible chain including obviously the ethereum main net as well as polygon or x-die i would first start by telling you to maybe check our website unlock protocol.com on which you could find a bunch of links to get started um the next step i'm going to show you today is how to deploy a lock which is your own membership contract and then how people can eventually purchase these memberships and how you can integrate that lock into your own applications um the pre-requirement for this demonstration is to have a crypto wallet i'm using here metamask which is a chrome extension but that exists also um as a firefox extension um and unlock is also compatible with wallet connect uh meaning that you can deploy a lock from a mobile wallet on your cell phone uh without further ado let's get started so i'm gonna start maybe showing you metamask here i've got a demo account on which there's 0.01 eth i'm using the ringkobe testnet you will see that unlock has actually been deployed on multiple networks so from the website i'm going to click on app and be redirected immediately to our dashboard the first thing you see on the dashboard is obviously the network that we're connected to as you can see we support ethereum mainnet we support winkby we support xdi we support polygon as well as a dev network which i don't think is really useful in your situation here you can see also the address with which i'm connected it starts with 0 5 7 9 6 here and that's the address that i'm connected with obviously since i'm using metamask i could toggle to any other account at this point i have not deployed any contract and so the screen is mostly empty so what we're going to do first is to deploy a lock again a lock is a smart contract deploy on the chain of your choice and it really represents the terms of the membership so we're going to see that right away i'm going to start by creating a lock here the first thing that i'm going to give is a name so i'm going to unlock demo here that name is stored on chain you can actually customize it later on when you do get the log on your website but it's still useful to use um a very descriptive name because that's how the nfts for your users are going to be um i mean that's how the name that is going to be used by the nfts that your users are going to purchase from the lock we'll see that later when the lock itself is deployed it can mint keys keys are the nfts um and each key each membership in practice has a duration uh here i'm going to pick a much shorter one than 30 days i can pick one day but you could pick basically any duration between one day and even less if you were to deploy this using the command line uh all the way to thousands of years if you wanted to i just mentioned the command line uh here obviously this interface is a front-end but you don't need to use that front-end you could definitely use the smart contracts directly and for this i would i would point you to our docs or even a command line tool to deploy your own locks uh and customize them in a way that doesn't require you to use our front end to deploy the locks um at this point uh there is a set of i mean a quantity that you can set for the number of memberships here i'm going to pick um let's do something pretty small 10. uh so it's almost like i'm going to rename this the unlocked demo og because it's so limited in terms of number of members that there's going to be scarcity around this i could have picked unlimited meaning that any number of people could have purchased a membership from from from me here you see that i'm using eth as the base currency we can actually use any erc20 and again here i would point you to our docs on how to do this on winkybee we show one extra esc 20 called wii uh but i'm going to use here because it's easier and that's the one that i have in my wallet again you can use any rc20 on any chain whether it's mainnet polygon xda rinkeby you can use any rc20 contract that has been deployed on these and so that includes for example obviously social tokens [Music] and others governance tokens for example anything like this once we've set our these kind of four base values we're going to hit submit here and here we're going to send our very first transaction on chain metamask is popping up here you can see that and since i'm using a full screen version of that it's it's looking uh oops let me go back to my web browser here uh oh i'm gonna just confirm that transaction uh and i'm actually confused as to why this shows uh but let's go back to chrome uh here uh it's because of the full screen thing and you see immediately here after i've deployed the lock that um this this now lock appears on the page you can see its address it starts with a 1ea 72 the duration is one day the quantity is 0 out of 10 so for now we have sold we have not sold any of the memberships any of the keys the price is 0.01 eth we can still change that to something else if we wanted to we can actually also change the currency if we wanted to but this time using the command line we can uh and we can see the balance here uh let's go back to the integration pane because that's the that's the the next most interesting one um as we're on this screen i also want to show you um that obviously the lock is deployed on chain so we can actually look at the uh the block explorer here and see that the contract is verified i'm definitely going to recommend that you look at this for your locks and you can actually read the contract and so you can see a bunch of properties that are set by default as well as set a few i mean update them if you wanted to so for example you can set uh the beneficiary that's the address that's going to receive the funds here by default it's my address because i deployed the the membership but this is def uh the lock but this is definitely uh changeable so you can change that to be any other any other address obviously you can set for example a trial length uh free trial length in terms of number of seconds you can say hey for the first day of the membership if people cancel they get a full refund talking about cancellation you can actually set also a penalty saying that whenever somebody wants to cancel their membership which in practice is burning their nft they should lose some of their funds and not get a full refund you can actually make it so that there is no possible refund at all so in that scenario you burn everything else you can see the name that we just used so obviously the unlock demo og i would definitely recommend looking at these there's a quite a lot of functions here they're all pretty interesting uh and you should definitely look at these um um before you get started once you read once you've read sorry some of the properties you can actually write more here you can add for example a key granter that's a special rule on the on the contract and again it will point you to the docs uh and that role is basically an address that is able to airdrop memberships for free to any of your members um you can add a lock manager the initial lock manager is the person who deploys the lock but you can have multiple lock managers and each of the lock managers can actually renounce their uh their lock manager role as you can see here you can disable the lock so once you see that your lock is uh is not useful anymore you don't want people to be able to purchase or anything like this you should disable it uh by by using that function here um you can i mean do a bunch of things we'll look at a few of these functions a bit later in that demo so let's go back to uh to our dashboard so the first thing you see here is actually pretty interesting is that we pre-built a purchase url purchase address and that address is basically a place where um that where your members can actually uh purchase their own membership so once you've deployed the contract obviously nobody has purchased a membership um and by clicking on that link and by sharing that link with your with your fans or with through your inside of your application with whoever needs to purchase the membership uh you can easily get them to purchase these memberships and these nfts um that whole window is actually very much customizable from the icon to the text to the even the number of memberships so let's assume you have deployed maybe two or three different locks uh you might want to show them on the same page uh this is obviously possible here uh you can see here that on this page we show obviously the price 0.

01 eth we do convert with an i mean as accurate as possible price which is about 22 right now in 77 cents we see that there's obviously 10 memberships left and that each membership is valid for one day i'm going to click proceed here the option here by default is to connect my crypto wallet and i'm just going to do that obviously i'm using a browser wallet called metamask here so i'm going to select that again could have used wallet connect here i'm going to select this and now i'm going to basically offered to purchase the membership using my crypto that i'm going to click on that and you'll see that metamask is popping up saying hey do you want to purchase that membership and this is about 0.1 eth plus a little bit of gas and i'm going to just confirm this and um hopefully um quickly the transaction will get mined and i can now uh go enjoy the membership and and use it to access content on my site on a site or a protected discord channel or you know features inside of an application or inside of a game etc etc etc there's really kind of an endless world of possibilities here one of the ideas that we're pretty excited about is using unlock as basically api keys where a sas service could say hey each of my tiers basically are different memberships and people need to unlock a membership to access extra features or extra levels of support or any of these things cool so i think that that's probably uh clarify things a little bit uh let's actually go to um see the transactions actually happened here when i purchased the membership so using uh metamask here i'm gonna go back to that transaction and we're going to see here so that's the transaction that happened obviously it was sent from my address to the lock about 30 seconds ago now and was mined as part of a block you can see here what's interesting is like a token was transferred so and in that scenario this token was actually minted because it's a brand new one it's token number one on that on that lock and that is an nft that was minted from address zero zero which is creation and assigned to me uh what's interesting here is we can look at the the function that was called actually the purchase function which we've seen a bit earlier in the um in the api description uh and has a bunch of parameters that you can customize very much uh inside of your uh code and applications um maybe some of the interesting ones are recipients um so the first one is obviously the value so it's the amount of money that you want to pay um we specify this because there's actually a way to tip a way to pay a bit more than what the actual price of the membership is we did not use that in the demo but um we only paid 0.01 eth but again we could have submitted 0.0 to eth and actually have uh send a little tip uh to the creator here to the owner of the lock the recipient that i was mentioning is actually an interesting one in most cases people will purchase the membership for themselves and that's actually what happened here i've purchased with this is my address here i purchased a membership for myself but there is definitely a situation where you might want to have somebody purchase on behalf of somebody else or on bf on behalf of another address so you can think of an example of this actually a pretty common one where say you have a kind of a company or a set of different people that are willing to purchase something for an organization or an organization willing to purchase something for a specific member of that organization so for example the you know the accounting uh or the purchase service of a company might purchase a membership for the software developer that's going to use an application here so that's definitely possible to do here cool um so as i said erc721 so it's an nft it is actually available on you know all of the marketplaces that you can think of from openc to variable and others uh as any other erc728 contract uh let's go back to the dashboard uh actually you know this one here here this one uh go back to the dashboard um we have obviously some um how can i say this integrations uh a bit more complete integration so for example we have a wordpress plugin to add work uh a lock to a wordpress post where you say hey the content of that story is only available for the people that have the nft in their wallet we have for example a discord bot we have an integration with cloudflare which basically hides a website completely unless the visitor has a membership an integration with webflow to make it easy for you know people who deploy kind of websites using workflows using workflow to kind of show or hide content based on the status of the membership integration with discourse which is as you know a forum software that people can can put on their websites uh to organize discussions and the good the good thing about this one is that you can actually create uh you know private uh threads are not so much private but like uh members only threads uh and that's actually pretty useful in the context for example of governance where you want to have discussion between only some of the token holders this is definitely possible we also have a set of tutorials on how to build a bunch of custom things like an ad blocker a ticket experience because a ticket to a conference for example i'm just back from a conference a ticket to a conference is a is a membership for that conference uh for a few hours um and so that's definitely a few days that's definitely an option on how you can use unlock you can get donations on your github page uh let's actually go check that out on the unlock github we did actually integrate that obviously and you can easily see that happen uh here where basically people are able to unlock a github uh sorry an unlock membership either on ethereum or xdi i remember what i told you earlier about the fact that we can actually show uh two different locks you can actually show two locks on two different networks on a on a specific page here um let's go back to the dashboard oh it's still the wrong one i'm gonna close that one because that's not it's over now um going back here uh we also have obviously a very uh much in uh in-depth documentation you can that you should check it out uh to allow you to kind of integrate your lock uh into kind of any web application or any app actually as a matter of fact even native applications uh and further so i would definitely recommend that you check out this documentation um there is a lot of different context um and content in here to look at let's go back actually to uh maybe the the top bar uh there's a very important one which is the credit card um with unlock people can actually purchase memberships nfts with their credit card people who don't have a crypto we've never heard about crypto or who don't really care about crypto can easily purchase a membership with a credit card in that situation there's actually a two-step flow first is linking your lock to your stripe account and so that's the first step here connect stripe and the second one is actually to grant to unlock inc to us uh the power of giving away memberships for free the idea here obviously is that if somebody has paid with their credit card they should receive the nft and we will actually make sure that that's what happens uh you have a very high level demo so pretty similar to the one that i showed earlier of like what unlock can look on on on a web app like a paywall here so i'm just kinda care and you're gonna see it's a pretty very similar ui to what we've seen earlier what's interesting here is i'm going to use basically the the way to kind of show uh oh sorry connect with my wallet uh and so i'm going to use my in browser wallet and you see immediately the content has been unlocked because i already have a membership and so i can just go read the content here without worrying too much and purchasing a new membership so let's go let's go back here another interesting page is the members page where you can see all of the uh the members that you have on your lock uh here there might be actually metadata associated with membership and so that's what we're trying to show here by requiring the lock owner or the lock manager as i said earlier to kind of sign a little message uh and see that obviously there's just one membership at this point that i created a couple of minutes ago uh stucco number one uh the holder is me at this point and it expires in about a day because obviously that membership is is as long as valid for a day uh so that's a pretty powerful one uh and oh i'm refreshing the dashboard here uh dashboard block explorer so one of the interesting things as well is obviously i did purchase the membership for 0.01 eth which means that now the log actually has a balance of 0.

01 eth because obviously i did purchase that membership what i can do now is actually withdraw the fund so i'm going to click on that button and you see that it's a transaction and it's basically going to uh take the heath that's on that lock and send it to me we rightfully update the the balance on the log after this and if we could check my uh my my balance on of eth it's gonna as soon as this transaction gets mined uh it's gonna go up by uh zero point zero and oop you see it happened already uh and i'm now richer by a little bit of eth here cool obviously uh you can deploy as many locks as you want so i'm not gonna do a second one here but this is definitely an option as i said earlier you can actually switch networks um and use multiple networks so that's really the kind of the the unlock 101 um maybe a couple other things that are interesting um the key chain this is the place where you can see as a member all of your memberships so here i only have one obviously because i just purchased one my first one and it's one that i just purchased and we've seen about about nine minutes ago now um for that og lock as i said earlier these are nfts so they're tradable on openc etc etc which is pretty pretty powerful maybe as a last step i want to show you again the docs so i would definitely uh actually oop we actually don't have the link to the docs here which is interesting i thought we did uh well uh going back here documentation um multiple uh sections here the first section is for creators so basically people that are not in street technical that we want to deploy their own lock and put it on their website uh we have a little indication on how to do that using any erc20 as i mentioned earlier so i would recommend that you can check this uh it's an example on how to deploy with batch for example some documentation on how to enable credit card on a lock which is extremely powerful and as i said we're using stripe here oh actually a pretty cool demo that i can actually show here this little icon is obviously the nft image that's going to show up in people's wallets but it's completely customizable so i'm going to upload a file here and use a different one i don't know what uh what should i use oh a hackathon that we recently did which is the hackathon brother 3000 so i'm going to just use that icon save it and you'll see now that basically uh this is the the image on the uh on the on the on the nfc and if i go check my keychain hopefully oh it didn't work interesting maybe it's cached somewhere it is probably cached so let's assume this has been cached uh yeah because the icon is right here so um so yeah basically customizing the images is pretty powerful as i was showing you in the docs we have a bunch of tutorials for creators on how to integrate into uh several applications wordpress as i mentioned earlier as well as tutorial on creating uh you know interesting things one of the cool ones that was just created by some of our team members is how to organize a vote by members so uh in the defy in the in the crypto world uh there's obviously a pretty big um trend around thinking about governance like how do people kind of express their opinions and uh maybe vote on certain things um you can definitely use uh unlock memberships as a you know one membership one vote mechanism uh and this is a tutorial on how to do this using the snapshot tool which is pretty pretty interesting we also have documentation for developers which i would definitely recommend you uh to look at maybe uh starts with a kind of a high level introduction to how unlock works obviously there's a set of smart contract there is unlock js which is a javascript library that provides kind of a wrapper around the rpc call so make it a bit easier as well as front-end application so the dashboard the paywall tickets and a few other ones we do have accounts which are ways for people who don't have a cryptolight to easily unlock content with their query cards we have documentation about a smart contract obviously high level we have two big contracts one is called the unlock contract which is the factory and the other one is called the lock contract it's it's the membership contract that we deployed here um i'm not going to go too far into details because it gets pretty deep pretty quickly but again you should look at this there's a lot of interesting things unlock.js as i said earlier it's kind of a wrapper around around the abi the abi and the rpc goals to make it a bit easier for people to deploy log purchase membership change prices uh withdraw funds etc we also have a sub-graph or actually multiple subgraphs deploy on the network that were deployed on what's interesting about these subgraphs is that they allow you to query for rich data coming from the protocol which is pretty powerful we have ways to customize the metadata on the lock so there's really multiple levels of customization that you can do including collecting user information like email addresses or things like this but also obviously changing things like the image as we've seen a couple of minutes earlier and so there's there's a bit of an explanation here on how to do these things the paywall application is the one that you can use to embed the lock on the site and we have also kind of a server-side component called locksmith which you should uh which which for which you should look at the docs if you're interested that allows you to do adding query card for users and things like this cool maybe the last uh the last step before before we wrap this up um you should know that unlock has its own governance token uh it's called udt it's the unlocked token this section basically has all of the explanation about it it is definitely extremely powerful [Music] the idea is that udt tokens are minted whenever somebody uses the protocol with the idea with the expectation that um any user of the protocol can become a stakeholder and can become a you know a full participant into the unlock ecosystem you're not just a user you become again a stakeholder here we also have a grants program especially for the early days and for people building and hackathons we're interested in in exploring interesting ideas or building kind of innovative use cases and and we have a review process and that we invite you to look at so that you can earn tokens from us and then join the the protocols governments after this uh maybe a couple things i would definitely recommend that you check our discord uh so um we're on discord like a lot of crypto projects uh and we have a lot of um interesting sections here that i would recommend you to look at uh you'll start in the lobby which is basically the area where everybody shows up but then from the lobby you can actually unlock some of the other channels and so i definitely recommend that you that you do that and that's pretty much it so as a wrap-up go check out the website unlock protocol.com that's where we start uh join our discord um feel free to ask any question that you have we're definitely excited to hear about you to hear what you're building and we'll definitely help you as much as we can build amazing things awesome chat soon bye

Automatic transcript — names and jargon may be misspelled.