Lens 🛠Building on Lens Protocol
ETHGlobal·Sun, Oct 9, 2022, 12:00 AM
Join David Silverman of Lens Protocol for a workshop titled "Building on Lens Protocol." Building a social network is hard. Lens Protocol makes it easy! Learn how to build on the next generation of social infrastructure. This workshop is part of ETHAmsterdam, the first in-person hackathon for ETHGlobal since ETHLondon in 2019. Join over 800 likeminded engineers, designers, and creators to build and learn over one full weekend at the Beurs Van Berlage in Amsterdam. ETHAmsterdam is taking place as part of Devconnect, the week-long in-person gathering in Amsterdam. We're back to build, we hope you'll join us. ---------------------------------------------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com
Transcript
[Music] [Applause] all right uh gm everyone uh my name is david uh i'm a product manager at avec companies uh doing social products including lens protocol uh and i'm here to chat with you all today to give a quick overview overview of the lens protocol uh why we built it uh what are some of the design decisions we we went with uh we can touch a bit about the lens api uh drop a little bit of alpha as to some things you can build uh with lens especially here at the hackathon today at amsterdam uh so let's get into it um web 2 social media is broken uh from a fundamental perspective there are three kind of key issues uh first off networks sell your data um every free service you're used to facebook instagram snapchat um but even even other services things like uh opentable or eventbrite they're taking your data and they're selling it and that's okay that's a trade-off i think many are willing to make but we don't really have an option to matter second off user data is not portable these these networks own your data um it is in their custody they're using it to monetize and because of that they have no desire to share it with other platforms when i post a video to tick tock it doesn't automatically show up in youtube shorts or instagram reels i have to go and do that myself and it makes the switching cost very significant um if i as a creator want to leave a platform and go somewhere else um like many creators had to do when musically shut down and became tick-tock or vine shut down and many tried to go to instagram or other sites or youtube it's really hard to bring an audience you lose that connection and if you're a d platform do you lose your connection to your audience again and into your income stream and that's not a great way to to to be and then lastly these data centralized and we already know what can happen in that situation there are hacks um i already get a ton of spam uh between the spam bops on twitter lately and and ledger and trez are getting hacked i don't need more more email spam and people trying to steal from me so how do we fix that we can fix it with web3 social and i would say that the idea of web3 social is to bring power back to users and creators creators by making data self sovereign again so let's see social media through a new lens lens protocol allows developers like you to build social apps and tools on a singular composable and decentralized social graph this allows you to focus on user experience and better algorithms instead of user acquisition and for users and creators lens protocol allows you to own the links with your community it allows you to monetize in ways that you see fit and it forms a fully composable and decentralized social graph so we got that thesis out of the way let's let's dig a little bit into what exactly lenses our social protocol revolves around an nft infrastructure layer now these nfts aren't aren't board apes they're not punks they're not going to have a cute little image um these are you know they're a little bit more more uh more powerful the first nft we build around is the profile nft it's minted upon creation it contains an array called publications which is updated with all of your posts all of your comments all of your mirrors which is our term for a share um and additionally if you've if you've worked with uh ens or unstoppable it may look very similar um the the next thing it also has uh is following um there's some follow logic that when succeeds will mint a follow nft so if i david go to follow alan and i passes follow logic i will receive an allen follow nft its id is going to have the token id is based on the order of following if i'm alan's fifth follower i will have token id4 because we are developers and we start all counting at zero um the follow nft contains some built-in governance so if i'm a creator like one of our devs on the team josh josh does really great solidity tutorials he can pull his audience to see if he should be doing more videos about maybe ave v3 or if instead he should be doing uh things on solidly or other experiments in the ecosystem and this governance is compatible with snapshot uh open zeppelin governor uh and the ave governance as well um in fact the community lens community has already created several strategies um so yeah lastly post comments and mirrors again our term for shares these are these live inside of a profile nft so they are always permanently linked with the original creator that said we have the ability to mint derivatives which we call collect nfts so if i have a really awesome photo uh of me speaking here at amsterdam and i choose to post it on lens on my lens profile i can set some collect logic i can say that you know this photo can be collected five times at one matic each um and should that price be paid a collect nft will be minted with a identical content uri so you would receive an nft of that exact publication additionally there can be included uh mirror fees so again mir is our term for share if alan were to mirror my publication and uh bradley a friend of ours in the audience would collect it off that mirror allen could receive a piece of the fees and so lens also has tools to incentivize good curation as well now that's kind of the base how can you extend lens if you're a web 3 developer the first thing you should really start to look at with lens is these things called modules modules are ways to run arbitrary logic that return some boolean value that will result in either the mint or rejection of some action there are three types a follow module a reference module or a collect module so let's start with the follow module the follow module is set on a per profile basis so i'm at david i'm able to set some follow logic that will be checked before someone is allowed to follow me it can be as simple as anyone can follow me an unlimited number of times i think we call that the the empty follow module um i could do something i can monetize my follow you have to pay me one each in order to follow me it's a bit steep but i promise i have really good content um you know we can do really complex actions uh there was a a team that created uh what they called the the the the carbon neutral follow so it would be five matic to follow uh it will automatically zero x swap that into a certain amount of carbon credits and retire on chain making the entire action carbon neutral arbitrary logic means arbitrary logic and i'll let you interpret that as you wish especially as you guys think of things to build so again that's the follow logic minting follow nfts the fall logic controls yes or no the reference module uh comments and mirrors have to refer to some other piece of publication if you've ever used twitter and you can say you can only reply or retweet this if you are a follower of mine or only people tagged can reply or retweet this is a very similar logic except unlike those fixed categories again reference logic can be arbitrary you can only comment on my post if you hold a board ape nft you can only mirror my content if you have 32 fwb or more in your wallet you can only comment or mirror on my posts if you follow the at lens protocol account which you definitely should do right now and lastly the collect module the collect module controls the minting of collect nfts this is the monetization logic that i mentioned earlier things can be really simple as i said anyone collect can collect an unlimited number of times you could do it that there's a limited number of collects we call the limit collect module you can only collect this 10 times once per address or we could do you can only collect 10 times in a 24-hour period again these are just examples that we've included in the repo and on the test net but you are more than welcome to create your own and again arbitrary logic your mind is the limit there's a team today that did an ave collect module i'm paid tenmatic for one of my pieces of content it is automatically deposited into ave and the resulting eight tokens are sent to my wallet imagine nfts with composable defy so let's go back to kind of our goal we want to foster a broad diverse and evolving social ecosystem again all of our content all of our profile data everything is fully composable and transferable on chain it can bring in your existing defy and nft applications and anything else that may be built in the future follow nfts have built-in governance mechanisms including snapshot and delegation by default we can create these new concepts of social dials these aren't social data centered around some erc20 token or an nft we can evolve a bit beyond that and actually do social dowse and governance and organization based around based around actual on-chain verifiable action do you follow with me do you engage in my content then you can be rewarded with voting power have modules that can be built to do arbitrary logic as well as to include a governance managed treasury fee back to composability users can take their graph to whatever experience you want don't like the algorithm over on twitter bring your content over to another clone your content your followers your following and as a creator your audience move with you to wherever you want and modularity again developers you can focus on the front end the network effects are up to the protocol your job is to make the best possible experience the best way to express your creativity in order to create a great social experience in times we've seen apps that were great and novel lose out to network effects you know we had a group called meerkat decided to do live streaming and then periscope came along and they eventually lost their ip over to twitch because they had the greatest network effects i think we all remember clubhouse and how it was soundly defeated by twitter spaces right new ideas and paradigms have lost out frequently due to network effects and lenses a chance to change that another thing we've done at ave companies we've produced a lens api um we've openly said that we're you know web through social media is a long game we are creating our own model implementation we've decided to open source the same tools that we are using to build our own front end it is an api that allows anyone to use lens as if it is a standard web 2 api with graphql all you have to do is focus on building an experience to onboard the next billion into web3 you don't have to worry about indexing or querying data we're going to be on polygons so you don't need to worry about reworks or the speed of fetching the data you don't have to worry about pre-filling contract data or validating it especially when using with sig functions or metadata just pass arguments let the lens api take care of all the formatting again you get a web to style interface to interact with the protocol especially if you are new to the world of web 3 this is a really approachable place to start leave the modules and complex logic facility developers if you want to build with lens here's a great easy entry point to start playing around and if you're an application on a different chain or an application that's off chain and you want to use and write and read lens data feel free to use the api it's a great way to get started and do something low effort as you dip your toes into web3 social and again there's no huge learning curve focus on the stuff you want to build you know our api is in beta our developers are in the discord around the clock fixing in features and adding new ones when people need new endpoints it's a really great place to get started sharing a little bit of alpha some ideas to kind of get you started um front ends you know lens is just a social graph and a social graph isn't useful unless it has a front end for people to interact with it um the facebook social graph isn't useful unless you're using instagram whatsapp or facebook well lens we have a community run implementation called lenster there are tons of others over 50 front ends were done through previous global hackathons you can be the next big one and it's a chance to really lay your claim as one of the first web 3 social applications and it doesn't have to be limited to traditional social you know it's very easy to build something that we think of with social like snapchat or instagram or a twitter clone but i encourage people to dig a deep dig a bit deeper things like opentable or eventbrite can all use the same kind of data structure if you're an advanced developer out there and want to start exploring multi-chain lens is a really great way to do with that as i said modules use arbitrary logic there's nothing saying that the arbitrary logic can't be i have received a valid message from some contract running on another chain imagine selling polygon nfts but receiving payments over on avalanche or receiving payments over on solana if you want to experiment with messaging protocols such as layer 0 chain link ccip or any call from the any swap team or many of the other cross chain oracle solutions it's a cool way to experiment with multi-chain in a non-defy context and lastly social dowse i genuinely think the next kind of innovation to come off of lens is the evolution of social taos we've seen people start with erc20s social tokens we've seen a changeover to the concept of maybe using nfts to organize people socially whether that be experiments like links dow um but now we have the opportunity to do social dials that are coordinated around actual social action verifiable on chain we could even have a shared profile put on chain additionally a chance for dow tooling to be made social it'd be really cool that right now twitter accounts for dows are controlled by individual users it can get really nasty if there's a governance fight imagine if we took a profile and locked in the contract such that let's say for example at ave was controlled by the avery governance but ave governance could delegate so that a few different people on the marketing team or a marketing sub-dial had the ability to post on behalf token holders still retain absolute control there's tons of new tooling and primitives that can be built out when dows and other contracts are given first class status that's all i have for today um i encourage you to join the over 115 developers and 55 projects building on top of lens we're currently on the polygon test net um we're on our fourth test net and we really do take developer feedback we've rewritten the contracts pretty much from the ground up several times based on feedback from working with developers like yourself and we really want to make sure that what we build becomes the standard form through social in the future and we always do that when we're building with a community so thanks taking the time to listen today and was always going to drop a little bit of alpha uh you know please scan the code to come join us over at rave um we'd love to see you guys throughout the uh throughout the weekend over at the lens and ave station down on the first floor in the back over by wallet connect and gearbox our team will be there all weekend and look forward to working with you guys thanks very much [Applause] yeah i can take testing there we go question yeah so in the hackathon we have a testnet deployment if you go to docs.lens.dev you can get all of the contract addresses and there's some data there already so i would recommend using that there's an api as well our bait api is hooked up to that social graph as well on the testnet deployment again it's on polygon mumbai the only quirk is if you want to build a custom module so a collect reference or follow um you're going to have to redeploy the uh the protocol yourself and you won't be able to build with the api so we kind of suggested those two tracks for this hackathon either going kind of the the intense smart contract route with uh new modules or kind of building a bit more higher level functionality with the api just due to the limited time any other questions yeah possible to get the slides um yeah i think this is being recorded at eathglobal.tv and uh there is if you if you go on youtube and look up lens protocol on the global channel i think we've done similar presentations before um if you find me at the lens booth uh or the lens ave booth i'm more than happy to share the slides and share any other information thank you yeah over there yeah thanks so much so um it does let's provide any like identification uh yeah thanks a lot and like can you create 10 000 lens accounts or does it provide any yeah so yeah so for the test net deployment and you can anyone can create a lens profile there's no restriction um if you look at the actual protocol docs um profile creators must be whitelisted so it's designed to be contracts that implement higher level logic so for example there could be a theoretical contract that said i'm the owner of davidev.eth i can get the davidev dot handle or you could implement logic that says i want at mark i have to pay a certain amount to maintain at mark per year we are leaving that up for a future decision and discussion with the community for now we are just saying anyone can mint again i think that the job of verification and the marking of spam versus not spam is an opinionated decision lens is decidedly a non-opinionated profile and such decision should probably be implemented by front-end applications or other tools okay question up in the front if you can get the mic i can also just repeat your question over the system up in the front so i'd like to ask how scalable is lens really so for example if i have a twitter account with 3 million followers and i want to represent that in lens does that work um if we had 3 million users on lens acting every day i think that would be a massive success and i think you did touch on something true which is you know i don't think scalability exists really and this is a personal opinion fully exists anywhere in the ecosystem right now i think if we were dealing with a social app requiring 15 million concurrent users a day the combined amount of every single l1 and scaling solution probably would not be enough and i think that speaks to a broader demand of a need in the development of scaling solutions which we're fortunately starting to see the fruits of previous research bear you know i think that we are as i said said one of the slides we're building for the long haul we think we're setting the foundation um social graphs take time to grow i would love that explosive growth we're very happy to be on polygon right now we think it's the the best place to start off with but i don't think that you know the contracts are open and a future deployment on a roll-up or other larger capacity scaling solution uh may also work do you by chance know where we can scale now to to what limits um in a rough area we don't have rough estimates i think we're still doing research on such you know polygon has certain bandwidths they're constantly changing their protocol and their limits um it's also consistent with other applications are being run if people start using these apps in a more multi-chain context like we said with bridges and compute being offloaded elsewhere that can also reduce gas usage on polygon proper um so i don't want to make any estimates without letting the devs do things and come up with formal research um so uh you know i i think you know i think that we feel as a team that there is plenty of capacity on polygon for now you know we did a lot of search and that was the the decision we chose due to the tooling available there and the uh um as well as the capacity um and uh that's where we're happy to launch with thank you um yeah so i have two questions and we can also take it offline but um first question is um let's say somebody doesn't want to show us like social interactions are you planning on to do like a tornado cache for social media then as a module or what's your hinge there like sounds like you came up with a really great hackathon project i think you totally could do a tornado cache like solution where a profile was held in a smart contract there were some offline keys and you could technically post with any address hiding the activity i'm also super excited by looking at what teams have built with protocols to do encryption like lit on ceramic or unlock protocol to allow for privacy posting but still getting all the benefits of web3 social again part of our design philosophy with lens was to be as opinionated as possible if we made everything private then people couldn't post publicly so it's public by default um but you know we don't enforce any type of encryption we don't enforce any type of storage that is up for use the developer to pick and uh we hope you enjoy that flexibility cool second question uh it's a bit about i mean you know with social media there was this like genocide scandal by facebook yeah and i think it's a bit intense to criticize let's say web 2 social media if you have this uncontrollable force of let's say um either like um copyright violations or um like let's say hate speech or this kind of issues yep um so any opinions on that yeah i think the example i would give is to look at something like uh email right um if you know we don't question whether or not protocols like smtp or pop3 should ever have native filtering built into it or or back doors to allow the censorship of content those are open internet specifications and protocols that we've come to accept it is applications building on top of them being gmail or yahoo or outlook that would have to enforce and engage with any form of censorship or moderation or a law and i would say that i believe lens is doing a similar service where lens is being this kind of very neutral very unopinionated base layer and is up to front-end applications that do implementations to comply with such and i think that if we separate a social media application like facebook today from facebook the database versus facebook the service provider i think we would find most of those rules and things that we have issues with is facebook as a service provider not as just a database and so i think that you know even the term moderation um i mentioned that instagram whatsapp and facebook they're all technically pulling from that same database that itself is a moderated decision instagram is choosing to show you a photo experience they're making other decisions along the way but they've made a very base one and i think something that lens allows is for a diversity of different opinions and i think a market showing in society as a whole really kind of forcing ethics upon these platforms um interesting i mean also the the problem with what if i want to delete a post i mean that's an unsolvable problem or i disagree i think you can use you know higher level encryption solutions lens doesn't care where the where the content is stored it's just really a pointer so you can use an s3 link is where your content is and then delete it using normal web 2 means you could be hosting your content on ipfs arrowweav or ceramic and even then you can use encryption schemes like unlock protocol or lit protocol or others that may become announced in the future um you know if we wanted to build in privacy from the start then we would be locked into a certain design decision and public would not really be an option so we chose public and flexibility we want to put power in developers hands not make decisions for them and lastly back to the email example i think it's a very good example saying that email is just a protocol but i mean there's laws regarding sending emails so you cannot like in some countries do like cold emailing and therefore there's like an incentive to at least limit some of the spam right i mean yeah no i i would happy to talk more offline yeah i would again point that those laws are affected on service providers that again those are the responsibility of gmail or yahoo or outlook versus it's not it's not the job of smtp or pop3 itself yeah absolutely yeah i mean these are smart contracts the contracts don't know who's using them and don't know what the content is um and i'd say i think the better analogous is to think about these kind of core internet functionality unless so the actual business is built on top thank you so much for your answers yep yeah in the back actually on that point um being that smtp is a free and open source protocol is there any commercial motive behind lens at all i i would say we're smart contract developers um you know we wrote the ave protocol at ave companies and then the ave dao deployed it you know we are writing the lens protocol and right now it's a community project um you know i think that we really believe that the best thing we can do is to can you push the web3 movement forward is to build more applications and more use cases for people to come online the other day we believe in this technology where coders first and that's really our motive behind building it we like to build interesting projects monetization is a nice after effect cool i love it any others all right i think we are also done if there's anything else last call as i said we're going to be uh at the ave booth the lens booth uh all weekend also quick shout out to the developers who have done some contributions so far i know there's a few in the audience as well as the ave team in the audience um really a ton of folks have worked on this and we're super excited to have you all build on it thanks [Applause] [Music] [Applause]
Automatic transcript — names and jargon may be misspelled.