gnolang / hackerspace

Tinker, build, explore Gno - without the monorepo!
11 stars 8 forks source link

Berty's dSocial Builder Journey #51

Open jefft0 opened 10 months ago

jefft0 commented 10 months ago

This documents the continuing journey of Berty into Gno.land. This follows from our previous journey to create Gno Native Kit (formerly called GnoMobile).

The goal of dSocial is to create a test bed for building decentralized social media type of applications and experimenting with smart contract integrations around social media features. This test bed is not intended to be a polished end-user app but to experiment and stress test technical issues in using Gno.land related to implementing decentralized social apps.

The first version of dSocial will include the basic Twitter-like features like: post, react, notification, mentions, etc. dSocial will be built for mobile using the Gno Native Kit framework, but we will also include a minimal desktop app and a read-only web version.

Additional R&D issues we will investigate are:

You're invited to follow our Journey where we will document our experience using Gno, writing realm code, and track our issues and R&D results. 🚀

jefft0 commented 10 months ago

Contributions to gnodev and gnofaucet

To work on GnoSocial, we have gotten started with the development cycle using gnodev and gnofaucet . We have opened the following PRs with contributions which are making our work smoother and hopefully for others too.

More to come for sure!

jefft0 commented 10 months ago

More contributions to gnodev

In working with gnodev, we ran across an easy and a hard problem.

jefft0 commented 10 months ago

Contributions to r/demo/boards

GnoSocial is a modification of r/demo/boards . As we were developing we found some bugs which we fixed in GnoSocial, so we contributed some PRs to fix the same in r/demo/boards.

jefft0 commented 10 months ago

Contribution: Add Run to gnoclient

GnoSocial uses Gno Native Kit which is a thin wrapper on top of the gnoclient API. This already has Call to call a realm function. But for stress testing in GnoSocial we need to use ad-hoc scripts which run on the node and do multiple function calls. This was one of the purposes of the command-line gnokey maketx run. This pull request adds Run to gnoclient so we can do this programmatically. https://github.com/gnolang/gno/pull/1574 (Merged)

jefft0 commented 10 months ago

Stress testing app

Thanks to the Gno devs merging the PRs mentioned above, Gno Native Kit can now use the Run command to call realm functions repeatedly. We made a PR to use Run and gnodev to stress test storing thousands of messages. See the PR for preliminary results and near-term recommendations. Eventually, apps like this can be part of the automated testing of the Gno code. https://github.com/gnolang/gno/pull/1583 (1 approval)

Some of the recommendations are done by this gnodev PR. https://github.com/gnolang/gno/pull/1622 (Merged)

jefft0 commented 9 months ago

Contribution: Improve error message in calling realm function

One of our devs lost time trying to understand an uninformative error message when calling a realm function with the wrong number of arguments. This will be a common problem for other devs. We made a small PR for the VM to check the number of arguments and give time-saving informative error messages. https://github.com/gnolang/gno/pull/1610 (Merged)

jefft0 commented 9 months ago

Contribution: Add Send to gnoclient

The gnoclient API already had support for MsgCall. Above, we mentioned how we added support for MsgRun. Here, we made a PR to add MsgSend to send coins from one account to another. We will be using this in the GnoSocial demo app. https://github.com/gnolang/gno/pull/1639 (Merged)

jefft0 commented 9 months ago

Stress testing with on-disk storage

With the help of @gfanton to show where to increase the maximum allowed gas in gnoland, it can be used for stress testing where hundreds of posts are added to the boards realm in each transaction. gnoland stores the data on disk, not in memory like gnodev currently does. So we wanted to stress test adding one million posts. Full details are in the stress test PR. In short, gnoland performed well. Transaction times remained constant and memory usage was reasonable.

iuricmp commented 9 months ago

Exploring the Onboarding Experience

We have explored some approaches to onboard users on the GnoSocial dApp. After some discussions, we've decided to keep using the Faucet Strategy. Even though we know that strategy is not suitable for the Mainet launch, we agreed to keep with it since we don't have any other alternative for now. You can check out a quick demo about the Faucet Strategy here.

References: Jae Kwon - gno demo at 25:20 How do you solve the onboarding with gas fees, or even like social media with gas fees?

jefft0 commented 9 months ago

Contribution: p/demo/avlhelpers package and ListUsersByPrefix

In GnoSocial, we needed a utility to search the r/demo/users usernames by prefix. This is a useful tool for the avl.Tree, so after some discussion, we decided to make a new package p/demo/avlhelpers with a helper function ListKeysByPrefix. (In general, Gno devs are encouraged to write general packages.) Then the r/demo/users function ListUsersByPrefix simply calls it. https://github.com/gnolang/gno/pull/1708 (Merged)

jefft0 commented 8 months ago

Bug report: VM hangs during Render

While developing GnoSocial, we discovered a bug where the GnoVM hangs during the Render function. (This is in line with a goal of the GnoSocial project to stress test Gno.) Here is the PR with a txtar script which reproduces the error:

Here is the bug report (Reviewing). When there is a PR to implement the solution, we'll update this post.

jefft0 commented 8 months ago

Progress: Solutions for scalability

As we add features to GnoSocial we're exploring interesting solutions for scalability, as explained below.

iuricmp commented 7 months ago

Progress and Video: Mobile app interface improvements

Here's a short video that shows the UI/UX parts we're working on:

https://www.loom.com/share/621f151459b040b0a2e6a22adf96b371

costinberty commented 7 months ago

Announcement: Renaming of GnoSocial to dSocial

We started the GnoSocial project to experiment with ways to implement social media features in Gno.land. The idea was to see what would be the main challenges to implement social media functionality using this decentralized tech and test various approaches to this.

Some of the basic features are already here: create/delete account, post message and reply to message. And others are on the way: react to post, profile pic and hopefully more complex stuff like notifications or even integrations are cooking in the background.

Recently, to align with the Gno naming policy, we decided to rename the app from GnoSocial to dSocial. So, our new repo is https://github.com/gnolang/dsocial . For the record, we will leave "GnoSocial" in the previous posts and videos of this Journey, but from now on we will use dSocial everywhere.

Oh, and one more thing: we plan to bring the app to Test Flight and Google Play Console very soon. Access will be invite only so if you're interested in playing with it, let us know and we'll set you up with a test account.

D4ryl00 commented 6 months ago

Contribution and Video: Indexer services and Docker support

dSocial needs some services available online, e.g. gnodev, faucet, tx-indexer. To be able to deploy some Gno services on our Berty server, we contribute to add gnodev in the gno's Dockerfile: https://github.com/gnolang/gno/pull/2009 (closed to open a new PR) You can watch this video that shows how we manage the different services together with Docker: https://www.loom.com/share/5395c039c0b24118bee56ae5edd7a224?sid=30b17f0e-53ea-4f39-8f0e-1b8b3c150eee

jefft0 commented 6 months ago

Contribution: Regression test for importing "time" package

While working on dSocial, we discovered that it doesn't load with addpkg. An investigation showed that a recent PR to improve error checking on loading a package produces an error when importing the "time" package. We made a PR with a simple txtar test to show it, https://github.com/gnolang/gno/pull/2111 . This PR was merged as a regression test after the fix in https://github.com/gnolang/gno/pull/2105 was merged.

iuricmp commented 6 months ago

Demo testing available on TestFlight (iOS) and Google Play (Android)

Hi there. We are happy to share that the dSocial mobile App was released on Apple (TestFlight) and Android Play (Internal Test). As you may know, this app uses GnoNative npm SDK (@gnolang/gnonative) that makes building on mobile for Gno easy peasy. We also used the opportunity to create and improve many pieces on the backend side. You can check more details on our journey entries. If you want to try, please, send a dm with your email to me (Iuri) on Signal. Please say if you have an iPhone or Android phone.

costinberty commented 6 months ago

R&D Report: Scalability tests

Hi everyone,

We consolidated the scalability tests finds around avl.Tree resource consumption, tx time, gas limits and more. Check it out here https://github.com/gnolang/hackerspace/issues/67

costinberty commented 5 months ago

"What's on your mind?"

You can now tell us on dSocial. Create Account, Follow, Post, Repost, Reply to a Post features are here (Reply to a post is affected by a bug, but it will work again soon).

We are working to add "React to a post" and "Notifications" features.

Here's how you can test dSocial:

Oh, and don't forget that you will need funds to make transactions (posts, cat-posts, replies, etc.) so after you sign-up you'll have to click on "Onboard user" to receive gnots.

After that you'll be able to cat-post

jefft0 commented 4 months ago

Contribution: Demos of possible Keybase design issues

Since dSocial (and Gno Native Kit) use the Keybase API, we are interested in how the design of this API enforces bindings between a key address and a username. We identified possible design issues and opened PRs to demonstrate the issues. The PRs are a place to discuss the design and possible solutions.

costinberty commented 3 months ago

New features are now available on dSocial:

  1. ⁠Change your avatar profile image, storing the image on-chain by implementing the #2 approach of this proposal: https://github.com/gnolang/gno/issues/2598
  2. Account keys and usernames are now synchronised between the local keystore and r/demo/users on the blockchain. Registering usernames in r/demo/users is becoming increasingly important, including for realm code namespaces. And r/demo/users helps maintain account consistency across multiple apps and devices.
  3. ⁠We have a new log retrieval tool that will help with the debugging and share logs (looks pretty cool too).
  4. Better error catch on Android https://github.com/gnolang/gnonative/pull/158

If you haven't already, we super encourage you to try dSocial yourselves. All you need to do is

•⁠ ⁠iOS: follow the instructions of this link. You will need to install Testflight on your iPhone •⁠ ⁠Android: send your email address via Signal to our colleague Iuri, using this link: and you will receive install instructions.