Skip to content

Commit

Permalink
docs: add infra section intro (gnolang#2212)
Browse files Browse the repository at this point in the history
<!-- please provide a detailed description of the changes made in this
pull request. -->

## Description

This PR adds the Gno Infra section to the docs. It moves "Setting up a
local chain" & "Premining balances" to this new section. It also updates
the tutorial prerequisites to match the current state of the docs.

Matching docs repo PR: gnolang/docs.gno.land#38

<details><summary>Contributors' checklist...</summary>

- [x] Added new tests, or not needed, or not feasible
- [x] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [x] Updated the official documentation or not needed
- [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [x] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>
  • Loading branch information
leohhhn authored and omarsy committed Jun 3, 2024
1 parent 8fe7bf3 commit f8c2d49
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 30 deletions.
9 changes: 9 additions & 0 deletions docs/gno-infrastructure/gno-infrastructure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
id: gno-infrastructure
---

# Gno Infrastructure

Welcome to the **Gno Infrastructure** section. This section is meant for users
wanting to learn how to run their own Gno node, set up their own faucet, run
an indexer service, and more.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ Additionally, you will understand how to query the account balance after you pre
Premining balance is the process of making sure some accounts (addresses) have specific funds when the chain initially
launches. In the context of local chain deployments, premine balances are used to ensure the user accounts (developers)
have ample funds to interact with the chain and facilitate contract deployments.

## Prerequisites

- **`gnoland` and `gnokey` set up. Reference the [Installation](local-setup.md#3-installing-other-gno-tools) guide
- **`gnoland` set up. Reference the [Setting up a local chain](setting-up-a-local-chain.md#installation) guide for steps**
- **`gnokey` set up. Reference the [Installation](../getting-started/local-setup/installation.md#2-installing-the-required-tools-) guide
for steps**

## 1. Clean chain data
Expand Down Expand Up @@ -51,56 +52,37 @@ An example of how this looks like in the initial `genesis.json` file after the c
"g127jydsh6cms3lrtdenydxsckh23a8d6emqcvfa=1000000000000ugnot"
],
```
The `genesis_balances.txt` file is located at `./gno.land/genesis/genesis_balances.txt`.
To add a new entry to the premine table, simply append a line to the end of the file:
```bash
g1qpymzwx4l4cy6cerdyajp9ksvjsf20rk5y9rtt=10000000000ugnot # My address
```
Replace `g1qpymzwx4l4cy6cerdyajp9ksvjsf20rk5y9rtt` with the address you want balance on, and `10000000000ugnot` with the
desired `ugnot` balance.
## 3. Start the local chain
Now that our address and the desired premine balance are located in the `genesis_balances.txt` file, we can start the
local Gno node.
To run the local Gno node, make sure you are in the `gno.land` sub-folder, and run the appropriate make command:
```bash
cd gno.land
gnoland start
```
This command will initialize the Gno node, generate the `genesis.json` with our newly added premine information, and
start the chain.
![gnoland start](../../assets/getting-started/local-setup/setting-up-funds/gnoland-start.gif)
![gnoland start](../assets/getting-started/local-setup/setting-up-funds/gnoland-start.gif)
## 3. Check the account balance
To check the balance of any account (or the account we just premined), we can use the following ABCI query:
```bash
gnokey query --remote localhost:26657 bank/balances/g1qpymzwx4l4cy6cerdyajp9ksvjsf20rk5y9rtt
```
Let's break down this command:
- **`--remote`** - the JSON-RPC URL of the running Gno node. In the case of a local deployment, the default value
is `localhost:26657`
- **`bank/balances/g1qpymzwx4l4cy6cerdyajp9ksvjsf20rk5y9rtt`** - the ABCI query targets the `bank` module to find
the `balances` for address `g1qpymzwx4l4cy6cerdyajp9ksvjsf20rk5y9rtt`. Replace the address with your desired address
![gnokey query](../../assets/getting-started/local-setup/setting-up-funds/gnokey-query.gif)
![gnokey query](../assets/getting-started/local-setup/setting-up-funds/gnokey-query.gif)
## Conclusion
That's it 🎉
You have successfully premined a native currency balance on a locally-running Gno chain!
Additionally, you have also learned how to query the native currency balance for an address, using built-in ABCI queries
and the `gnokey` tool.
and the `gnokey` tool.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,58 @@ In this tutorial, you will learn how to start a local Gno node (and chain!).
Additionally, you will see the different options you can use to make your Gno instance unique.

## Prerequisites
- **Git**
- **`make` (for running Makefiles)**
- **Go 1.21+**
- **Go Environment Setup**: Ensure you have Go set up as outlined in the [Go official installation documentation](https://go.dev/doc/install) for your environment

- [`gnoland` installed](local-setup.md#3-installing-other-gno-tools).
## Installation

To install the `gnoland` binary, clone the Gno monorepo:

```bash
git clone https://github.com/gnolang/gno.git
```

After cloning the repo, go into the `gno.land/` folder, and use the existing
Makefile to install the `gnoland` binary:

```bash
cd gno.land
make install.gnoland
```

To verify that you've installed the binary properly and that you are able to use
it, run the `gnoland` command:

```bash
gnoland --help
```

If everything was successful, you should get the following output:

```bash
❯ gnoland
USAGE
<subcommand> [flags] [<arg>...]

starts the gnoland blockchain node.

SUBCOMMANDS
start run the full node
secrets gno secrets manipulation suite
config gno config manipulation suite
genesis gno genesis manipulation suite
```

If you do not wish to install the binary globally, you can build and run it
with the following command from the `gno.land/` folder:

```bash
make build.gnoland
```

And finally, run it with `./build gnoland`.

## Starting a local node (lazy init)

Expand All @@ -25,7 +75,7 @@ gnoland start --lazy
The command will trigger a chain initialization process (if you haven't run the node before), and start the Gno node,
which is ready to accept transactions and interact with other Gno nodes.

![gnoland start](../../assets/getting-started/local-setup/setting-up-a-local-chain/gnoland-start.gif)
![gnoland start](../assets/getting-started/local-setup/setting-up-a-local-chain/gnoland-start.gif)

:::info Lazy init

Expand Down Expand Up @@ -271,7 +321,7 @@ That's it! 🎉
Your new Gno node (chain) should be up and running:
![gnoland start](../../assets/getting-started/local-setup/setting-up-a-local-chain/gnoland-start-manual.gif)
![gnoland start](../assets/getting-started/local-setup/setting-up-a-local-chain/gnoland-start-manual.gif)
## Chain runtime options
Expand Down
6 changes: 3 additions & 3 deletions docs/gno-tooling/cli/faucet/faucet.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ id: running-a-faucet

In this tutorial, we will cover how to run a local native currency faucet that works seamlessly with a Gno node.
Using the faucet, any address can get a hold of native currency funds in case they
haven't [premined a balance beforehand](../../../getting-started/local-setup/premining-balances.md).
haven't [premined a balance beforehand](../../../gno-infrastructure/premining-balances.md).

## Prerequisites

Expand All @@ -19,14 +19,14 @@ haven't [premined a balance beforehand](../../../getting-started/local-setup/pre

The Gno faucet works by designating a single address as a faucet address that will distribute funds.

Ensure the faucet account will have enough funds by [premining its balance](../../../getting-started/local-setup/premining-balances.md) to a high value.
Ensure the faucet account will have enough funds by [premining its balance](../../../gno-infrastructure/premining-balances.md) to a high value.
In case you do not have an existing address added to `gnokey`, you can consult
the [Working with Key Pairs](../../../getting-started/local-setup/working-with-key-pairs.md) guide.

## 2. Start the local chain

After ensuring the faucet address will have enough funds in the premine, we
can [run the local blockchain node](../../../getting-started/local-setup/setting-up-a-local-chain.md).
can [run the local blockchain node](../../../gno-infrastructure/setting-up-a-local-chain.md).
Navigate to the `gno.land` sub-folder and run the appropriate make command:

```bash
Expand Down

0 comments on commit f8c2d49

Please sign in to comment.