github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/docs/getting-started/local-setup/interacting-with-gnoland.md (about)

     1  ---
     2  id: interacting-with-gnoland
     3  ---
     4  
     5  # Interacting with Gno.land code
     6  
     7  ## Overview
     8  In this tutorial, you will learn how to interact with Gno.land code.
     9  You will understand how to use your keypair to send transactions to realms
    10  and packages, send native coins, and more.
    11  
    12  ## Prerequisites
    13  - **`gnokey` installed.** Reference the
    14  [Local Setup](installation.md#3-installing-other-gno-tools) guide for steps
    15  - **A keypair in `gnokey`.** Reference the 
    16  [Working with Key Pairs](working-with-key-pairs.md#adding-a-private-key-using-a-mnemonic) guide for steps
    17  
    18  ## 1. Get testnet GNOTs
    19  For interacting with any Gno.land chain, you will need a certain amount of GNOTs
    20  to pay gas fees with. 
    21  
    22  For this example, we will use the [Portal Loop](../../concepts/testnets.md#portal-loop) 
    23  testnet. We can access the Portal Loop faucet through the
    24  [Gno Faucet Hub](https://faucet.gno.land), or by accessing the faucet directly at
    25  [gno.land/faucet](https://gno.land/faucet). 
    26  
    27  ![faucet-hub](../../assets/getting-started/local-setup/interacting-with-gnoland/faucet-hub.png)
    28  
    29  After choosing "Gno Portal Loop", you will get a prompt to input your address, 
    30  select the amount of testnet GNOT you want to receive, and solve a captcha:
    31  
    32  ![faucet-hub-portal-loop](../../assets/getting-started/local-setup/interacting-with-gnoland/faucet-hub-portal-loop.png)
    33  
    34  After inputting your address and solving the captcha, you can check if you have received funds with the
    35  following `gnokey` command:
    36  
    37  ```bash
    38  gnokey query bank/balances/<your_gno_address> --remote "https://rpc.gno.land:443"    
    39  ```
    40  
    41  If the faucet request was successful, you should see something similar to the 
    42  following:
    43  
    44  ```
    45  ❯ gnokey query bank/balances/<your_gno_address> --remote "https://rpc.gno.land:443"
    46  height: 0
    47  data: "10000000ugnot"
    48  ```
    49  
    50  ## 2. Visit a realm
    51  For this example, we will use the [Userbook realm](https://gno.land/r/demo/userbook).
    52  The Userbook realm is a simple app that allows users to sign up, and keeps track
    53  of when they signed up. It also displays the currently signed-up users and the block
    54  height at which they have signed up.
    55  
    56  ![userbook-default](../../assets/getting-started/local-setup/interacting-with-gnoland/userbook-default.png)
    57  
    58  > Note: block heights are not correct because of the way the Portal Loop testnet 
    59  > works.
    60  > Read more [here](../../concepts/portal-loop.md). 
    61  
    62  To see what functions are available to call on the Userbook realm, click
    63  the `[help]` button. 
    64  
    65  ![userbook-help](../../assets/getting-started/local-setup/interacting-with-gnoland/userbook-help.png)
    66  
    67  By choosing one of the two `gnokey` commands and inputting your address 
    68  (or keypair name) in the top bar, you will have a ready command to paste into your 
    69  terminal. For example, the following command will call the `SignUp` function with the
    70  keypair `MyKeypair`: 
    71  
    72  ```
    73  gnokey maketx call \
    74  -pkgpath "gno.land/r/demo/userbook" \
    75  -func "SignUp" \
    76  -gas-fee 1000000ugnot \
    77  -gas-wanted 2000000 \
    78  -send "" \
    79  -broadcast \
    80  -chainid "portal-loop" \
    81  -remote "https://rpc.gno.land:443" \
    82  MyKeypair
    83  ```
    84  
    85  To see what each option and flag in this command does, read the `gnokey` 
    86  [reference page](../../gno-tooling/cli/gnokey.md). 
    87  
    88  ## Conclusion
    89  
    90  That's it! Congratulations on executing your first transaction on a Gno network! 🎉
    91  
    92  If the previous transaction was successful, you should be able
    93  to see your address on the main page of the Userbook realm. 
    94  
    95  This concludes the "Local Setup" tutorial. For next steps, see the 
    96  [How-to guides section](../../how-to-guides/how-to-guides.md), where you will 
    97  learn how to write your first realm, package, and much more.