gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + gno.land: a blockchain for timeless code and fair open-source.
https://gno.land/
Other
896 stars 375 forks source link

Improve blockchain-less experience of Gnolang/GnoVM #972

Open moul opened 1 year ago

moul commented 1 year ago

Context

The goal is to improve tooling and documentation for an easier transition "from Go to Gno". This includes expanding the applications of Gno beyond chain execution and enabling experimentation with language features (refer to https://github.com/gnolang/hackerspace/issues/15). The proposed tool aims to become a versatile platform for experimenting with language features, including Go2 proposals.

Suggestions

  1. Enhance cmd/gno usage, specifically improving gno run for writing contracts. (#930)
  2. Introduce a compilation mechanism to generate executable units with gno build/install, incorporating contract code and gnovm.
  3. Improve gno to go functionality, either through enhancing gno precompile or introducing gno transpile. This allows Gno contracts to become importable libraries in Go code, leveraging Gno's language features. Consider organizing generated files in a more meaningful manner, such as a subfolder like ~/gno/gno2go/package....
  4. Design a developer-friendly approach for locally fetching on-chain contract state, potentially by generating Go code with an initialization function. Eliminate the need for internet dependencies in Go packages, granting local access to contract state.
  5. Enhance documentation, especially the getting started guides, to provide a comprehensive discovery experience without requiring localnet execution or testnet interaction.
  6. Explore the possibility of multiple parallel sandboxes, such as feature flags for experimental features, "recipes" of language features, or per pull-request playground deployment.
  7. Consider innovative approaches that are safe and explicit, such as a fuse/LD_PRELOAD hack to simulate Gno code as Go code automatically for unmodified Go tools (refer to https://github.com/gnolang/hackerspace/issues/5).

Implementing these ideas can isolate the gnolang/gnovm component from the blockchain aspect, enabling web2-focused presentations and discussions with low-level developers. It also promotes the project's independence, allowing blockchain engineers to focus solely on blockchain topics while treating more gnolang/gnovm as a standalone component.

PS: assigning myself to coordinate the initiative, but looking for help, please.

moul commented 1 year ago

Adding gno serve (https://github.com/gnolang/hackerspace/issues/23)

moul commented 1 year ago

In my opinion, there are two straightforward ideas:

  1. Create a blockchain-independent multiuser PoC by building a wrapper around VMKeeper. You can find more details here: https://github.com/gnolang/hackerspace/issues/16. This PoC could provide a HTTP API or a REPL over SSH.
  2. Develop a method to package a Gno contract into an executable file. This would involve embedding the Gno runtime and including an automatic flag to specify a custom location for auto-persisted data. With this approach, we can write CLI programs using versatile "gnolang".