Social in Web3.0
ETHCC 5 · July 2022 · 23:34
Evgeny Kuzyakov demonstrates adding profiles, a social graph and notifications to decentralized applications, using near.social as an example.
Speakers
Topics
From ETHCC 5, hosted by Ethereum France.
Transcript
hello hi uh my name is evgeny kuzikov i'm currently at proximity which is uh defionier and today i'm going to talk about social in web 3. so first before we start we need to answer a simple question so what's the difference between a blockchain and web three and uh basically it's written in rust it's likely a blockchain if it's in power power point it's a web stream so my background i worked at google plus at google and spent some time at facebook then i eventually joined near and currently in proximity and
social is kind of my side project which i have passion about so why near so it has named account so you don't need ems it has multiple keys per account so you can actually not be restricted but by a single key it has an account can be a actual contract so you can have a vault on your account and can be like multisig whatever the contract uses json so you don't need an api and storage and near protocol is managed by the amount of money so it's somewhat similar to solana accounts except for
you can dynamically allocate more storage if you have more near on the account it is scalable because it's sharded and it has a free public rpc so i don't need to like start with inferior and i also contributed to protocols that biased my decision so i'm going to talk about four experiments today there's actually one more and first one we call it near fm it's live and it was on testnet it basically decentralized twitter so how it works it has no back end it's only like a front-end app and it uses a public archival node
that has access to the like previous blocks it relies on approval state because if you have a light client you can prove that anything happened on chain you can fetch it it has no operational cost and the way it works the front end is like ipfs the user covers the cost of the storage and reads a comment from the public rpc note it's censorship resistance so long as the underlying network is censorship resistant and it's also open source so i call it a post chain basically it's a chain of posts the way it works is only the last post is stored on chain in the contract
and previous posts by the same user are linked by the block hash or like block height so this way you can recover entire history of what user posted while keeping the storage minimum on the latest state you can also create a permanent link to the previous post by going to say okay this user at this block height and the only issue that the user cannot post more than once per block but blocks like one second so it's not a big deal front end uses recursive fetching by like going back hey what was the positive height what was the previous
height and so on and you cannot delete it because some blockchain which is maybe an issue the contract also has a social graph where user can create bi-directional edges so they can basically notify someone that they got followed and they cover storage for this reverse edge so you can see who followed you but you don't have to like pay for that so the graph is public and reusable which means like any application that uses account id can actually grab this graph from the contract and use it on their front-end so for example let's display friends that you follow nfts that from
friends that you follow so feed feed is actually a combination of the graph and the posts so a contractor turns only a last post for every edge that you follow and then you can recursively recover the rest on the front end and then you just need to sort them on the based on time or like block height so why it didn't work out well likes actually require n by m storage and lens protocol is example why it's also not unchained ui is hard and all the improvements actually need to be done and added to the contract i think lens is also having similar issues
where if you want to add some new feature you actually need to put it in a contract and then upgrade everyone to this contract and just a mess so i stopped working on it and the app stopped evolving and that's a problem is the centralization of development and when test net was forked on here for some like random reason block heights were reset and we lost the history of the posts so it has some risks so the next one is the wiki it basically wikipedia hosted fully unchained and it also uses web4 i'll talk about this so it's an article of chains so when you
post an article the previous edits getting deleted but they are linked by the post a similar idea and or linked by the height of the previous block and you can back go back in time on the front end to recover entire edit history it uses shard storage which is kind of cool so users don't have to worry about their storage like only the article or refund when they like someone edited their article so that's good and how we actually pay for this through donations like a traditional wiki style it's also very easy to use so here's the article i did on ecc
basically copied some code put some mark down created a new url it's now live um the articles within the wikipedia automatically linked so if you create a new article and create a link you will be able to navigate from our article to another so you can actually create the real wikipedia on this markdown is very simple and like less bytes to store it on chain and you only need one transaction to create an article and it will be live so what is web4 and something average between web3 and what jack dorsey does with web5 it actually the main innovation here is
when you deploy a contract you can also put some link how the contract should be rendering for example link to ipfs and if you have a hosting that understand that format that can pull this data render it for you and get it done so the wiki.near is the account we used for the deploying the contract the wikipedia contract on year and it automatically served from the wiki.near.page in the future you can imagine that like brave browser for example if it understand this format it tracks the like near blockchain it can serve this data without any other back back-ends um yes as i said it redirects to ipfs if you need to or you can actually serve
static pages so dynamically generated html straight from the contract and you can read more on this article that i also put on wikipedia so why it didn't work it actually works great except for it doesn't have a reputation system so it's easy to abuse like anyone can come to the page and now edit it and put something else like promote their scam coin there is no permission to restrict the edits um that's actually to prevent someone from like taking all the three letter characters articles and later trying to sell the access to them and it's like bad navigation and no search because it's also mostly a
front-end only app but if you add a backend to this you can build a like full search and you can like fix navigation you can actually improve it it also open source like all of this i'm talking are just open source product now a near social which is a centralized twitter or like what they call it federated twitter it's back to web2 it's a mastered an instance but with a few features for it for the users and you use your near account so in this case for example alex.near you log into this app without email or like other credentials and it generates your account at alex so
you get something like at alex near.social and it's uniquely mapped one to one for the accounts and that allows us to serve this data through the api you also get the push notification which kind of cool where you can react to the events happening on chain so login is near as simple you log in with a new account you are also getting auto generated credentials for mobile app that you can like login on mobile if you don't have a wallet and it has a built-in uh kind of invitation system so one-to-one map means as i said alex.near links to for example at alex
and for this now we can say that alex.near has a profile we know the social edges and uh it has a like custom display name so for example my profile eugene the dream it has like admob but it also has the like profile picture background and stuff like this you can also export posts so long as they are public and like but it obviously um needs to be trusted the api is in-memory api that exports data from the master then and serves it like from memory instantaneously for like really fast from rust so for example from op.near you can get a profile picture and we integrated this
feature into the wiki to display the authors of the articles with more rich media so the device kind of ui doesn't have to keep on like at all care about the how they render a profile how they do this how to store it like right now like every app is kind of independently displaying the users this one is unifying them and also the graph can be used to like show nfts by a friend you can refer friends to the app and you can do friend of friend expansion like intersection of two friends like who should you follow in this particular app it also has the push notifications which is works the following way
when an action happens on a near blockchain it loads an event similar on ethereum event and indexer picks it up so in this case the wiki contract has an article modified by one of the users or created in this case this event is called by the indexer a subscriber to some type of events for the filter gets a push notification on some random back-end it's through the master done api the traditional api it makes a post on the master domain and tagging the user that was just created this article or edited it and my mobile app on master then just picked it up and like rendered this so it's kind of cool where within like two seconds i get a notification for something happens
on chain on a completely random independent account so why it didn't work out it was centralized and that was the main problem it failed the network effect because people are really not interested in another twitter they just want to be only on twitter it has no incentives to join and uh it was not really composible so only outside of api you can do this so like you need to use the mustang api that's of chain and it's hard to iterate because it's on ruby so i present you social 7.0 because it's keeping three other products that i built and that not very relevant to the stock
so that it's like seventh iteration so before we go i want to talk about what is social and web 2 and we have a company on that company it basically creates the application then it's used by the users the users create the data and the data is used by the application and it's owned by the company so what about developers well they're actually begging for the data and getting ranked by the company so let's have social invest too now in social web 3 we actually start with developers they build applications and applications used by the users who create data and the data is used by the
applications but it actually used owned by the users so the developers do not own this data but they can use this data and also they can reuse applications because they are like open source usually so that's pretty good so what about the company well it's being said so what is social so to answer this question i actually have to google it because it's hard question and majority of the social media talks about we have a profile identity and a bio that's what identifies you as a user you have social graph contacts and groups that's your connections to other people
uh achievements pages and soul bound tokens and that's actually the thing that you made in life and you are proud of or not well for example sl bond token can be a negative one but you cannot get rid of this you have uh public feeds blogs and a newsletter that's how you get information from your network and you can add encryption to this data and now you have private notes your settings all the personalization that is not accessible by all the developers on top of encryption you can build messages email and chats where even so data is public no one can use it except for the
parties that have the keys to the state in this case the user with the internet encryption will have the data to decrypt the messages and the data can be just used publicly everywhere now you can end on top reviews ratings and reputation this kind of quantitative metric and it's on top of the graph so for example likes or like super likes and you can have notifications which are coming back for users to immediately react to something so how we do this we keep data on chain and that has a lot of benefits so the data is owned by the users so long as the contract allows this
uh it has unrestricted public reads you can sync up the blockchain and get the data in from any computer without restrictions you can require permissions for rights by limiting how you write to the contract and you have a mutable data history so it allows you to go back in time and like find what's going on there and like do this kind of optimizations on the storage layer it's verifiable and provable because the blockchain is kind of designed for that and it's also accessible by other contracts so it allows you to compose the interesting applications on blockchain
it also scales with the blockchain so if blockchain scales and ships like a sharding and uh and you can shard it then you get like a better performance but you probably cannot store ton of data because it might be expensive so you would mostly focus on the metadata that you care about and the other contract might care about so how we can store it we can store it in something like a key value tree store so it's like a key value store but more obvious hierarchy like a tree so that allows users to have independent storage so for under their account id they can store all the information about them they cover the cost of this storage and
they only they cover the rights to the story some modifications it can be like in a simple json like representation it's also very important that doesn't have a specific schema like on lens protocol again they have a specific schema right now where you even so it's flexible they kind of enforcing certain methods here we trying to keep it free form and i'll tell why it also can be sharded by account id so you can scale with the network item or shards so the reason we're not using schema is because we should use standards and the standards is a great way to make it decentralized because standards are not forcing you to be this way they kind of
like suggesting you to be this way and a community can define standard instead of the foundation who's like govern their protocol can define standard there can be multiple competing standards and that should be fairly common i think ethereum is like uh erc standards also like have multiple nft competing standards that eventually one of them like get adopted by the community but they don't enforce it on the like inferior blockchain network so standards may evolve and like eventually we get rid of like one token and start with another one uh the contracts can stay immutable which is very important to guard the
control of this and like remove the liabilities from me if i develop this contract and later like someone comes to me and like saying hey we can deal can we delete this account and i don't have an option to do this and it also modifies how we create new applications so we start with idea then we deploy the mvp without writing uh extender first then we test it publicly and if it seems to be working out then we define a standard like we propose the standard and it's created and like discussed by the community then there's the right permissions on top of the this layer and a user has a control over the right permissions
and for example they can only give a permission to modify a profile information under a profile like up to a certain amount of bytes so that allows you to onboard javascript developers who really don't have the experience with the contract development and they can write apps for the social platform you can build contract permissions you can do data based permissions which are interesting you can pretty much implement an nft on this if you specify hey only the person who in this key has ability to modify that key and you can have permission for permissions which is like way too complicated so what is a front-end for this
it's a javascript and can be only a front-end so don't need a contract uh there can be multiple react components react hooks for this and a simple json api to query this but also you can have a custom api backends that can do more complicated logic you can also use web sockets for live updates so your app is more live so what is the back end the back end is synchronized in blockchain it indexes historical data but it also understands all the standards that were invented and like agreed on by community you can obviously have multiple of them so it can do search it can do graph expansion it can do rating or reputation it can do
notifications but it also can be upgraded frequently not like a contract it also open source so anyone who don't like the current backend and like don't have access can spawn their own back-end and use it so here's the architecture we start with this contract under near blockchain whereas there's other contracts then the front-ends interact with the newer blockchain and blockchain or like other contracts can interact with the social contracts then we involve standards the standards are coming to the contracts and front-end apps and finally we can build the custom back-ends data like understand standards and have custom logic so why it may work
so basically data apps and users and developers create a network effect the social graph makes it easy to onboard new applications pages and achievements create gamification and we see this this games users bring their friends in because they're like hey you are missing out and developers build new application that brings users more and overall the ecosystem keeps growing so every component is replaceable and the open source is encouraged so that allows you to like spawn any other ps data is public so you can take it out spawn on a different blockchain and it has no governments and no token and
no operational cost so that's actually very important because the governance has the bias tokens creating different incentives and the cost if i die they better like leave so thank you and let me know if you have questions [Applause] yes hello so if anyone has a question do not hesitate to ask could you elaborate a bit on the role of tokens so the tokens are usually like creates variable incentives on this and we don't want a token for the samsung that is
base layer so if you want to monetize your product you can issue your own token but it doesn't need to be on this low level where you just store data any user cover for the storage of the data so that's why we don't need a base layer token to modify because there's no governance evol like anyone can propose a new standard anyone can write data in the form what they want and they all have equal access any other questions well thank you thank you