[Why Gno?] A Deep Dive into Gno

Gnoswap
10 min readAug 4, 2023

Co-authors

Peter Yoon (@whitebitcoin8)
Andrew Kang (@adr_sk_)

A special thanks to the Gno.land core team for a thorough, helpful review.

This article is Episode 3 of Why Gno?, a series featuring a deep dive into Gno.land, the most performant smart contract platform powered by Gnolang, and Gnoswap, an innovative concentrated liquidity DEX aspiring to become the liquidity hub of Gno.land.

[Why Gno?]

Episode 1: Tracing the History of Crypto

Episode 2: Hello World, Meet Gno.land

TL:DR;

  1. To truly understand the design choices behind Gno.land, we need to take a step back and dig into the roots of the foundation it builds upon, which points to Go, a universally-popular programming language.
  2. Each component of Gno.land reflects its developer-centric design, from its language selection to consensus.
  3. This article will dive deep into the technicalities of Gno.land and discover how its philosophy and structure synergize with and inherit the unique traits of Go.

Why Go?

Designed at Google in 2007 by Rob Pike, Ken Thompson, and Robert Griesemer (who previously spearheaded UTF-8, UNIX and Plan 9), Go is one of the fastest-growing programming languages of the last decades. It boasts a vast developer pool of 2.1 million (Source: Turing) and its market share is still actively growing. This is a fact that has been proven by the market based on its increasing interest and adoption. The data speaks for itself:

Interest in Golang over time | Source: Google Trends
Number of PRs on GitHub in JS, Golang, and Rust | Source: GitHut
2023 Developer Survey | Source: Stackoverflow

So, what makes Go so popular?

Simplicity
Go is made to be simple. Period. In fact, the very reason why Go was built in the first place was that its creators at Google were frustrated by the complexity of traditional languages such as C, C++, and Java, commonly used for software development at Google. Go is easy to read and write thanks to its clear syntax, and has a smooth learning curve, having only 25 keywords, as opposed to 50 in Java and 82 in C++.

Safety
Go is a statically typed language, meaning that each declared variable is associated with a type. The type-safety of Go makes it easier to catch bugs at compile-time, rather than run-time.

Automatic Resource Management
Go’s garbage collection makes memory management easier and safer for large-scale programs.

Robust Standard Library
The standard library is “batteries-included” with many battle-tested packages providing functionality from math and encryption to concurrency and HTTP servers. You don’t need to rely and vet hundreds of third party libraries when building complex applications.

Fast Compilation
One of the key problems that Google was trying to solve with Go was the dreadfully long build time that took up to hours in compiling several millions of lines of software in traditional languages such as C++, Java, and Python. Fun fact, myths say that the idea of Go was born during one of these hour-long builds at Google.

Go reduces the compile time up to x50 compared to other languages, turning “coffee breaks into interactive builds”. There are multiple factors behind this phenomenal efficiency, but one of the main reasons is a simplified dependency management system between source files, which reduces the need for re-compilation of many source files, allowing a single “go build” instruction to compile a tenth of the source files of comparable languages. If you’re interested in digging deeper into this topic, we recommend this article by Rob Pike.

Built-in Concurrency
Goroutines and channels
are built-in functions of Go that allow programmers to write programs that can efficiently handle multiple tasks simultaneously. Goroutines can be started by simply adding the keyword go as a prefix to the desired function, eliminating the need for designing complex multi-threads. Once multiple goroutines are operational, thread-safe communication of data in-between is handled using channels.

In a nutshell, Go is a language that’s meant to enhance the productivity and accessibility of programming for developers.

Jae Kwon, the founder of Gno.land, recognized the potential of Go back in 2015 and has chosen it as the language to build Tendermint, which has blossomed into an industry-leading consensus engine and given birth to a vibrant interchain ecosystem known as Cosmos.

The effectiveness of building distributed systems with Go has already been proven with not only the Cosmos stack, but also with software that host a huge part of today’s internet infrastructure such as kubernetes, docker, and IPFS.

What we now need for mass adoption of web3 is a way to seamlessly onboard a wave of developers that can build applications for the next millions of users. Harnessing the power of Go, Gno.land will be the first blockchain to make web3 development indistinguishable from web2, becoming the last piece of the puzzle.

This is only the beginning of Gno.land’s developer-centric approach.

Developers, developers, developers

Source: Youtube

Proof of Contribution (PoC) is the consensus mechanism of Gno.land that makes it the most attractive platform for serious developers to build on. Let us explain why.

What is PoC?
PoC is a quantified-reputation-based system governed by members of the Contributors DAO, a decentralized entity gated by non-transferable tokens called $GSHARE (or ^worx — exact name TBD) that can only be earned by submitting verifiable, transparent contributions that mostly involves technical aspects to the Gno.land project. The Contributors DAO plays a key role in the network, having the power to change the parameter configs of the chain and configure the Validator set.

A high-level schema of Proof of Contribution | Source: Gno.land

Build once, earn forever.
PoC not only endows developers with a voice but also a sustainable source of revenue. As illustrated in the high-level schema above, transaction fees paid in $GNOT, the utility token of Gno.land, are collected by Tendermint2 and sent to a bucket managed by a contract that automatically distributes the fees across contributors, proportional to the amount of $GSHAREs held. $GSHAREs are perpetual, meaning that it provides developers with a lifetime reward that scales with the ecosystem.

For the case of smart contract developers that are focused on building dapps, Gno.land is exploring a new monetization scheme that involves a gas fee rebate mechanism. By adding additional logic to the fee distribution contract that pays a portion of the gas fees used for interacting with contracts to their respective authors, developers who build widely-used dapps will directly benefit from the activity they bring to the chain.

Altogether, these systems introduce a paradigm shift that hands the reins from capitalists to developers, and for the first time in the history of blockchains, deviates from game theory and economics to create a social consensus that values expertise and commitment over capital.

Go, but why Gno?

The entire Gno.land stack, piece by piece, is built with Go — a testament to the deep alignment between the philosophies of the two. But there’s a catch — Gno.land offers a new language called Gnolang for writing smart contracts.

The rationale behind creating a new language specifically for writing smart contracts is clear: partial aspects of languages meant to write web2 applications collide with certain traits of blockchains. Let’s uncover what this means by breaking down the notable features of Gnolang.

Minimal Abstraction
First and foremost, it is important to understand that Gnolang has been created with minimal abstraction from Go, meaning that if you know Go, you already know Gnolang. This is a unique feature that makes Gno.land stand out from other smart contract platforms that also support Go, but require additional knowledge and specific practices to write contracts in Go.

“Gno is a well-known, new language.”

- Manfred Touron, VP of Engineering at Gno.land

Deterministic
For code to run on a blockchain, it must be deterministic, meaning that running the code on the chain’s VM must return the same results at all times. In Gnolang, all non-deterministic features such as the ones that relate to internet access in the net package have been removed to ensure that determinism is ensured at the language level.

Succinct
State of smart contracts are automatically persisted, which greatly improves the succinctness of the code.

Interpreted
Unlike Go, Gnolang is an interpreted language, meaning that smart contracts are not compiled, but instead parsed into the AST, which is then interpreted by the VM for execution. This trait plays an important factor in the next point.

Transparent
All smart contracts are uploaded to the chain in raw code. This forces all smart contracts to be open source by default, which is contrary to other blockchains where users must rely on 3rd-party tools to verify contracts by comparing the compiled opcode of the code in question to that of the smart contract on the blockchain.

Intuitive and Simple
Contract addresses on Gno.land called “Package Paths” are configurable and readable unlike those of other blockchains that are obscure and impossible to memorize due to their randomness.

This leads us to our final question: “Why would developers choose Gnolang & Gno.land to build smart contracts over EVM & Solidity, the dominant ecosystem in the DeFi market by 95% of total value locked in terms of protocols that are built on?”

TVL Dominance by Language | Source: DeFiLlama

Solidity was able to secure its paramount market share as the first language to write smart contracts, with support for rich tooling and infrastructure. Despite its front-runner advantage, the inefficiencies of Solidity as a language leave Gnolang well-positioned for an opportunity to overthrow its dominance.

The table above show that Gnolang surpasses Solidity in many aspects.

Although Rust is another strong competitor that suits the purpose as a scalable smart contract language, its high learning curve leaves it undesirable for the masses. As seen in the TVL Dominance by Language graph above, despite modern blockchains choosing Rust as the smart contract language of choice, it is failing to gain adoption due to its complexity, with less than 1% of the total market share.

When the next wave of developers comes rushing in to look for an opportunity to start a career in the promising web3 industry, they will need a platform that’s simple, productive, and performant, and Gnolang will be their obvious choice.

Reaching Beyond the Horizon

These are merely the status quo of what has already been built. There is much more beyond the horizon that’s to be delivered on Gno.land, as its builders are set to challenge unsolved problems of the industry that will open up new possibilities of what can be built with smart contracts.

The Web3 GitHub
The long-term goal of Gno.land is to become a “hub” as in GitHub, for smart contracts. As of today, Gno.land is the only blockchain where developers can actually read the underlying code of smart contracts directly from the blockchain. With the transparency secured by the GnoVM and interchain contract import functionality powered by IBCx, Gno.land will position itself as the web3 GitHub, home to best-in-class open-source smart contracts.

Concurrent, Yet Deterministic
Keeping concurrently-running programs deterministic is a huge challenge. It is yet a much-needed feature for designing a future-proof blockchain that can fully leverage multi-core to seamlessly support large-scale dapps that will be built to onboard millions of users. As Gnolang inherits the properties of Go, it can support Goroutines and Channels for concurrency, provided that non-determinism is solved. Active research and development are being done by the core team for this topic, and once implemented, Gno.land will offer unmatched performance seen in no other platforms.

Upgradable Smart Contracts
The process of upgrading smart contracts is a pain point that both developers and users experience across all blockchains. Imagine each update on X (FKA Twitter) required a manual migration of the massive user data (“state of a contract” in the context of blockchains). The maintenance and expansion of large-scale applications are heavily constrained by this limitation. Experiments are underway on Gno.land to minimize these complexities and inefficiencies. You can find or contribute to ongoing explorations in this directory on the gno repository.

Opening the Floodgates to Web3 Development
The market for decentralized applications is growing exponentially, yet the industry is lacking a platform that talented developers would want to start building on, that’s attractive enough to leave behind all their experience and merits of web2. Much like Go was created to streamline web2 development, Gnolang was created to streamline web3 development, taking productivity and accessibility to the next level. Gno.land’s mission is clear and simple: build the most sustainable ecosystem of developers, by developers, for developers. Go is the perfect tool for execution.

Despite many having failed to complete the blockchains that they have promised, Jae has yet again proven his passion and competence in building decentralized systems by successfully delivering Gnolang and Tendermint2. We’re excited to become a part of his journey of solving the hardest problems in web3 and are committed to investing all of our resources to make it a success.

Appendix

Here are some key terminologies, including the ones that were already covered above, that you MUST know to become a Gnolang developer.

  • Gnolang: The smart contract language of Gno.land. Interpreted Go with built-in determinism.
  • GnoVM: The virtual machine that parses Gnolang into an AST and then interprets it for contract execution.
  • Pure Packages: Stateless libraries on Gno.land.
  • Realms: Smart contracts (or dapps) on Gno.land with state persistence.
  • Proof of Contribution (PoC): The consensus mechanism of Gno.land, which is an extended, decentralized take on Proof of Authority. Contributions to the project are measured in quantifiable units and distributed as non-transferable points, which represent the ownership of the chain, unlocking access to governance and revenue sharing. This unique system places Gno.land as one of the most resistant networks against attempts of financial takeovers.
  • Tendermint2: The consensus engine of Gno.land. A minimal, complete fork of the most secure, battle-tested version of Tendermint.
  • GnoSDK: A framework for building appchains with GnoVm and TM2.

--

--

Gnoswap

Gnoswap is the first open-source AMM Dex built by Onbloc using #Gnolang to offer a simplified concentrated-LP experience for increased capital efficiency.