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

     1  ---
     2  id: realms
     3  ---
     4  
     5  # Realms
     6  
     7  A realm refers to a specific instance of a smart contract that can be written
     8  in [Gno](./gno-language.md). The potentials of realms are endless - you can create virtually any
     9  application in your mind with built-in composability,
    10  transparency, and censorship resistance. Here are some ideas of what you can build with realms:
    11  
    12  * Self-custodial financial exchanges (decentralized exchanges).
    13  * Lending platforms with better rates.
    14  * Transparent insurance systems.
    15  * Fair and accessible voting systems.
    16  * Logistics and supply chain networks.
    17  
    18  ## Packages vs Realms
    19  
    20  #### [**Pure Packages**](https://github.com/gnolang/gno/tree/master/examples/gno.land/p)
    21  
    22  * A unit that contains functionalities and utilities that can be used in realms.
    23  * Packages are stateless.
    24  * The default import path is `gno.land/p/~~~`.
    25  * Can be imported to other realms or packages.
    26  * Cannot import realms.
    27  
    28  #### [**Realms**](https://github.com/gnolang/gno/tree/master/examples/gno.land/r)
    29  
    30  * Smart contracts in Gno.
    31  * Realms are stateful.
    32  * Realms can own assets (tokens).
    33  * The default import path is `gno.land/r/~~~`.
    34  * Realms can implement `Render(path string) string` to simplify dapp frontend development by allowing users to request
    35    markdown renderings from validators and full nodes without a transaction.
    36  
    37  A notable feature of realms is the `Render()` function.
    38  
    39  ```go
    40  package demo
    41  
    42  func Render(path string) string {
    43  	return "# Hello Gno!"
    44  }
    45  ```
    46  
    47  Upon calling the realm above, `# Hello Gno!` is printed with a string-typed `path` declared in an argument. It should be
    48  noted that while the `path` argument included in the sample code is not utilized, it serves the purpose of
    49  distinguishing the path during the rendering process.