btimby / nimtok

IPFS / Nimiq messaging
MIT License
3 stars 0 forks source link

Is there anything you'd like help with on this project? #1

Open Ryanb58 opened 3 years ago

Ryanb58 commented 3 years ago

I have a byte of Vue.JS experience now. Is there anything I can do to help out with this project? I don't have a lot of time to dedicate, but if it's something you are pursuing, I'd love to help.

I'll try reading up on NIMIQ and IPFS this week.

btimby commented 3 years ago

Cool, thanks for reaching out!

My weakness is, and always has been UI / UX. Layout, design etc is just not something I have ever been able to approach. I certainly need help with that! Beyond that, this is a pretty large project in scope, but I am happy with the groundwork so far. So anything you would like to tackle is appreciated.

Look at UG, which was a first stab at something like this, it gave me some sense of what was necessary, while developing that, I came across IPFS, NIM, OrbitDB etc, this is a space called web3 subsection dapps (distributed apps). These tools are basically what I was looking to build except much more complete and robust.

https://github.com/btimby/ug/

Here is the 40,000 foot overview.

NimTok (a working name only) is a microblogging system built using IPFS and OrbitDB. The goal is to be fully decentralized. All data is stored on web clients that are part of the P2P swarm. The NIM portion (cryptocurrency) is a secondary goal, but I am currently mining NIM on several machines to see how that works. The mining aspect is meant to encourage people to leave the application open in a browser tab, mining for NIM and also contributing to the P2P swarm that hosts the application. NIM would be a "clout coin" allowing users to tip each other etc. There are also other opportunities with other coins like ETH, which has smart contracts (basically API endpoints within the blockchain). But in-browser mining is unique to NIM an NIM can do atomic swaps for other coins, so there are possibilities of integration.

Last night I refactored my interface into OrbitDB as a Vue plugin so that pubsub and database queries can interact directly with Vue's Vuex store, this was a really great step forward. I have my first fully decentralized / shared database of "peers" (other users) working now.

This is also a great learning experience, as the paradigm of working in a P2P environment is very different than a client-server model. Each peer (webapp instance) is it's own source of truth and crypto (not currency) has to be used to ensure integrity at every level.

btimby commented 3 years ago

The name, as I mentioned is a working title, nimtok, like NIM talk. Again, my lack of creativity showing :-).

This app will be hosted directly on IPFS, I have already tested this. Due to the nature of this application, it could be available on multiple domains or as part of multiple websites, all contributing to the same swarm. In other words, you access point does not matter, it is the same network anyway. This is great for being censorship proof, you could have many copies of the same web app served from all other.

I plan on making my VueOrbitDB a separate package in NPM, as it is useful on it's own. I abstracted it greatly for this reason.

https://github.com/btimby/nimtok/blob/main/src/plugins/orbitdb.js

Here is where i use it:

https://github.com/btimby/nimtok/blob/main/src/store/modules/auth.js#L37

The basic idea is that you can open a number of databases and / or pubsub topics. When you subscribe to a topic, you can either register a callback (function) or an action. The action is a Vuex thing, which allows pubsub messages to commit mutations to the global application state.

Currently, when a new user is discovered, the global peer count is incremented and the corresponding user counter widget updates. A simple example, but this is a pattern that can be used to track hashtag usage for trending lists etc.

I am going to focus on account creation today. One challenge that highlights the difficulty of distributed systems is something very simple, the username or handle.

There is no central authority to enforce uniqueness. The only thing guaranteed to be unique on the network is the key pair used by ipfs. In fact, the public key serves as the unique ID or identifier of each user.

To this end, my plan is to let the user choose any username they want, and also control an avatar image (stored in IPFS). But provide a second automatic "user hash" (like the git commit short hash) based on their public key, and a second auto-generated user icon based on the public key. Hopefully this allows people to easily recognize imposters.

Also, anywhere impersonation could be an issue (like when sending a tip, or when receiving a DM), the key will be compared to peers that the user has interacted with in the past (following, followed) and warnings can be shown: "notice: this user name is similar to a user you are following, but is not the same user!"

Ryanb58 commented 3 years ago

@btimby Sorry for the delayed response. I like the idea a lot, especially for those of us that use laptops and desktops. However, I do hold some reservations about how popular it could get. Most of my family has removed personal PC's from their lives and now mostly use phones/tablets, even to file their taxes. Would this setup be able to work in some way for mobile users?

I can help with the frontend as long as your cool with us starting off super simple.

Do you care if we use any frontend component libraries to help get us started? I was looking around and stumbled upon Element UI and Buefy.

btimby commented 3 years ago

No problem. The nature of the distributed system puts some pressure on the client. However, even phones and tablets have a lot of resources. Mobile browsers also have all the required capabilities.

I have been working on moving all of the P2P and database code code into a web worker, which will greatly help with performance (web worker is how to do multithreading in the browser).

On the frontend, I am using vuetify, which is a materal design component library for vue.

Check out the issues here and see if anything interests you.