github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/docs/concepts/gno-language.md (about)

     1  ---
     2  id: gno-language
     3  ---
     4  
     5  # The Gno Language
     6  
     7  Gno (Gnolang) is an interpretation of the widely-used Go (Golang) programming language for blockchain created by Cosmos
     8  co-founder Jae Kwon in 2021 to mark a new era in smart contracting. Gno is almost identical to Go, so Go developers can
     9  quickly start using it, with minimal effort. For example, Gno comes with blockchain-specific standard libraries, but any
    10  code that doesn’t use blockchain-specific logic can run in Go with minimal processing. Libraries that could lead to
    11  non-deterministic behaviour when executed by thousands of validators are not available in Gno, such as network access,
    12  or determining system time. Otherwise, Gno loads and uses many standard libraries that power Go, so the experience
    13  writing code feels very similar to Go's.
    14  
    15  Under the hood, the Gno code is parsed into an abstract syntax tree (AST) and the AST itself is used in the interpreter,
    16  rather than bytecode as in many virtual machines such as Java, Python, or Wasm. The design aims to make reading &
    17  understanding the source code of the GnoVM accessible to any Go programmer. The novel design of the intuitive GnoVM
    18  interpreter allows Gno to freeze and resume the program by persisting and loading the memory state automatically. Gno is
    19  deterministic, auto-persisted, and auto-Merkle-ized, allowing programs to be succinct, as the programmer doesn’t have to
    20  serialize and deserialize objects to persist them into a database (unlike programming applications with the Cosmos SDK).
    21  
    22  ## How Gno Differs from Go
    23  
    24  The composable nature of Go/Gno allows for type-checked interactions between contracts, making Gno.land safer and more
    25  powerful, as well as operationally cheaper and faster. Smart contracts on Gno.land are light, simple, more focused, and
    26  easily interoperable - they represent a network of interconnected contracts rather than siloed monoliths that limit
    27  interactions with other contracts.
    28  
    29  ## Gno Inherits Go’s Built-in Security Features
    30  
    31  Go supports secure programming through exported/non-exported fields, enabling a “least-authority” design. It is easy to
    32  create objects and APIs that expose only what should be accessible to callers while hiding what should not be simply by
    33  the capitalization of letters, thus allowing a succinct representation of secure logic that can be called by multiple
    34  users.
    35  
    36  Another major advantage of Go is that the language comes with an ecosystem of great tooling, like the compiler and
    37  third-party tools that statically analyze code. Gno inherits these advantages from Go directly to create a smart
    38  contract programming language that provides embedding, composability, type-check safety, and garbage collection, helping
    39  developers to write secure code relying on the compiler, parser, and interpreter to give warning alerts for common
    40  mistakes.
    41  
    42  ## Gno vs Solidity
    43  
    44  The most widely-adopted smart contract language today is Ethereum’s EVM-compatible Solidity. With bytecode built from
    45  the ground up and Turing complete, Solidity opened up a world of possibilities for decentralized applications (dApps)
    46  and there are currently more than 10 million contracts deployed on Ethereum. However, Solidity provides limited tooling
    47  and its EVM has a stack limit and computational inefficiencies.
    48  
    49  Solidity is designed for one purpose only (writing smart contracts) and is bound by the limitations of the EVM. In
    50  addition, developers have to learn several languages if they want to understand the whole stack or work across different
    51  ecosystems. Gno aspires to exceed Solidity on multiple fronts (and other smart contract languages like CosmWasm or
    52  Substrate) as every part of the stack is written in Go (or Gno!). It’s easy for developers to understand the entire system just
    53  by studying a relatively small code base.
    54  
    55  ## Gno Is Essential for the Wider Adoption of Web3
    56  
    57  Gno makes imports as easy as they are in web2 with runtime-based imports for seamless dependency flow comprehension, and
    58  support for complex structs, beyond primitive types. Gno is ultimately cost-effective as dependencies are loaded once,
    59  enabling remote function calls as local, and providing automatic and independent per-realm state persistence.
    60  
    61  Using Gno, developers can rapidly accelerate application development and adopt a modular structure by reusing and
    62  reassembling existing modules without building from scratch. They can embed one structure inside another in an intuitive
    63  way while preserving localism, and the language specification is simple, successfully balancing practicality and
    64  minimalism.
    65  
    66  Building on top of the excellent design of Go, the aim for Gno programming is to become the new gold standard for smart
    67  contract development, not just in our ecosystem but blockchain as a whole. Combining Go's large success, together with
    68  type safety and composability, Gno aims to kickstart a broader adoption of Web3 and its growth.