waku-org / bounties

Community bounties for the waku ecosystem
10 stars 2 forks source link

[BOUNTY] Build dApp of Your Choice Using Waku (Decentralized Communication) and Vue.js #14

Closed fryorcraken closed 7 months ago

fryorcraken commented 12 months ago

Context

Waku Is Uncompromising Web3 Communication at Scale. A family of robust, censorship-resistant communication protocols, designed to enable privacy-focused messaging for web3 apps.

The JavaScript implementation of Waku, js-waku, enables web apps to utilize the Waku network for off-chain message transmission.

Disclaimer: Waku is experimental, you may find blocking issues while developing your web app. We will prioritize their resolution to unblock you, which means you may have to pause development until done. Thank you for your patience and understanding.

Your participation in this bounty is subject to your acceptance of our terms and conditions. Please see waku-org/bounties#applying-for-a-bounty for details.

Rewards

XXX DAI

Timeframe to Completion

1000 DAI.

Once the application is approved, the result must be submitted within 30 days.

Application Evaluation

To ensure you are selected for this bounty, provide the following information:

Bounty

This bounty specifies 3 deliverables, all needed to consider the bounty complete. Partial delivery of the bounty will not make you eligible for the prize. The deliverables are:

  1. A simple web app written using {web framework}
  2. A post on your blog to guide a reader through building the web app.
  3. A tweet thread explaining how your web app works and leverages Waku for private, decentralized communications.

The bounty aims to inspire developers to build applications using Waku. This is why the web app's nature is up to the hacker. However, to push for creative use of Waku, we will not accept chat apps or chat features using Waku.

Your participation in this bounty is subject to your acceptance of our terms and conditions. Please see waku-org/bounties#applying-for-a-bounty for details.

Impact

The web ecosystem has a number of frameworks that each have different pre-configured bundler. To ensure a smooth dev ex for all web developer, it is best to not only test @waku/sdk against the last version of each framework but also provide examples on how @waku/sdk can be used with concepts unique of said framework (e.g. React Components).

It is difficult to have expert of all frameworks in a team, so best to outsource this to the community.

Deliverables

(1) Web App

Build a web app using Vue.js.

Acceptance Criteria

You must fulfil all the criteria below to consider the bounty valid:

Please describe your idea as part of the application to ensure your submission will fulfil the criteria.

We may add high-quality submissions to our example repo.

(2) Blogpost

Write a blog guide that takes a reader through building your web app. The reader should be able to build a working web app by following your guide.

We recommend building a simple web app to make the guide easy to write and read.

The blog post must be licensed under CC0.

High-quality guides maybe be edited and added to the Waku docs at https://docs.waku.org/.

Acceptance Criteria

We prefer moderate-length articles, ideally between 1500 to 3000 words (excluding code). While not mandatory, we strongly encourage you to adhere to this guideline.

When relevant, reference concepts and definitions from our documentation (https://docs.waku.org) and provide a link to our community (https://docs.waku.org/community) for additional assistance.

Avoid submitting articles you have already published or have a high plagiarism score to existing ones.

(3) Twitter thread

Post a Twitter thread from your Twitter account that describes how the web app uses Waku.

For example, if you build a tic-tac-toe game, describe how your web app finds another player using Waku and then exchange the moves over Waku.

Acceptance Criteria

Resources

Learn more about Waku at https://docs.waku.org/. Join our Discord to get support at https://discord.waku.org/. Various examples available at https://github.com/waku-org/js-waku-examples/.

wolz-CODElife commented 12 months ago

I would love to take up this bounty to create a Voting Poll web application using Vue.js that leverages Waku for private, decentralized communications.

Approach 🗺️:

To tackle this bounty, I plan to follow these steps:

  1. Design and Development: I will design a user-friendly web application using Vue.js, ensuring that I adhere to the best and idiomatic practices for the framework. The app will allow users to create and participate in voting polls on various topics.
  2. Integrating Waku: I will integrate the @waku/sdk into the application to enable secure and private communication between users to facilitate the exchange of poll-related data, such as voting choices and results while maintaining anonymity.
  3. Deployment: The web app will be deployed on IPFS or another permissionless decentralized storage solution. I will also provide clear instructions for running the app locally.
  4. Documentation: I will write a comprehensive blog guide that takes readers through the process of building the voting poll web app. The guide will be aimed at developers and will include detailed explanations, screenshots and code samples.
  5. Twitter Thread: I will create a Twitter thread to explain how the web app utilizes Waku for private, decentralized communications. This thread will tag the "@Waku_org" Twitter account and provide insights into why Waku is a reliable choice for building this/similar solution(s).

Timeline 🗓️:

Relevant Work 💼:

While I don't have previous experience with Waku, I have extensive experience in web development and as a technical writer. I am confident in my ability to learn and implement the necessary Waku integration for this project. Here are some of my past works:

I am excited about the opportunity to contribute to the Waku ecosystem and showcase the potential of decentralized communication protocols in innovative applications like the voting poll web app.

I look forward to the working on this exciting project.

fryorcraken commented 10 months ago

@wolz-CODElife apologies for the late replied, I somehow missed this. Feel free to join us on https://discord.waku.org/ to get more responsive.

Please proceed with the typeform: https://github.com/waku-org/bounties#applying-for-a-bounty to apply for the bounty.

fryorcraken commented 10 months ago

The app will allow users to create and participate in voting polls on various topics collected from public APIs.

Can you explain a bit more what you mean there? I am not sure to understand what is the intent of the API usage.

wolz-CODElife commented 10 months ago

A user can create an opinion for other users to agree or disagree with. For instance, in an event(developer conference) a speaker can open a poll on a particular controversy for the audience to share their views through the poll.

The public API provides various popular opinions for users on the platform to vote. The API usage isn't compulsory, it's just an added feature to bring up interesting topics.

fryorcraken commented 10 months ago

I understand that the API is just to assist the user in poll creation, is that right?

wolz-CODElife commented 10 months ago

Yes, and also suggesting ready-made polls to users.

fryorcraken commented 10 months ago

Bounty assigned to @wolz-CODElife

@wolz-CODElife application approved, you can start the work.

Please remember that blogpost and Twitter must be delivered to complete the bounty and get the reward.

fryorcraken commented 9 months ago

@wolz-CODElife how is it going?

wolz-CODElife commented 9 months ago

Hi Frank,

It's going well, @lordghostx has been very helpful. I should round up the app today or tomorrow, then start working on the How-to guide.

wolz-CODElife commented 8 months ago

Hi @fryorcraken,

After several back-and-forths with the waku-vue compatibility issue #1746, we found a solution around it.

Here are the deliverables for this bounty:

hackyguru commented 8 months ago

Thanks for the submission @wolz-CODElife , reviewing it shortly 👍 will keep you updated

wolz-CODElife commented 8 months ago

Thank you

vpavlin commented 8 months ago

Hi @wolz-CODElife! Thanks for submission!

I went through the code, blog post and tested the app and have a few comments:

I'll read the blogpost and the X thread again, but those look generally good and informative

The

wolz-CODElife commented 8 months ago

Thanks @vpavlin for taking the time to review my submission.

Here are my responses to your comments:

wolz-CODElife commented 7 months ago

Hi @vpavlin I've checked off all the items on your comment, please see to confirm that it meets your expectations appropriately.

Thanks.

vpavlin commented 7 months ago
  • For race conditions, that's why I called the subscribe() method before updating the vote, with a hope to get the most updated vote counts before writing a new one. I'd appreciate if you could suggest a better approach to this.
  • [x] Calling waku.subscribe() in handleVote was my solution to race conditions, but since once at startup is okay, I will see other methods.

Interesting thought, not sure if you are familiar with PubSub Pattern - this is how Waku works, so once you subscribe you will (in ideal world:) ) recieve all the published messages for the given content topic. But there is no promise about order. Calling subscribe again does not "force" delivery of messages either.

Generally the approach to overcome this is to use something like Event Sourcing Pattern where instead of sending the whole state, you publish state changes and then reconstruct the state based on these "diffs". IOW instead of sending

{
  "poll": "XYZ",
  "options: {
    "x": 1,
    "y": 10
  }
}

you'd do

{
  "poll": "XYZ",
  "type": "vote",
   "option": "X"
} 

And then you'd reconstruct the state based on the list of "updates".

I think it's fine for this bounty to leave it as it is, but it might be worth for your own sake to look at these patterns for the future:)

I'll go through everything once more, but I think it looks pretty good right now!

wolz-CODElife commented 7 months ago

Thank you @vpavlin, I've come to understand how PubSub Pattern works, and the relationship with subscribe().

I agree with Event Sourcing Pattern as a good solution for this case. Would be helpful in the future.

Thanks again. Let me know if I can proceed with publishing the content, and any other thing required.

vpavlin commented 7 months ago

I just noticed incorrect statement in the X thread:

Participants exchange votes and poll updates directly,

The communication would rarely be direct in Waku, messages travel through the relay nodes which allows Waku to preserve privacy - since there is no explicit sender (or link to sender) or recipient and you don't know who you want to send the message to, you cannot communicate with them directly - hope it makes sense:) IOW the sentence should be Participants exchange votes and poll updates over Waku network.

Users can cast votes without concerns about metadata harvesting

We might want to mention that this is not the case in this simplified implementation as messages travel over network unencrypted, so you are leaking your address and vote to anyone looking:) But that's ok for the simple example, just want to clear up expectations for other people who might think everything is automatically encrypted (which it is not!)

wolz-CODElife commented 7 months ago

Thanks for pointing my attention to these, I've corrected the necessary information. Please let me know if there are any other things needed, and if I can proceed to publish the content.

vpavlin commented 7 months ago

It seems like https://waku-vue-poll.vercel.app/ does not have the latest version - when I run locally, it asks for a signature when creating a poll, but the deployed version does not.

Otherwise, I am fine with the result" Thanks a lot for this submission!

wolz-CODElife commented 7 months ago

It seems like https://waku-vue-poll.vercel.app/ does not have the latest version - when I run locally, it asks for a signature when creating a poll, but the deployed version does not.

I just tested the deployed version, and it asked to sign polls: image.

So. I'd proceed to publish.

vpavlin commented 7 months ago

Hmm..I tried hard reload, cleaned up localStorage and cookies, disconnected and reconnected the wallet, but still does not ask for signature.

I see this error in console. No idea what's the problem:D

image

wolz-CODElife commented 7 months ago

I redeployed, hard reloaded too, cleaned up cache, disconnected and reconnected the wallet and I can sign polls without any issue:

image

vpavlin commented 7 months ago

Damn, this is so weird @hackyguru @fryorcraken can you guys try it? Feels like my Metamask must be messed up as the dapp gives me completely random values as addresses

Btw, @wolz-CODElife could you maybe add a check for that (address provided by window.ethereum not being actual address) and make it clear that the address is incorrect/unusable to the user (me)?:D

EDIT: I just tried in a fresh installation of Brave and the behaviour is the same - it originally showed up fine, but when I disconnected and tried to connect again, I get random values instead of an address

wolz-CODElife commented 7 months ago

Wow, this is weird.

@vpavlin I've added a check, and everything seems to work fine on my end.

vpavlin commented 7 months ago

:facepalm: I was looking at old code, looking at the latest - I se where the random values come from - you actually have a code for that:D So the real question is, why is my MetaMask not giving you accounts.

And I believe the reason is that you are only asking for available/connected accounts, but not actually requesting the connection - see ethereum.request({ method: "eth_requestAccounts" }) call in https://dev.to/inancakduvan/connect-metamask-wallet-javascript-h1f

When I call that in the console, it would pop up Metamask asking me to connect to the website and then it would correctly resolve the address.

wolz-CODElife commented 7 months ago

I used to get a "deprecation warning" when I used ethereum.request({ method: "eth_requestAccounts" }) before. Hence, why I used ethereum.request({ method: "eth_accounts" }).

But eth_requestAccounts works just fine now, you can try it again.

LordGhostX commented 7 months ago

Hi @vpavlin, I decided to give it a try, and it works fine on my end

Signing before creating polls: Screenshot 2024-01-24 at 20 15 20 Screenshot 2024-01-24 at 20 15 48

Account address displaying: Screenshot 2024-01-24 at 20 21 39 Screenshot 2024-01-24 at 20 21 55

wolz-CODElife commented 7 months ago

Great! Thank you @LordGhostX

vpavlin commented 7 months ago

@LordGhostX awesome! Thanks for trying - would you mind checking one more thing? Try to disconnect the wallet and then connect it again to see what happens - I feel like that's what broke it for me, but not sure:)

LordGhostX commented 7 months ago

Initial connection:

Screenshot 2024-01-25 at 22 21 39 Screenshot 2024-01-25 at 22 21 49

Disconnecting from MetaMask:

Screenshot 2024-01-25 at 22 29 33

Reconnecting:

Screenshot 2024-01-25 at 22 30 29 Screenshot 2024-01-25 at 22 30 34

cc: @vpavlin

vpavlin commented 7 months ago

Super weird, but it works for me now as well:D I tried to disconnect, reconnect, clear up everything multiple times and it seems to work fine. Very strange

wolz-CODElife commented 7 months ago

Wow! Glad it works now :)

Am I good to publish?

vpavlin commented 7 months ago

Yup, seems all is good!

wolz-CODElife commented 7 months ago

I have published the deliverables:

fryorcraken commented 7 months ago

Payment done.

hackyguru commented 6 months ago

@wolz-CODElife wanted to check if you'd consent for the blog post article to be shared on the Waku blog :) this can be an amazing resource for other devs, so we wanted to add more visibility to it by publishing the tutorial on our blog

wolz-CODElife commented 6 months ago

Hi @hackyguru!

That'd be great, please feel free to publish the tutorial on the Waku blog.