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

Loading player…

ETHLondonUK: Hacking ENS, with Makoto Inoue

ETHGlobalFri, Oct 9, 2020, 12:00 AM

Transcript

good morning guys hey okay so yeah i'm makoto and i'm dev ian's domain yes and i'm assuming everybody knows what ens is for this workshop i'm also hosting like a london ethereum called up who flows based in london okay so if you wanna yeah if you hack and if you're gonna in the show off your thing and stuff just you ask me to host events i do the same regularly so come come along and then you know show the code and also i'm also known for this you know things you and you know who registered on kickback yeah so like uh i checked and currently about 74 people are checked in so like taurus who are giving a t-shirt with their own money i give money to everybody from the people who didn't turn up but only if you are checked in mark that check-in so if you go to the website and if you're not checked in you lose your stake so make sure that you know you load it to the check-in counter get checked then if this is it then we should get extra 7-9 wow yeah so yeah yeah sorry ah that's a hard setting but we'll usually have a longer period so don't worry about it yeah but this is not about kickback session uh this is about ens yeah uh so i wanted to tell you a story that back in 2000 so ens has been running since 2017 and in 2018 we had a ens workshop plus hackerson and this is one of the winners uh what they did is like uh they kind of you know like wrapped btc that kind of stuff then they wrapped ens to make it as a nifty like a nft non-tangible token and at that time i think nf erc721 standard only came like six months beforehand and that was after like ens first launched so this was kind of new things so we said oh that's really clever idea and we decided to steal their idea so that when we did the um the major upgrade about year in may last year we actually said actually ens is now yes 71 so that you can basically put in the open open c and you can trade so now it's kind of getting one of the highest traded uh asset on the open c and you can also see that we did a short name auction uh three months ago and people are basically bidding all over the place and one of the examples is like amazon.a skull in a beer for like hundred each and all the stuff so i know this is more for the speculation but like this kind of tokenizing name as an asset suddenly tie into ens is more like kind of you know variable to everybody also like it's much easier to trade and so like if you look at the whole ecosystem the uh token transfers you can see like you know probably ens is that you know next to kitties and the godzilla unchained stuff so the small the idea is like a one small hack happened in the hackathon actually changed the the you know ens and the time it kind of helped for reviving the popularity of the united states now so we really want to encourage that idea so but last year we sponsored uh this global hackathon at that time it was we are still asking people to do basic theme of like integrating ens into your app so we are giving basically price for anyone who just did the integration but that was actually two lines of code so it was a bit too easy so this time we want to encourage for you guys to push the boundary of ens you know to make es more interesting stuff so so we just kind of change the it's still the same amount of money but we just said like you know if you do something interesting we're going to put a bit a bigger portion so you know our price is like three prices uh 600 300 and for something which kind of add a new feature into ens which we could later uh bring you know put other part of the in this feature but it sounds like that sounds like it's a quite complex but uh thanks to the kind of very modular structure of ens actually extending ens is a lot easier than you you think it is so that's what i want to go through today so yeah so three things some of the ideas uh is that for example so i already mentioned like uh any names longer than three uh characters are already auctioned so everybody it's all sold but we actually have one character and the two characters so this kind of unicorn door is space is not not in use so like if you kind of come up with new way of like you know sharing this name space maybe your solution could be one of the you know unicorn doll is in the registration method or like it as a ens is basically a big uh key value dictionary so you could create some sort of like tan ens into new way of like storing data build your dictionary or one of the stuff i get often asked is uh it gets expired in the may 4th to 2020 unless you renew and the ens doesn't offer any sorts of renewal or any ways to make renewal easier so maybe any ways to make enhance make that capability easier for that kind of ideas and with that in mind i will talk about three things so ens101 i talked i casually mentioned about registered reserve about it might not mean to you guys yet so i'll just quickly go through what the whole architecture is then like i'm talking about basically building your own resolver build your own registrar with some examples good so far okay so es101 uh so that's my address but like it this is like when you say hey send me this do this and then you you either have to scan or like in a copy and paste that's too hard so actually who do you have a unit's name okay two two three four people so like ens looks like something like this so like if you go to like metamask or even isa scan like if you search matokun.i it actually turns into this address so if you find this talk useful and you want to tip something to me you know this is my name so like i you know like this is my name and i put in the business card and i also even put the back of my t-shirts and it's like you never forget okay and so now like you know uh yeah people kind of one of the memes started happening after the short name ocean they're like two oh this is her own character but people start putting like their own like favorite is eric is like as a full character it's like actually it's quite expensive hundred dollars a year or something but like you know he's he got it through auction so like he put it and so now there's over like 400 000 names actually registered including some domains and yeah there's a lot of wallets and adapts toras right yeah so and the coinbase i think recently announced somewhere yeah maybe i forgot to put anyway and then there's over 100 apps integrated and most of them how they integrate is like basically you go to the our docs ens domains which has quite extensive web uh information about how to do everything so if you you know listen to my talk and if you there's something not clear if you go to this page most likely there's an answer here and the easiest way to integrate is like a i don't know you guys use web3js or esa's js or you know favorite library is usually kind of integrated with cns so in this case it's like web3js and actually web3 e s already has it and if he wants to for example what's the same address of alistar e some other kundalini is or he does is ensk address so last year this was a way to get 200 die and we just realized that's too easy so that's why we are going to the kind of es102 so it's slightly advanced and another way is this is called for lookup another way you can actually do is for example this is our ens manager which allows you to basically manage your ens names when you log in it automatically knows who i am this is way it's called reverse lookup and that this is how it's achieved is again you do the uh this is esa yeah web3.js doesn't support that so esa.js supports the provider lookup address and if you pass the address it returns name it's again it's very easy and there's a python version java version other stuff so that was my entire talk last year you know but like this year we go one step above so now i'm going to talk about bringing your own build your own resolver but before talking about reservoir i was just going to talk about the entire architectural business which is like this so we have something called registry where uh it has a basically the key value keys of like all the names and when you look up and i'll just go through this one faster like if you go to en esta like hey fast like you say what is matako.

is it returns not the address of who they return the address of so-called resolver and resolver is another smart contract which defines how to resolve this name and you ask to the resolver what's the address of a food or is and returns the address yeah i think i make sense and so in case of registry yeah so this is actually smart the gist of the ens registry and it was it's actually about saudi lines called us but we found a bug uh three months ago so we had to regis this is a part like it it's kind of hot enos registry address is high quality on everybody's project so we had to migrate over like 200 different projects or replacing the hardcore smart contract things but usually this one should stay unless there's another bug but what it does is like when you ask for the resolver your name but it's in a buy society to type not the string the reason is like if it's string there will be you know a limited amount but if it's like hash version you can basically put as as long as uh whatever the long name you can put time to fix so hence we pass by 32 then it returns this resolver address and what it does is like a yeah once you return you also have a resolver contract where it defines whatever the rule most of the time it's just a key value store that like you know you used to set this up address for certain name but this is like very lame things like whatever i ask name i just return one specific address which is my address so you know s goes to me uh rosco.s goes to me you know if you want to write that kind of resolver you can do that if you want to and the one the yeah and in this example i mentioned a return same address but now ens is going just beyond just resolving ecm addresses so you can start with other stuff such as content hash public key api tax record multicoin which i can explain multi coins like you know you can actually put like bitcoin address litecoin mona binance whatever coin my chances you can add it uh and also this is example key uh value sorry text record like you can actually set your own key keys and the values and this is interesting why is that do ah is a one of the internet domain they actually integrated with a c and s that like if you buy the odd domain you can basically record put the record of your art history but but on the back they actually stores in a key text field of dns so like you can actually show the uh art attributes in our es manager like this one but but on the back it's just like a key value so if you want to kind of experiment with building your own dictionary first go to places using the you know key value sorry text field so that's one way another way which happened in east new york is that do you guys know onion like thor like anonymous browsing something i don't really use but for them they also said like you know they have like gibberish addresses like this kind of stuff so they actually in their case they kind of extend it actually not only ens to add new record but they also extend their metamask so that they can use if you type like these things you can like browsing on your own something like that so that became part of the feature that's another example a hackathon project turned into actual feature and another way this one is not really productionized yet but like so for example when you try to log into kickback kickback ask like you know 10 different like wallet to sign in and if you you you already know like what you are go to what it is it's quite annoying so what they presented is like a use ens if you type enos name it kind of knows which wallet you you use and how they did is that they kind of extend the resolver to put the 3 provider information into the ens so that like people don't have to choose any time this is a way of extending resolver that's the example extended resolver any questions so far yes what is the hashing function for the actual um like a ddr function that you use there like what do you do to a domain name to get the basic hash i think for the label it's just a shell three or something i think okay oh i i have a code later on yeah and but okay so there's a label hash and name hash label hash is just like a shell of the for example if it's madokan.i is label is matoken right if you hash it this is labor hash but there's also another one called name hash name hash is like i think you share each component then you share the combined stuff and the stuff yeah combine the hashtag and yeah so if you have a domain then what's the label label label hash is just so if you have like a metamask.is that whole thing is named if you hash the whole thing it's name hash so when you do for example ens.lookup address you pass the whole thing right because yeah label hash is when you that's i can mention that but that's when label is mostly needed when you register a new name which i can go through now so that's a good transition any other question about resolver in general good so resolver uh so now i'm talking about build your own registrar so one of the interesting thing is like uh who knows rjn wallet yeah so arjun yeah cool so like probably if you have a rjn wallet they they actually give you a sub domain like john argen.

xyz when you create a wallet same for the this is a new one called authorium has anyone used ethereum yeah it's kind of similar they they're both basic so called contract-based wallet and they also again like issue a new name like crystal ethereum dot is so and so registrar and also there is another example that do anyone know decentraland yeah they just open up the market that like you know they can you can create your own like a 3d voucher space you can navigate so uh and what they announced is that this entry has a new naming system that converts all names to erc721 token and as well as ens so they not only issue sub domain so so i actually played with avatar so this is me i spent like about 30 minutes just trying to figure out best part does that look like me ish yeah yeah thank you uh so if you do that it's quite fun like you pick your own eyebrow and all that stuff and i broke yeah anyway so if you create makoto then they actually create makoto.dcl.es and you can just check it so like it also creates a sub domain and also tiny into erc 721 so the registrar is the ones to create your new new sub domains and i was quite intrigued how they do did that so in this example i'll just look into how they did it and it's quite simple and yeah so registrar is a one which assign sub domain or like you know set the name and there is a so when when you purchase a ens name which ends with eth well you you are using i think fast and fast solved no it's using s register actually but there's other type like you know for example in uh i think robspan robstem there's something called.test uh domain just for the testing purpose that one is fast compass sound so that has a lot simpler rule like whoever if it's not taken you just take it that's fascinating fast up and also like arjun.xyz or do art that's actually you have to send a proof that you actually own that internet domain so we have special registrar called the dns registrar and also uh people start doing something like uh start setting sub domain so like it a popular one nowadays is called is money.

east which is started by the east hub guys like you can buy basically makoto is money dot is and they sell the sub domain and you we already have the smart contract folder called subdomain registrar again just another smart contract but all they do oh yeah and that how you set it is like this is the basically the decentralized domain name there's a notion called registrar and controller and registrar is the owner of this domain and but controller is the one who be able to basically set the resolver set address do the actual operation so the common practice is that you might want to keep this into your address but you set this into a smart contract so that like it rather than you you creating sub domain all by yourself you can say create smart contract to openmate so this controller is an important one and uh if you look so like if you actually look into this smart contract address you can actually look into their smart contract yes yes so controller can registrant can set controller controller can set them himself so this there's a button called transfer so he you can if this is set to you you can also transfer to someone else but this guy okay always count over right registrant is a stronger than one yes yes but they can still override correct and um if the controller sells the domain the controller can list the domain on opc inside the charts uh only can transfer controllers ownership you can't sell you are not just setting the resolver so i think the controller is the erc721 function i think registrants i can show you the code now and so this one is the what was it looking two a one actually in this case they they setting the same smart contract to both register and controller and actually yeah maybe you set a registrant i can't remember i'll just look into the code sorry but and this registrar okay so i think i i made the wrong statement if you want to create some like new registrar you have to say here i think confused you do try on ella in the figure out because 721 has a concept of an owner and a controller and i think i might be getting contributions into one concept of control yes really yes really so you have set approved set approved and said proof for all so views okay but that control the concept controller is different to what i described as contrast yeah yeah we have another things called controller inside ens which confuses hell out of me all the time but if you look at this dcl registrar which you can verify from this ether scan how many so five minutes left uh you can see that e in here it's e house c seven two one contract and uh the basic con and that you have to somehow pass registry so that it's aware of the ens and that gist is when you register a new name like such a makoto.dcl what it's doing is calling set subnote owner which you find in a registry contract right like you know either you can so it's just a set registry says i'm not owner and you put the domain name hash and the sub domain label hash this is where you put the label hash yeah and then after that uh because in their case no they not only create a new name but they also create tani as a erc721 so you just call them.mint of the erc721 contract that's pretty much all they do then if you look into it yeah so this is a one way of like tiny hash of the label it's just a sharp three makoto one gist which i took a while to figure out is i get e if you go to open uh easter scan if you just pass this one you can return the correct address like owner of but open c only recognize the integer version so you have to convert that into integer to to be able to find the right one so this is actually the nifty token of makoto. dcl dot is that's an interesting choice okay uh i think the idea of the open seas should i was talking to opposite guys that you guys should actually show my my avatar profile rather than just like this number because it doesn't look good but probably because they just announced like it last week so it would get better yeah but one thing people i was looking into many people's integration and quite often they set the controller uh the owner to you but they don't set resolver and address so when it's being assigned you still don't have you come you own it but it's your same address is not set so if you really want to do extra mile you actually want to set the resolver and the address so that uh here like makoto dcl doesn't have resolver so you have to enforce users to go to our manager and they say resolver and set record but if you do that on their behalf it just does all the way so that's probably ux wise a lot better so that's a little bit tip and so two minutes ago so that's pretty much it and then most of the smart contract is in github that we have a very lots of small ones so we do have ens is what the way it contains a registry information if you go to east registrar you go to this registrar uh and yeah registrar's most registrar have its own repo so if you go to sub domain registrar it has some domain registrar information and the resolver is it's all in one wrapper so if you look into these you can basically see the inside and again but like yeah docs is a good place to look into and also if you want to play with how how other people are doing you go to rpns domains and look at their control roller to see like what you know you can check the source code and stuff that's it uh any questions yes is there any api out there that will give you a list of either list of domains that owned by a particular address ah good question good question possibly you are asking this information is if we guy go to makoto is this is my address and if you go here it shows you all the address owned by me how do you do that i just clicked the syrian address this this list uh the graph yeah so this app is saying okay this address what what names does it own but it can only get the hashes of those names from the smart contract right ah good question i love it uh sorry so what we do on the back is we go to this the graph information so like if you go to the [Music] graph ens who knows sub the sub graph api okay yeah so you can actually go here i think where i think yeah so if you do the query says domains where name is makoto.is the graph actually have a dictionary which do the dictionary check with all the hash so they decode it for you so like if you do makoto where name is it actually shows the label hash label name and name and this is a name hash so you can see all of them there this is like a ghost and yes yeah how do they do it how do they add new entries ah so that's good you go to the graph.

com doc that's the their product but they basically have the structure that for each events economy emits you create writes a handler to to index so they do all the indexing for you does the event actually contain the name and text they only have hash but yet for ens they have a special function which calls our dictionary and they do the check that's a special bit they added for has us hash to name mapping they have it yeah about like medium record nick comprised and then we we get nick gave it to graph guys and it's in somewhere yeah so it's not like available otherwise uh i know where that is talk to me afterwards but like i think most of the use case you can just use this yes this is updated this gets updated for well the dictionary data is not it's just a generic information static data but this one gets done every time event is emitted so very up to date so the dictionary isn't updated it's just aesthetic information but if i register a new domain today yeah um how long does it take for that for that name and text form to end up in this database instantaneous okay cool yeah that happens good thank [Music] i think registrar is the owner of the registrar whereas controller is on our registry oh that's the difference yes registrar operative strength if you look up on the goods you get rid of straw and redistract so like if you register a domain name the registrar will be godaddy and the registrant will be makoto the owner of registrar is registrant owner registry is controller yeah and the registrant actually only exists in uh uh sec madokan.is level if you go to sub domain you actually don't have registrant in the ens manager it's just controller good thank you thank you

Automatic transcript — names and jargon may be misspelled.