github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/docs/gno-tooling/cli/faucet/faucet.md (about)

     1  ---
     2  id: running-a-faucet
     3  ---
     4  
     5  # Running a Faucet
     6  
     7  ## Overview
     8  
     9  In this tutorial, we will cover how to run a local native currency faucet that works seamlessly with a Gno node.
    10  Using the faucet, any address can get a hold of native currency funds in case they
    11  haven't [premined a balance beforehand](../../../getting-started/local-setup/premining-balances.md).
    12  
    13  ## Prerequisites
    14  
    15  - **`gnoland`, `gnofaucet` and `gnoweb` set up. Reference
    16    the [Installation](../../../getting-started/local-setup/local-setup.md#3-installing-other-gno-tools) guide for steps**
    17  
    18  ## 1. Ensure a topped-up faucet address
    19  
    20  The Gno faucet works by designating a single address as a faucet address that will distribute funds.
    21  
    22  Ensure the faucet account will have enough funds by [premining its balance](../../../getting-started/local-setup/premining-balances.md) to a high value.
    23  In case you do not have an existing address added to `gnokey`, you can consult
    24  the [Working with Key Pairs](../../../getting-started/local-setup/working-with-key-pairs.md) guide.
    25  
    26  ## 2. Start the local chain
    27  
    28  After ensuring the faucet address will have enough funds in the premine, we
    29  can [run the local blockchain node](../../../getting-started/local-setup/setting-up-a-local-chain.md).
    30  Navigate to the `gno.land` sub-folder and run the appropriate make command:
    31  
    32  ```bash
    33  cd gno.land
    34  gnoland start
    35  ```
    36  
    37  ## 3. Start the faucet
    38  
    39  After the chain is up and running locally, you can start the faucet by running the following command:
    40  
    41  ```bash
    42  gnofaucet serve --chain-id dev MyKey
    43  ```
    44  
    45  The command will prompt you to enter the decryption password for the key you've provided.
    46  
    47  - **`--chain-id`** - the chain ID of the local running node. The default value is `dev`
    48  - **`MyKey`** - the name of the faucet key (you can also use the address) we premined in
    49    the [previous steps](#1-ensure-a-topped-up-faucet-address)
    50  
    51  This will initialize the faucet to listen on port `5050`, by default.
    52  
    53  ![gnofaucet serve](../../../assets/getting-started/local-setup/setting-up-funds/gnofaucet-serve.gif)
    54  
    55  ## 4. Start the `gnoweb` interface
    56  
    57  To access the faucet UI, we need to start the local `gnoweb` interface.
    58  
    59  Navigate to the `gno.land` subfolder, and run the appropriate binary:
    60  
    61  ```bash
    62  cd gno.land
    63  gnoweb
    64  ```
    65  
    66  This will initialize the `gnoweb` interface on `http://127.0.0.1:8888`.
    67  
    68  ![gnoweb](../../../assets/getting-started/local-setup/setting-up-funds/gnoweb.gif)
    69  
    70  ## 5. Use the deployed faucet
    71  
    72  Once `gnoweb` has been started, you can navigate to http://127.0.0.1:8888/faucet.
    73  
    74  Simply input the desired address you wish to receive funds on (`1 GNOT` by default), and press the `GO` button.
    75  
    76  ![gnofaucet page](../../../assets/getting-started/local-setup/setting-up-funds/faucet-page.png)
    77  
    78  After you've added the address, you should see a success message in the browser:
    79  
    80  ```
    81  faucet success
    82  ```
    83  
    84  In the terminal where `gnofaucet` is running, you should see a success message as well, something along the lines of:
    85  
    86  ```bash
    87  will deliver: {"msg":[{"@type":"/bank.MsgSend","from_address":"g155n659f89cfak0zgy575yqma64sm4tv6exqk99","to_address":"g1qpymzwx4l4cy6cerdyajp9ksvjsf20rk5y9rtt","amount":"1000000ugnot"}],"fee":{"gas_wanted":"50000","gas_fee":"1000000ugnot"},"signatures":[{"pub_key":{"@type":"/tm.PubKeySecp256k1","value":"A10ufcOV5WP71K+KvLagJi+3TSCkx8EWKep3NbjVclU8"},"signature":"7Y0hkdPBruzMiANAHXWx3luAMhQN6SF3AQtstvOSZJI5P4uep8RIntw2c8W5blFiCd9HoMiEZFNf5dgWYwkjmA=="}],"memo":""}
    88  
    89  OK!
    90  GAS WANTED: 50000
    91  GAS USED:   41971
    92  127.0.0.1 faucet success
    93  ```
    94  
    95  ## Conclusion
    96  
    97  That's it 🎉
    98  
    99  You have successfully set up a GNOT faucet on a locally-running Gno chain!
   100  Additionally, you have also learned how to utilize the `gnoweb` tool for a visual faucet UI.