DimensionDev / Maskbook

The portal to the new, open Internet. ([I:b])
https://mask.io
GNU Affero General Public License v3.0
1.51k stars 310 forks source link

[Bounty] Unlock the imagination of online publication directly on Twitter with Unlock Protocol #2363

Closed yisiliu closed 3 years ago

yisiliu commented 3 years ago

Catalogue

Part 1: Problem Description

Mask offers a browser extension which lets users create encrypted tweets where the content of the tweet can only be “viewed” by other Twitter user if they use the Maskbook browser extension. These tweets can include text, but also images.

Unlock is a protocol for memberships which lets creators deploy a lock and sell access to this lock using the Ethereum blockchain. Locks can be added to websites, or applications in order to monetize them.

We are proposing an integration between Unlock and Mask where creators will be able to post encrypted Tweets and put them “behind” a lock, so that only members of the lock are able to view their content. If viewers are not members, then, Mask would offer the ability to Unlock these memberships. In that scenario, Mask is a referrer and should earn UDT.

For a more detailed description, you can refer to this.

Part 2: Resources

https://unlock-protocol.com/ https://github.com/unlock-protocol/unlock

Part 3: Contact and Support

Mask Discord Server @yisiliu @Jack-Works -> Mask @julien51 -> Unlock

iamzubin commented 3 years ago

@Jack-Works @yisiliu

Jack-Works commented 3 years ago

Hi, I have reviewed your front-end work (https://github.com/iamzubin/Maskbook/tree/unlock). I found the functionality is basically missing (it only contains a GraphQL query to the Unlock API which the address is hardcoded). I think we should complete the unlock protocol integration because that's the final target of this bounty. That involves a lot of work in the front-end. The mechanism I described above is used for key distributing in a decentralized way, it's still useful for us in many ways (device sync, group share, ....). However, we are not focusing on this backend service right now and it's bounded by the completion of the frontend interface. Can you tell us your plan on completing this bounty, please?

iamzubin commented 3 years ago

The unlock protocol integration works on the GraphQL APIs, Currently the api endpoint is hardcoded (I saw the gun api endpoint hardcoded figured might as well do same for the unlock graph ), That's pretty much it as for the user side unlock protocol integration.

while making the post a unlock nft token address is stored in the localdata this commit . which would be used later to verify the intended recipients.

when the user encounters the post they would require the key to read it. which would be provided by the original poster or someone else who already has the access to the key, before sending the key to user, provider would verify the request by verifying if account making the request actually has access to the unlock using the function verifyHolder .

is there anything I'm missing on the frontend that needs to be added?

iamzubin commented 3 years ago

If nothing I would like to you to take a look at the backend service as it currently does not meet all the requirements that were mentioned in the issue #2520 , before I go ahead writing and adding to the server code I would like to be sure about if that meets the requirements, or are there any major changes to be made.

Jack-Works commented 3 years ago

About the front-end part, yes, there're lots of things that need to be changed. It should follow other plugins way:

iamzubin commented 3 years ago

Umm okay this was being discussed on the discord server to integrate unlock as part of the system instead of a plugin. as to read the metadata we need to decipher the post first, and then user can simply read the data. or we need to encrypt the data twice and would need to perform exchange twice. image also @yisiliu said it's okay that way.

link to the message

iamzubin commented 3 years ago

I can add a UI to buy the access to the post. this would require user to know what's the address of the given locks is on the eth chain.

The address can be added on the Gun2 and then user can query the database for the lock address.

OR

We can alter the post data and add the unlock locks on the payload itself. then user can buy access to the given unlock protocol lock and then request for the keys on the key sharing server.

iamzubin commented 3 years ago

OH, the unlock protocol does not provide a key sharing platform. you have to manage the keys yourself if you like to use the unlock protocol (the key sharing service is not yet released)

iamzubin commented 3 years ago

@Jack-Works ?

Jack-Works commented 3 years ago

Umm okay this was being discussed on the discord server to integrate unlock as part of the system instead of a plugin. as to read the metadata we need to decipher the post first, and then user can simply read the data. or we need to encrypt the data twice and would need to perform exchange twice.

Oh yes, so you can add it in the recipient part. But it's detail should in the metadata section, otherwise it required to integrate this into the payload format. I think we should make the outer post public encrypted and put the encrypted information in the metadata section.

this would require user to know what's the address of the given locks is on the eth chain.

Yeah this information should be in the metadata too.

We can alter the post data and add the unlock locks on the payload itself.

That introduces much more complexity.

OH, the unlock protocol does not provide a key sharing platform. you have to manage the keys yourself if you like to use the unlock protocol (the key sharing service is not yet released)

Wait... What? So what does the unlock API provides, exactally? It's only checking if someone pays another one??

iamzubin commented 3 years ago

More or less yeah(currently ), so I can’t share the key using unlock protocol.

I know it adds to the complexity, I’m willing to implement it, can we discuss the functionality properly again?

Having conversations one message per day is too slow, we’ve already delayed this and I would like to speed it up. @Jack-Works

Jack-Works commented 3 years ago

More or less yeah(currently ), so I can’t share the key using unlock protocol.

Ok, I go to the Unlock website and cleared my misunderstanding. I need some time to rethink this.

iamzubin commented 3 years ago

Hey, @yisiliu @Tedko I’ve been trying to contact you guys on telegram but @yisiliu hasn’t been replying since a few weeks and @Tedko stopped replying as well :(

Can I please get a split of the payment as discussed in the issue here #2363 (comment) Can I please get a followup on the situation. there seems to be a blocker out of my scope of work for now, I've done the work depending on the discussion done in the discord channel. I've been trying to contact you guys on telegram but I don't get a reply for long times.

Timeline is very much dependent on when the blocker gets resolved, if that requires me to get involved in I would be happy to.

as discussed with @yisiliu , ( after talking with @Tedko ) last week waiting on @jack-works ' review, I didn't hear back from him after trying to contact him multiple times on telegram, can we please speed up the process.

thanks.

iamzubin commented 3 years ago

@yisiliu @Tedko ^

iamzubin commented 3 years ago

https://github.com/iamzubin/maskbookUnlock/pull/1

Here's the code for server, it's WIP, but please take a look and comment changes.

iamzubin commented 3 years ago

update: you can checkout mu fork (branch: unlockProtocolPlugin), I'm writing the cryptographic functions right now, will PR in a couple of days

iamzubin commented 3 years ago

Some minor stuff left to fix, but please take a look

Tedko commented 3 years ago

Great. Ready to go? @yisiliu

iamzubin commented 3 years ago

just realised there's a check missing for the unlock mechanism, i'll be pushing it today itself.

you can still checkout the rest and let me know about any changes

iamzubin commented 3 years ago

I did push the commit, (and one more thing I kinda missed) please take a look and let me know about the changes. I'm working on cleaning up the server code now.

iamzubin commented 3 years ago

hey @julien51 is there a permalink based page for buying unlock locks? so we can directly link it to that page as adding a buy button for each lock will make the ui bloated i did make a makeshift one but it's pretty janky.

Tedko commented 3 years ago

Hi @https://github.com/julien51 @julien51 can u reply to the bounty hacker?

Tedko commented 3 years ago

@iamzubin any update?

iamzubin commented 3 years ago

yeah it's done, i was waiting on a way to let users buy locks without bloating the ui

i will use my solution for now and do a pr on the main repository today then.

julien51 commented 3 years ago

i am so sorry for the late response here! (I suck at Github notifications!)

hey @julien51 is there a permalink based page for buying unlock locks? so we can directly link it to that page as adding a buy button for each lock will make the ui bloated i did make a makeshift one but it's pretty janky.

yes, absolutely. See te purchase address on the dashboard: image

To build that URL, just start with https://app.unlock-protocol.com/checkout? and then add a query param for paywallConfig which includes an URL encoded config as explained on this page.

We will actually be adding redirect params as well which lets you redirect the user when they close the page or when they complete the purchase. Please bear with us!

iamzubin commented 3 years ago

Ahh okay, till then I'll make the application to work without the redirect url (user will have to reload the page.)

I could not find it in the page, but I'll checkout the source and figure something out. (I'm avoiding including the paywall js as it might make the application a little heavy)

thanks for the reply :)

julien51 commented 3 years ago

Of course! Sorry for the delay. Please do not hesitate to reach out on Discord

iamzubin commented 3 years ago

Hey, before making a PR I was trying to run the code in the develop branch, I can't seem to get it to work on my machine. release branch works fine tho. should I do a pr to develop branch anyway?

iamzubin commented 3 years ago

Ahh okay so how the extensions work changed since when I last updated my repo I need to make those changes, I'm working on it

iamzubin commented 3 years ago

I can't seem to understand the conversion, can you please tell me where to look so I can convert to the new standard of plugins. meanwhile you can take a look here as I posted earlier also.

Jack-Works commented 3 years ago

Hey, before making a PR I was trying to run the code in the develop branch, I can't seem to get it to work on my machine. release branch works fine tho. should I do a pr to develop branch anyway?

What happened?

iamzubin commented 3 years ago

working of plugins changed, injected components i wrote are not working in the SNEAdaptor for some reason

Jack-Works commented 3 years ago

working of plugins changed, injected components i wrote are not working in the SNEAdaptor for some reason

Did you convert your plugin into the new plugin infra and registered it to enable it?

iamzubin commented 3 years ago

working of plugins changed, injected components i wrote are not working in the SNEAdaptor for some reason

Did you convert your plugin into the new plugin infra and registered it to enable it?

Yeah, so I'm working on it but am running into endless errors. right now I'm stuck on DecryptedInspector. but if I'm stuck for longer time I'll let you know

Jack-Works commented 3 years ago

FYI here is an example of migrating an plugin: https://github.com/DimensionDev/Maskbook/pull/3430

iamzubin commented 3 years ago

Where are we planning to host the server? Do I need to set it up?

yisiliu commented 3 years ago

@iamzubin yeah please seti it up for the demo and once we merge the pr we will do it ourselves.

iamzubin commented 3 years ago

Hey, I was not able to set up the server today, for now you can clone the server and run it locally. here is the repository

You can compile the extension code from the one from PR

I will try to host the server tomorrow. till then if you can take a look without me hosting it please do.

iamzubin commented 3 years ago

Alright, so I've hosted the code on my server, and you can test the plugin on this branch unlockProtocoltest, on my fork. link Please test and lemme know if you run into any issues.

iamzubin commented 3 years ago

You can checkout this tweet (other tweets from the same account won't work as I've not migrated the local database), You'll need to buy a lock on rinkeby test network to look at the tweet.

iamzubin commented 3 years ago

@yisiliu @Jack-Works @Tedko

iamzubin commented 3 years ago

hey @yisiliu any updates?

Jack-Works commented 3 years ago

Alright, so I've hosted the code on my server, and you can test the plugin on this branch unlockProtocoltest, on my fork. link Please test and lemme know if you run into any issues.

Can you commit your server URL as the test server so we don't have to set up another one?

iamzubin commented 3 years ago

it's on the branch I've linked to

iamzubin commented 3 years ago

export const keyServerEndpoint = 'https://unlock.iamzub.in'

julien51 commented 3 years ago

Very excited to see all the progress here!

iamzubin commented 3 years ago

hey @yisiliu @Tedko can we go ahead with the bounty process, i think it's done, just pr needs to be merged

yisiliu commented 3 years ago

@iamzubin fix this https://github.com/DimensionDev/Maskbook/pull/3845#issuecomment-906124048 and you are done!

gitcoinbot commented 3 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 6000.0 DAI (6000.0 USD @ $1.0/DAI) has been submitted by: