Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Berty's GnoMobile / Gno Native Kit Builder Journey #28

Open
jefft0 opened this issue Aug 4, 2023 · 44 comments
Open

Berty's GnoMobile / Gno Native Kit Builder Journey #28

jefft0 opened this issue Aug 4, 2023 · 44 comments
Assignees

Comments

@jefft0
Copy link

jefft0 commented Aug 4, 2023

This documents the journey of Berty into Gno.land.

The two objectives of the first month of our Builder project are:

  1. Create a Proof of Concept of an existing Gno example app running on a mobile phone. This will prove that we can run Gno on a mobile (or identify issues that need further work). The PoC code will go into https://github.com/gnolang/gnomobile .

  2. Based on this experience to produce a detailed technical plan for further work to create a framework where developers can bring their Gno apps to mobile.

In this Journey, we will introduce our team, document our experience using Gno, track our issues and solutions, and keep meeting notes.

@moul
Copy link
Member

moul commented Aug 4, 2023

On our side:

On Berty's side:

  • grant PR on ecosystem-fund-grants
  • present themselves and participate during recurring calls
  • experiment with contracts, discover gno, open issues, make feedback
  • M0
  • M1

@jefft0
Copy link
Author

jefft0 commented Aug 9, 2023

Introducing our team

Rémi (@D4ryl00)

  • At Berty, he is the specialist in Wesh Network:
    • Development of the Bluetooth Low Energy (BLE) drivers
    • Improved overall stability of the app
    • Separated Wesh Network from Berty Messenger as a standalone library
  • My contribution to our Berty - Gno journey:
    • Get the Gno code running on mobile
    • Maintain our code contributions at GnoMobile

Jeff (@jefft0)

  • At Berty, working on
  • My contribution to our Berty - Gno journey:
    • Main contact point with Gno team
    • Documentation / issue maintenance
    • Tooling for stress testing

Fun fact: Was at RSA the company when A Cypherpunk’s Manifesto was published.

Iuri (@iuricmp)

  • At Berty, worked on:
    • UI/UX improvements and bug fixes for Berty Messenger and the Berty/Wesh Network websites
    • Wesh Mobile Package: created the initial setup of a React Native Expo library that exposes Wesh API on mobile
  • My contribution to our Berty - Gno journey:
    • Develop a mobile application to demonstrate the usage of Gno on mobile devices

@jefft0
Copy link
Author

jefft0 commented Aug 9, 2023

Onboarding experience with r/demo/boards

  • All of us (Remi, Jeff, Iuri) have created accounts and run the r/demo/boards quick start guide on our local computers.
  • Remi opened issue 1031 asking if all the READMEs should link to the quick start guide on GitHub instead of on the test net (which is outdated).
  • Based on our onboarding experience, Jeff opened PR 1034 to updated the quick start guide. Please see the PR description for details.
  • Iuri encountered the problem where you can't update the existing code of a realm. Of course many others have also found this counter-intuitive and there is an open issue. We look forward to a resolution to code versioning.

@jefft0
Copy link
Author

jefft0 commented Aug 9, 2023

Progress: Test node and code repo

  • Jeff set up a test node on a server at Berty with a public IP. We will use this in developing the app to interact with r/demo/boards on mobile.
  • Remi has opened an ongoing draft PR in the new GnoMobile repo. This will contain our code contribution for a framework to run Gno on mobile.

@jefft0
Copy link
Author

jefft0 commented Aug 10, 2023

Gno developer call: August 9

We (Remi, Jeff and Iuri) participated in our first developer call and introduced ourselves.

We explained that we're writing an app where we need to create a transaction by calling the Go code directly (not with the CLI). Manfred and Jae discussed plans for using the Tendermint 2 code as a "library", but not ready yet. Manfred said that, for now, we can use the same approach as other tools like:

@jefft0
Copy link
Author

jefft0 commented Aug 11, 2023

Progress: Demo videos

@jefft0
Copy link
Author

jefft0 commented Aug 16, 2023

Progress: Domain name for Berty testnet node

With Manfred's help on the DNS, we have a nice domain name for our Gno testnet node:
http://testnet.gno.berty.io

The help pages use this in the copy/paste text for the command:
http://testnet.gno.berty.io/r/demo/boards?help

@jefft0
Copy link
Author

jefft0 commented Aug 17, 2023

Progress: First GnoMobile demo video

Part of milestone M0 is a proof-of-concept for calling a Gno realm function from mobile (GnoMobile). Here is a demo video of the initial PoC app called GnoBoard which interacts with a Gno board.
https://www.loom.com/share/028f37f68b34425992baa2c77d0cf6b5

This demonstrates:

  • Gno wallet on mobile. This uses the keybase of a local directory like the command line tools.
  • Using existing Go code for Gno as an API. (For the moment, many private functions are copied as-is, but there will be an API.)
  • Interacting with the blockchain from mobile. (Can be configured to use testnet3, etc.)

The pull request mentioned is here: gnolang/gnonative#3
The message board on our testnet shown is here: http://testnet.gno.berty.io/r/demo/boards:gnomobile/1

@jefft0
Copy link
Author

jefft0 commented Aug 23, 2023

Meeting with Guilhem: gnoclient and gomobile dependencies

We had a meeting with Guilhem.

@jefft0
Copy link
Author

jefft0 commented Aug 25, 2023

Progress: Build dependencies, Android, estimating gas fees

Iuri continues to work on the UI for the "gnoboard" example app and will have some cool demos soon.

@jefft0
Copy link
Author

jefft0 commented Aug 30, 2023

Progress: Demo video: GnoMobile UI

https://www.loom.com/share/9537299635564761bc3a6d627411e33a
As mentioned, Iuri has put a user interface on our "gnoboard" example app. It works on Android and iOS. This gave us more experience of how the app code should interact with Gno, which we will detail in our proposal for the GnoMobile mobile app framework.

@jefft0
Copy link
Author

jefft0 commented Sep 5, 2023

Progress: Video: GnoMobile system diagram

We made a video to give a quick overview of GnoMobile using the system diagram from our project proposal. (This is useful background for our ongoing design questions.)
https://www.loom.com/share/8a991ae4395b448e8e5cdc1c6f250246

@jefft0
Copy link
Author

jefft0 commented Sep 6, 2023

Question: How to get the return value of the realm function call?

We are writing tests for the GnoMobile API. The basic operation is to Call a realm function. But it's not clear how to get the return value through the RPC call to the remote gnoland node. Here is the question issue:
gnolang/gno#1100

We quickly got a good answer from @zivkovicmilos . The return value of the realm RPC call is in DeliverTx.ResponseBase.Data with a custom stringified value like "(20 gno.land/r/demo/boards.PostID)" . There currently is no easy way for the client to unmarshal this into a useable object but this is a known issue (see "ABI Support for Realms"), so we will track that issue and related meta issue gnolang/gno#925 .

@jefft0
Copy link
Author

jefft0 commented Sep 8, 2023

GnoMobile, a Gno Framework for Mobile. Implementation Plan

As the culminating step of milestone M0, we submitted our proposal for the GnoMobile framework implementation plan which we will do during M1. If you have comments, let us know on the issue.
gnolang/gnonative#15

@jefft0
Copy link
Author

jefft0 commented Sep 11, 2023

Question: Design of gnoclient API

Our proof-of-concept app has a working version of the gnoclient Client API. The near-term goal is to complete the original PR. We have posted a question which came up when we wrote this code, so that we can discuss with the Gno devs.
gnolang/gno#1047 (comment)

@jefft0
Copy link
Author

jefft0 commented Sep 13, 2023

Gno developer call: Sept. 13

We presented the completion of milestone M0 and discussed our plans for GnoMobile in M1. We discussed some of the design issues we're working on:

  • Continuing work on the gnoclient PR feat: add gno.land/pkg/gnoclient (Gno.land Go client) gno#1047
  • The browser (JavaScript) apps like gnochess connect to the blockchain using WebSocket but the CLI (calling from Go) uses HTTP. We need to investigate whether connecting from Go can or should use WebSocket since this seems to be a preferred default. Also @zivkovicmilos said "If you plan to send out lots of requests, almost at the same time, it would be better to consider doing a WebSocket connection with JSON-RPC batching."
  • A wanted GnoMobile feature is to support fetching an account's transaction history from the blockchain. (The mobile is constrained an can't sync all the blockchain transactions locally.) Suggested solutions from the devs:
    • Jon: Utilize the Gnoscan API for history as a block explorer though it wouldn't be decentralized since it'd be relying on 3rd party service.
    • Milos: We are working on an indexer service you can run on your own so you don't have to rely on Gnoscan or any other service.
    • Ray: Check out the Cosmos SDK light client. You can use it to verify the history on the mobile wallet.
    • @moul: Maybe support just fetching the last 10 transactions starting from the latest block. Even if you use an external server, Gno.land's built-in Merkel tree hashes could make verification easier.

@jefft0
Copy link
Author

jefft0 commented Sep 20, 2023

Question: How can amino include doc comments?

We are making progress with using amino so that our gRPC types are defined in Go structs. But when amino creates the protobuf file, the doc comments are lost. See the issue for details. We may be able to contribute code to amino to help support doc comments.
gnolang/gno#1157

@jefft0
Copy link
Author

jefft0 commented Sep 21, 2023

Question: How can amino preserve enum definitions?

Related to the previous question, we opened an issue we came across where the Protofuf output from amino doesn't preserve the names of enum constants. As mentioned, both issues may have a similar solution with parsing the AST of the original Go code. For further discussion.
gnolang/gno#1161

@jefft0
Copy link
Author

jefft0 commented Sep 21, 2023

Progress: Demo video: GnoMobile gRPC and amino

https://www.loom.com/share/52f6fc51a60a432896a50639ac5e6cce
This video shows progress for implementing the gRPC interface on iOS and Android, and with defining the interface with Go structs using amino.

@jefft0
Copy link
Author

jefft0 commented Sep 25, 2023

Trip report: Barcelona Web3 conference

On Friday and Saturday I (Jeff) went to the Web3 Family Conference in Barcelona.
https://web3fc.xyz

  • The main attraction was the presentation of Gno.land by Milos. It's the only talk I saw about smart contracts and a new layer 1 chain. (Except for Ignite which is about new Cosmos layer 1 chains, most talks seemed to assume that Ethereum is the only game in town.) It was an excellent presentation. Still, I think that half an hour is not enough to give the Gno.land vision and have people take away that it is doing something really new.
  • Another treat was the demo of Ignite by Danilo. During the presentation he created a new Cosmos chain with custom transactions very similar to the Gno.land message board example. This came before Milos's presentation and for me it was a good contrast of the difference between custom functions built in to the node vs. smart contracts.
  • I'm new to the blockchain world, so other presentations gave me a better feel for the general state of projects in the "crypto winter". Like Manfred has mentioned, some welcomed the focus on web3 capabilities instead of cryptocoin speculation.
  • Finally, a group of us including Milos and Danilo had a nice lunch in sunny Barcelona.

@jefft0
Copy link
Author

jefft0 commented Sep 27, 2023

Progress: Using the gnoclient API

We have merged pull request gnolang/gnonative#22 where GnoMobile uses a local copy of the gnoclient API. The code is copied from gnolang/gno#1047 which will be merged into the Gno codebase so that any app can use Gno as an SDK. (When it is merged, GnoMobile will easily switch to using the "official" version.) The example app is now working with this code.

Next steps are to make all the gnoclient functionality useable from the GnoClient API, to add wallet support in the example app, and to implement gRPC directly for React Native which is explained in this issue:
gnolang/gnonative#20

@jefft0
Copy link
Author

jefft0 commented Oct 4, 2023

Progress: Demo video: GnoMobile wallet UI

https://www.loom.com/share/c0f68f707d3e47089c2fdbd2698fc92f
This video show the example app using the wallet functions to create and restore accounts, and discusses next steps.

@jefft0
Copy link
Author

jefft0 commented Oct 5, 2023

Progress: Merged GnoMobile wallet UI code

We have merged pull request gnolang/gnonative#18 which has the code for the wallet UI shown in the demo video above. In addition to the new screens for wallet functions, this pull request fixes issues with the Makefile for React Native and gRPC. We can now proceed quickly with the next steps mentioned in the video.

@jefft0
Copy link
Author

jefft0 commented Oct 9, 2023

Gno Contribution: Amino to use snake case for Protobuf field names

As explained in issue gnolang/gno#1211, Amino should use lower_snake_case for Protobuf field names. We submitted PR gnolang/gno#1213 to fix this. This PR is merged.

On todays developer call, we also discussed Amino-related issues gnolang/gno#1157 for doc comments and gnolang/gno#1161 for enums. We now have a way forward to implement doc comments and will do a PR soon.

@jefft0
Copy link
Author

jefft0 commented Oct 11, 2023

Gno Contribution: Amino to copy doc comments to the Protobuf file

As explained in issue gnolang/gno#1157, Amino should optionally support copying doc comments from the Go struct to the Protobuf file output. We submitted PR gnolang/gno#1235 to add WithComments which is optionally used when making the Package object. The PR includes a Go test for this. This PR is merged.

@jefft0
Copy link
Author

jefft0 commented Oct 16, 2023

Progress: Temporary gno fork, Amino support

As mentioned, we have a few pull requests for Gno. But we need to let the devs take their time to review. Therefore, we made a fork where we will cherry pick the pull request commits into branch with-gno-PRs . This allows GnoMobile to use a replace command in go.mod to temporarily use this fork (which we did in PR gnolang/gnonative#46).

Now that we have the Amino functionality, the Protobuf field names produced by Amino are lower_snake_case, and comments from the Go struct are included, as in this example. This also allows a doc comment for enumerated values.

@jefft0
Copy link
Author

jefft0 commented Oct 24, 2023

Progress in setting up Buf documentation

We opened an issue to track progress in setting up a GnoMobile web page at the Buf documentation registry. gnolang/gnonative#53 . The organization account has been created and now we need to get permissions to create a new repository. Once this is done, we will move forward with making sure that the GnoMobile API documentation looks good.

@jefft0
Copy link
Author

jefft0 commented Oct 26, 2023

Gno Contribution: Improve error handling in HTTP client

The Gno HTTP client is used in many places, including GnoMobile, to sign transactions and communicate with the blockchain. There is code to return the specific error ErrWrongPassword if the transaction cannot be signed because of a bad (or missing) password. As explained in our pull request gnolang/gno#1289, there were some bugs in properly returning this specific error and checking for it. Thanks to the Gno devs, this bug fix has been merged.

Why is this important? GnoMobile is a toolkit API. Part of a good API design is clear error handling. When an application uses GnoMobile to call a remote blockchain function, the API should return a clear error if the password is wrong (or missing) so that the application can prompt the user to fix the problem. Next we will update the GnoMobile example app to use this and we'll make a demo video.

(Today we also submitted a little pull request gnolang/gno#1301 so that make test passes. Thanks for the quick review and merge!)

@jefft0
Copy link
Author

jefft0 commented Oct 27, 2023

Progress: Demo video: New GnoMobile wallet UI functions, gRPC streaming

We have made a lot of progress in the example app for wallet functions. Remi has also implemented returning a stream object from a gRPC method. Details are in the video:
https://www.loom.com/share/d1cef60199c0487e86deab2a9e61d61c

Next: A few more wallet UI functions, and to make use of gRPC streaming.

@jefft0
Copy link
Author

jefft0 commented Oct 31, 2023

Progress: In Keybase, add HasByName, etc.

Support for HasByName

In GnoMobile, when a user wants to create an account, we need to check if the local Keybase already has an account with the same name. As explained in our new PR gnolang/gno#1313, the Keybase already has GetByName which either copies and returns all the key info, or returns an error. We created the PR because we need support for the simpler HasByName which just checks if an account with the name exists. We have already added support for this to our fork of gno, and added it to the GnoMobile gRPC interface, along with support for the related HasByAddress and HasByNameOrAddress. This PR is merged.

GetByAddress error handling

The GnoMobile API needs consistent error handling, so we submitted a smaller pull request gnolang/gno#1316 so that GetByAddress returns the same error keyerror.NewErrKeyNotFound as returned by GetByName. This PR is merged.

Checking for valid password

Finally, when the app prompts the user for the password, we want the GnoMobile method SetPassword to check if it is valid. As explained in issue gnolang/gno#1324, we implement the password check by trying to sign a blank transaction. This works and we are moving forward, but the issue asks for feedback if this is a good solution.

@jefft0
Copy link
Author

jefft0 commented Nov 10, 2023

Progress: Buf documentation web page

The gRPC interface uses Protobuf where methods and message objects have doc comments. This is a great place to document the API. We have set up the GnoMobile Buf web page for this documentation. We will continue to add more including details for error codes and how the methods interact.

@jefft0
Copy link
Author

jefft0 commented Nov 15, 2023

Gno developer call: November 15

  • GnoSocial: @costinberty presented our plans for GnoSocial and we had a short discussion on how it relates to GnoMobile (and upcoming renaming).
  • Typed errors: There is an existing issue for a realm to return well-defined error types. We added a comment because the GnoMobile gRPC interface needs to convert realm error types to Protobuf enums (as we do with other errors). @thehowl mentioned that this is related to a need to simplify the way that the realm transaction response represents Go types. Also that the planned pubsub service can be used by the client to get a delayed realm success return value as well as specific error info, including a panic stack trace. GnoMobile should definitely use this when available.
  • Air-gapped transaction signing: Currently, the GnoMobile API to call a realm function signs and sends the transaction in one step, using a gnoclient function. But the gnokey command line supports signing a transaction separately from sending it over the internet. This supports the signing computer to be air gapped from the internet. Onbloc's Adena wallet now has support for air-gapped signing. On the developer call we discussed now GnoMobile can support this. @moul plans to update the underlying gnoclient interface with some ideas of how to support calling a realm function using a transaction that is already signed.

@jefft0
Copy link
Author

jefft0 commented Nov 20, 2023

Gno contribution: Improve error message and docs for using test3.gno.land

Jeff was having trouble using gnokey to call a realm function on test3.gno.land. On a call with @moul we fixed it. (In short, Jeff was using the wrong chain ID.) The result is two PRs to clarify error messages and documentation:

@jefft0
Copy link
Author

jefft0 commented Nov 23, 2023

Gno contribution: Updates to gnoclient

As mentioned in a previous post, there is a PR to add the gnoclient interface to the Gno codebase. In GnoMobile, we added some extra functionality. To submit those changes to gnoclient we created PR moul/gno#18 . Among other changes, this addresses the question of how to validate a password that we described in issue gnolang/gno#1324 . This has been merged.

@jefft0
Copy link
Author

jefft0 commented Nov 24, 2023

Progress: Demo video: Call event stream

Demo the support for gRPC stream when calling a realm function. Discuss how we're waiting for the Gno.land functionality for the endpoint to return status events, and better error types from realm functions.
https://www.loom.com/share/42f2dcb0b4a34f77a95a0f8012e4b52b

@jefft0
Copy link
Author

jefft0 commented Nov 27, 2023

Progress: Demo Video: Minimal app "Hello Gno"

In this video, Iuri demonstrates a minimal GnoMobile example app which was made by the new make new-app functionality. This is how you (developer) can start your GnoMobile project to communicate with the Gno blockchain.
https://www.loom.com/share/41a20a764f0f4caf91f068b62e1f16c4

@jefft0
Copy link
Author

jefft0 commented Dec 1, 2023

Progess: Demo Video: Minimal command-line example in Go

Remi has implemented a minimal gRPC server and client in Go. This lets us make simple GnoMobile command-line example apps in Go which don't have all the GUI code of a full React Native app. Here is a short demo video of goserver and goclient.
https://www.loom.com/share/093ae52b222d474ba4e75ecd8abed90e

@jefft0
Copy link
Author

jefft0 commented Dec 6, 2023

Demo Video: Comparing GnoMobile with tm2-JS

In this short video we compare the features of GnoMobile with tm2-JS, which is another framework for building Gno apps. using this comparison, the video explains why GnoMobile was created and why a dev might choose to use it. This also shows why we want to rename the framework because it's useful for more than making mobile apps.
https://www.loom.com/share/bff0a21d330b4e44a62d32383130ffed

@jefft0 jefft0 changed the title Berty's Builder Journey Berty's GnoMobile Builder Journey Dec 11, 2023
@jefft0
Copy link
Author

jefft0 commented Dec 11, 2023

Announcement: Renaming to Gno Native Kit

We started the GnoMobile project to demonstrate that we can use Gno.land on mobile, by bridging the native code of the app to the core Go code. During this journey we discovered that this toolkit has other uses beyond mobile (highlighted in the demo of the previous post). With helpful feedback from the Gno team, we have renamed this project to Gno Native Kit. This is short for "A toolkit to use the core Gno code from your app's native programming language".

  • For the record, we will leave "GnoMobile" in the previous posts and videos of this Journey. But think "Gno Native Kit" when you see "GnoMobile".
  • The GitHub repository is renamed to https://github.com/gnolang/gnonative . Links with the old name should magically redirect.

@jefft0
Copy link
Author

jefft0 commented Dec 25, 2023

Video: Fireside chat with Jeff

In Johnny B's continuing series of fireside chats, here is an hour-long chat with Jeff. It includes the origins of Berty, Gno Native Kit and reasons for renaming, plus future plans with Gno Social.
https://www.youtube.com/watch?v=XSuJJStU2X0

@jefft0
Copy link
Author

jefft0 commented Jan 4, 2024

Our journey continues...

Our journey into Gno.land continues with dSocial.

@D4ryl00
Copy link

D4ryl00 commented Feb 22, 2024

Securing gRPC channel communication

The communication between the React-Native gRPC client and the backend server used an encrypted TCP connection. When a gRPC server listens to a local TCP port, any program on your system can use it to communicate also with the server and impersonate or spy you.
To offer private communications, we decided to use a Unix Domain Socket (UDS) instead of a TCP connection. Because UDS is only available for the current process, other applications cannot use it.
This is now implemented in the PR gnolang/gnonative#113

@jefft0
Copy link
Author

jefft0 commented Mar 14, 2024

Gno Native Kit video series: Episode One: Overview

Here is the first in a series of videos presenting Gno Native Kit. https://www.youtube.com/watch?v=N1HLyQDHGQ0

@jefft0 jefft0 changed the title Berty's GnoMobile Builder Journey Berty's GnoMobile / Gno Native Kit Builder Journey Mar 15, 2024
@jefft0
Copy link
Author

jefft0 commented Apr 17, 2024

Gno Native Kit video series: Episode Two: System Diagram

Be sure the check out our second in a series of videos presenting Gno Native Kit.
https://www.youtube.com/watch?v=5s-6GFzivBQ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

4 participants