Back to All Episodes
Season 1Episode 5

Own Your Words

January 14, 2022
24m
1 Guest

Listen Now

About This Episode

This episode of DevNTell, hosted by Narb, features Nikita Grishin, also known as mgrin. Nikita presents his project, "Own Your Words," which allows users to mint their social media presence and individual posts as NFTs on the Ethereum blockchain. Initially conceptualized as a learning exercise and a potential improvement over authentication tools like Collab.Land, the project evolved into a sophisticated platform involving complex smart contracts, custom oracles, and encrypted backend systems. Nikita demonstrates the minting process for both account ownership and specific tweets, explains the underlying technical architecture (including the use of Solidity, NestJS, and custom oracles), and discusses the project's roadmap, which includes expanding support for other social platforms like TikTok and Instagram.

Key Takeaways

1

The project 'Own Your Words' provides a mechanism for users to verifiably own their social media accounts and content by storing them as NFTs on-chain.

2

Nikita's initial estimate of two weeks for the project ballooned to four months due to the complexity of building custom oracles and handling off-chain API calls.

3

The project uses custom oracles and an encrypted backend to securely bridge Web2 social media data with Web3 on-chain metadata while maintaining privacy for authentication tokens.

4

The use of upgradeable smart contracts (OpenZeppelin) allows the platform to easily add support for new social networks without deploying new core contracts.

5

A key motivation was to create a more seamless and user-friendly alternative to existing bot-based account verification methods used in DAOs.

Featured Guest

NG

Nikita Grishin

Founder @ Own Your Words

Own Your Words

Timestamps(click to jump)

Episode Transcript

Narb

All right, let's get going here. GM to one and all. Welcome to another, what's going to be, an awesome DevNTell. So, if you didn't know what DevNTell is, DevNTell is a session that's held almost weekly on Fridays to give people of the Dev Guild an opportunity to show off any cool projects they're working on, or any tips or tricks around software development, or just any type of passion they have around the area of development. It's an opportunity for people to strut their stuff and give them a platform to share it with all of the community here. So, this week, I'm happy to bring over mgrin, Nikita, who is going to show his project, 'Own Your Words.' Take it away, Nikita.

Nikita Grishin

Thank you, Narb. Thank you everyone for being here. Firstly, I'm glad that you all could join this morning. As you said, this is going to be a presentation of this project called 'Own Your Words.' I've been working on it for a bit. Firstly, I want to say thank you to Javi, who presented last week on DevNTell. I was inspired by him to create this presentation as well, not just the product itself.

Nikita Grishin

A couple of words about myself. My name is Nikita. I joined Developer DAO in late August 2021. That was close to one of the best decisions in my life and career. Otherwise, I've been working as a full-stack dev and bit of a data engineer the last couple of years. Basically, I just wanted to get into Web3 and join Developer DAO, and that was a beautiful decision.

Nikita Grishin

So, what were the reasonings behind starting this 'Own Your Words' project? Firstly, getting into Web3 development. Of course, the best way of learning something is by doing something. So I started to think about some kind of idea for a project to work on for a couple of weeks. Also, the Collab.Land bot, I didn't like it at all. When joining Developer DAO or any other DAO, you have to prove your wallet and that you own an NFT. I didn't like the UX at all. I do understand why it's done like this, but I thought maybe we can do something better. Also, I wanted to leverage the blockchain technology for the Web2 world. Basically, to ease the transition from Web2 to Web3 platforms. We have this beautiful Web3 world now, but the transition itself is not yet planned. I wanted to think about how that transition from any Web2 platform to Web3 could happen, basically having some kind of connections.

Nikita Grishin

That's how the idea was born. I wanted to build something related to something familiar to me, which at the time was OAuth flows. I've been working for a year and a half on authentication systems, social media OAuth, etc. I wanted to build something around OAuth flows that wasn't too complicated, as I was just getting into Web3. So just one simple ERC-721 contract, no fancy stuff, just a simple Solidity contract. But I wanted to do the full circle of development, building the proof of concept on my laptop and then bringing it to production deployment to see how the CI flows work, how the logs work, and face all the real production issues with Web3 applications. As a result, I got this idea of owning your social media posts and social media accounts as NFTs. Basically, having a product which will allow you to own your access to Twitter, Discord, or TikTok as NFTs on the blockchain.

Nikita Grishin

Next step was planning. The estimations were two weeks of work, one smart contract, and one React app. In reality, that turned out to be four months of development, eight different smart contracts, custom oracles to make off-chain calls, backend, and some encryption included. So it turned out not to be that easy, but I split it over four months alongside my main job.

Narb

Nikita, are you still there? I think you might have cut out.

Nikita Grishin

Narb?

Narb

What about now? Are we all good?

Nikita Grishin

Yeah, I was able to hear you the whole time.

Narb

It must have been my connection, sorry about that. Continue, go ahead.

Nikita Grishin

I'm going to show you the whole flow on the Rinkeby network. What I have now is two NFTs, one for my Twitter and one for my Discord. If I click on them, they go to my page on Twitter or open the Discord application.

Nikita Grishin

The reason behind the minting process is that it goes through an oracle which is listened to by my backend to send requests to the Twitter API. You pay this price for the oracle to basically pay the gas afterwards for you. Firstly, it's better to check if the account is available on this network. I'm just going through the whole OAuth flow. I'm sorry my interface is in Russian.

Nikita Grishin

Now it's just checking that my Twitter account is not yet minted on the blockchain, so basically I can mint it now. It's going to ask me again once or twice as I'm getting all these OAuth 2 verifiers and tokens from Twitter every time; they are not stored anywhere. Getting another authorization from Twitter, then getting my MetaMask notifications to pay these gas fees which will be paid to the oracle for him to basically submit stuff.

Nikita Grishin

The whole process works like this: we made a call to a smart contract for the given NFT, which is basically making a call to the minter contract, which is going to call the oracle. My backend is going to listen for an event happening on the oracle side, like the request received. My backend is going to send the off-chain request to Twitter asking if the provided OAuth verifiers and tokens are valid. If it's valid, the oracle is going to submit a state change to the blockchain saying this request succeeded with information about my Twitter account, like Twitter ID. Then the NFT contract or the front end will listen for this 'request succeeded' event to reload the page and get my NFT from the smart contract. So here it is. This is how you mint an NFT for your Twitter.

Nikita Grishin

Next step is minting your 'words.' Basically, you can just go here and open your Twitter and copy-paste the link and you're going to mint this tweet. What's going to happen if I'm going to mint this tweet, which is not mine? I don't have ownership over the account that created this tweet, so I'm not supposed to mint it. I can't mint it. I can only mint my own tweets. Let's go back and select this tweet. This is my account, and basically the whole stuff is checking that I do have the rights to mint this given post. The whole flow is working in the same way. There is the NFT contract for 'Own Your Words,' there is an oracle doing off-chain calls, there is a backend doing these calls for real, and then there's all this event stuff going through. And here it is. This is my NFT basically. If you click on it, you're going to open this tweet on the Twitter page.

Nikita Grishin

Let me switch back to the Rinkeby network. Currently supported networks are Twitter and Discord for social networks, and Twitter only for posts/tweets. But as you can see, there are no limitations on any networks. Any social network having OAuth 2 can get integrated here, even TikTok. It doesn't have to be textual posts; it can be Instagram or TikTok or anything else, even YouTube. Basically you can own any content you create on your Web2 social media platforms as NFTs.

Nikita Grishin

The third tab here is 'Statements.' That's the next stage of development which is not done yet. It's basically being able to create books or statements based on the words you own and then print them. Some kind of off-chain, real-world usage of your NFTs like printing books with your stuff. But it's not yet at all deployed. Since these are NFTs, you definitely have them on OpenSea. It's on testnet now, on Rinkeby network. All the metadata here is formatted well. You can go to my Twitter now. The uniqueness of this stuff is the background, which is random, just to make it a bit rare or whatever, just to have fun. That's pretty much it about the product itself.

Nikita Grishin

So technically wise, as I already mentioned, I used Solidity, which is a fancy language I really liked. OpenZeppelin upgradeable contracts, which is a beautiful piece of open-source software. NestJS for the backend, just because I wanted to try it out. React for the frontend, and Chakra UI because I'm familiar with it. Off-chain calls are done using custom oracle contracts based on events, and the real OAuth 2 requests to the social networks are done via my backend. The data passing through the blockchain, the OAuth verifiers which should be kept secret, are encrypted by my backend again. So all the data which is stored on the blockchain, which is obviously public and readable by everyone, is encrypted by the key stored on my backend. Smart contract sources are verified. There are methods for other developers implemented, meaning if you own an NFT of your Twitter, everyone can call the 'Own Your Words' smart contract and check if this address owns this Twitter. It's just like ENS for your domain names but for every social network. Documentation, as always, is non-existent. GitHub is public, and it's already on the Notion of our DevNTell meetings, but I can share it later on in the Discord. So yeah, that's about the tech.

Nikita Grishin

The roadmap now is, firstly, taking a small break after these four months of developing this 'small and easy to deploy' pet project. But then I would like to try to build a team with one dev, one marketing, and one designer guy. Add more social networks, of course, as the smart contracts are upgradeable, so there's no problem in adding new social networks into the same smart contract. Deploy to mainnet. Then create bots and utils for other developers. That's where the Collab.Land bot basically can be replaced. So instead of a user going to a bot, clicking on a link, and connecting his wallet to verify that he owns the account that just joined the Discord server, the Discord can just check if the account which has been just connected to the Discord server is owned by any of the ETH addresses. And the fifth point, developing the statements NFT and build operations about printing it on paper, these are like dreams, but it would be cool and fun.

Nikita Grishin

That's pretty much it from my side. I'm leaving the remaining 13 minutes for you for questions.

Narb

Yeah, this was really awesome Nikita. Thank you for sharing this. In the tab with the accounts, when one is looking to basically link their account to their wallet, and you might have touched on this on point four of your roadmap, but is there a verification process in place already to say that I own this particular Twitter account?

Nikita Grishin

Yes, sure. Basically, when you mint, you first check the availability. But then the whole process is that the front end is getting the OAuth verifier and OAuth token from Twitter. Then it encrypts it using the backend, and then the encrypted version of these two values is submitted to the smart contract. These two values are going through the blockchain and stored on the oracle. The backend, which shares the secret key to decrypt these values, is going to take these two values, decrypt them, and basically go to Twitter to check that you basically own this stuff. So it's basically connected to Twitter API using all the Twitter API OAuth values and verifiers and checks. And that's the main reason why it took me not two weeks but basically four months.

Narb

Oh, I see. Cool. It's always that way. But it's great, this is awesome. Does anybody on the call have any questions for Nikita?

Narb

Doesn't look like it, but I guess another question from me was, was this project inspired by a particular passion or looking to solve a particular problem? I might have missed that as well in the beginning, I apologize.

Nikita Grishin

That was mainly trying to solve the problem of merging together the Web2 platforms and Web3 platforms. The example of Collab.Land bot is the direct way of solving this problem, but I wanted something easier. I don't see the point why if I own an ETH address and I own a Discord account, why every time I join a server in Discord I have to re-verify that that's my account for this Discord server. Same for Twitter. I've seen recently that Twitter is developing their own connection to the ETH network to be able to connect your wallets. But that's the point, like right now owning my Twitter account means Twitter, I should believe Twitter that they say that I own it. Better to write it on blockchain. Just write all the ownership of my data in existing social media platforms to the blockchain.

Narb

Got it. Awesome.

Audience Member

I had a quick question. I was curious what were, obviously the challenges were pulling a lot of these pieces together. Is there any code or anything on your public repo that you would like to walk through and highlight any of the complexities?

Nikita Grishin

Yeah, sure. Basically the most challenging part was this oracle and the way of doing off-chain calls. When I started, I was like, come on, ETH is just like a piece of technology and calls to an API should be easy from a smart contract. Turns out no, you have to go to this Chainlink stuff. I'll be honest with you, I spent like a week trying to understand how the whole Chainlink should work and didn't get it. So I tried to build basically my own conception of oracles. I know it's a bit of a bad idea, but yeah, that's it. So yeah, basically just oracles. The way it's working is let's go with this social networks ownership smart contract. When you mint, let's say Twitter, you basically call a smart contract called TwitterMinter, which has some particular stuff exactly for Twitter, sending the OAuth token and OAuth verifier there, encrypted. This TwitterMinter contract has the method 'startMint', taking this data and creating a request to an oracle with this data. The oracle, when the oracle knows that this off-chain call is done, is going to call these two callbacks here.

Audience Member

One question about the oracle, I'm fairly new to it. So this is, oracles are used to call off-chain, like any APIs in the real world?

Nikita Grishin

Kind of, yeah. So here the oracle is basically the contract storing all the requests that should be made and the responses related to these requests. So when an oracle gets a request, let's say this is a Twitter oracle here, it gets a request with token and verifier, and with two callback functions which should be called when the request is done. When the oracle gets the new request, it emits the new pending request by ID. This event is listened to by my backend. They are getting this request ID, they are getting the request data from the blockchain, and my backend is doing the request to Twitter API with these two values. And when my backend is done doing this off-chain call, it submits the, well, it basically calls the 'succeeded' method of the oracle smart contract with an ID and with data being the response of Twitter. And the oracle, when it knows that this request ID was succeeded with this data, creates the response with this data and calls the success callback. So yeah, the oracle is the contract storing the fact that there had been a request and the response to this request, successful or not. And the backend is listening to new requests coming into this oracle contract, doing the off-chain calls, basically doing the classical REST API calls, and storing data on the blockchain again.

Audience Member

Okay, yeah, thank you for running through that. It does look pretty complex to create.

Nikita Grishin

Yep. Well, that's been written like five times I guess. The full code is public, so you can go through it. It's completely public. I'm going to publish it later on but, again, no documentation, sorry.

Narb

I guess on the topic of documentation so to speak, if anybody wants to contribute to this project, are you planning to add a contributing doc and whatnot sometime down the line, or do you see it kind of in its first MVP stage and not looking to have anything major added at this point?

Nikita Grishin

Sure, I want to add the doc as I want to add a possibility to contribute, firstly to add new social networks. I don't want to cover all the possible social networks. So yes, definitely I will someday develop the doc, probably next month. But all the contributions are welcome and this is the state of the repo where it's an MVP but it's not going to be rewritten from scratch. So I'm going to continue from this point here. So yeah, docs are definitely going to be here.

Narb

Fantastic, fantastic. All right, we have about five minutes left. Are there any last questions for Nikita before we sign off? Going once, going twice.

Narb

Oh, would you want to share the presentation? I didn't actually get many notes down because my stream cut out. But yeah, I'd love to put that in the Notion if you're willing to.

Nikita Grishin

Yeah, sure. I'm going to post it now in the developers-voice-text channel and in the Notion as well.

Narb

Perfect, perfect.

Audience Member

Yeah, thank you for your presentation. Really enjoyed it.

Nikita Grishin

Thank you guys.

Narb

Yeah, that's it. This was awesome Nikita. Thank you very much for sharing. And if there are no further questions, we can call the DevNTell session for today. Once again, thank you so much for everybody participating and asking questions and Nikita for sharing. Stay tuned for an announcement around next week's DevNTell presenter. The slot is still open, so if anybody is interested, shoot me a DM or post in the DevNTell channel. Or better yet, you can take the initiative and book your spot in the Notion wiki that is posted in the DevNTell channel. Up to you. And with that, I hope everybody has a fantastic rest of their day, a great weekend, and we will touch base again next week. All right, gang. I will stop the recording here now.

Listen On

Resources & Links

Share This Episode

Share on X

Watch Episodes Live!

Subscribe to our event calendar and never miss a live episode.

View Event Calendar