Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gnolang/gno into dev/morgan/porta…
Browse files Browse the repository at this point in the history
…l-loop-timestamps
  • Loading branch information
thehowl committed Sep 12, 2024
2 parents 55a8d4a + aa4bc99 commit ed68afa
Show file tree
Hide file tree
Showing 65 changed files with 2,071 additions and 827 deletions.
77 changes: 77 additions & 0 deletions docs/getting-started/local-setup/creating-a-keypair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
id: creating-a-keypair
---

# Creating a Keypair

## Overview

In this tutorial, you will learn how to create your Gno keypair using
[`gnokey`](../../gno-tooling/cli/gnokey/gnokey.md).

Keypairs are the foundation of how users interact with blockchains; and Gno is
no exception. By using a 12-word or 24-word [mnemonic phrase](https://www.zimperium.com/glossary/mnemonic-seed/)
as a source of randomness, users can derive a private and a public key.
These two keys can then be used further; a public key derives an address which is
a unique identifier of a user on the blockchain, while a private key is used for
signing messages and transactions for the aforementioned address, proving a user
has ownership over it.

Let's see how we can use `gnokey` to generate a Gno keypair locally.

## Generating a keypair

The `gnokey add` command allows you to generate a new keypair locally. Simply
run the command, while adding a name for your keypair:

```bash
gnokey add MyKey
```

![gnokey-add-random](../../assets/getting-started/local-setup/creating-a-key-pair/gnokey-add-random.gif)

After running the command, `gnokey` will ask you to enter a password that will be
used to encrypt your keypair to the disk. Then, it will show you the following
information:
- Your public key, as well as the Gno address derived from it, starting with `g1...`,
- Your randomly generated 12-word mnemonic phrase which was used to derive the keypair.

:::warning Safeguard your mnemonic phrase!

A **mnemonic phrase** is like your master password; you can use it over and over
to derive the same keypairs. This is why it is crucial to store it in a safe,
offline place - writing the phrase on a piece of paper and hiding it is highly
recommended. **If it gets lost, it is unrecoverable.**

:::

`gnokey` will generate a keybase in which it will store information about your
keypairs. The keybase directory path is stored under the `-home` flag in `gnokey`.

### Gno addresses

Your **Gno address** is like your unique identifier on the network; an address
is visible in the caller stack of an application, it is included in each
transaction you create with your keypair, and anyone who knows your address can
send you [coins](../../concepts/stdlibs/coin.md), etc.

## Conclusion

That's it 🎉

You've successfully created your first Gno keypair. Check out
[Browsing gno.land](./browsing-gnoland.md) and
[Interacting with gno.land](./interacting-with-gnoland.md) to see how you can
use it.

If you wish to learn more about `gnokey` specifically, check out the
[gnokey section](../../gno-tooling/cli/gnokey/gnokey.md).









6 changes: 3 additions & 3 deletions docs/getting-started/local-setup/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ git clone https://github.com/gnolang/gno.git
There are three tools that should be used for getting started with Gno development:
- `gno` - the GnoVM binary
- `gnodev` - the Gno [development helper](../../gno-tooling/cli/gnodev.md)
- `gnokey` - the Gno [keypair manager](working-with-key-pairs.md)
- `gnokey` - the Gno [keypair manager](../../gno-tooling/cli/gnokey/working-with-key-pairs.md)

To install all three tools, simply run the following in the root of the repo:
```bash
Expand Down Expand Up @@ -87,7 +87,7 @@ You should get the following output:

`gnokey` is the gno.land keypair management CLI tool. It allows you to create
keypairs, sign transactions, and broadcast them to gno.land chains. Read more
about `gnokey` [here](../../gno-tooling/cli/gnokey.md).
about `gnokey` [here](../../gno-tooling/cli/gnokey/gnokey.md).

To verify that the `gnokey` binary is installed system-wide, you can run:

Expand All @@ -106,5 +106,5 @@ That's it 🎉
You have successfully built out and installed the necessary tools for Gno
development!

In further documents, you will gain a better understanding on how they are used
In further documents, you will gain a better understanding of how they are used
to make Gno work.
26 changes: 13 additions & 13 deletions docs/getting-started/local-setup/interacting-with-gnoland.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,18 @@ You will understand how to use your keypair to send transactions to realms
and packages, send native coins, and more.

## Prerequisites

- **`gnokey` installed.** Reference the
[Local Setup](installation.md#3-installing-other-gno-tools) guide for steps
- **A keypair in `gnokey`.** Reference the
[Working with Key Pairs](working-with-key-pairs.md#adding-a-private-key-using-a-mnemonic) guide for steps
[Local Setup](installation.md) guide for steps
- **A keypair in `gnokey`.** Reference the [Creating a key pair](creating-a-keypair.md) guide for steps

## 1. Get testnet GNOTs
For interacting with any gno.land chain, you will need a certain amount of GNOTs
to pay gas fees with.

For this example, we will use the [Portal Loop](../../concepts/testnets.md#portal-loop)
testnet. We can access the Portal Loop faucet through the
[Gno Faucet Hub](https://faucet.gno.land), or by accessing the faucet directly at
[gno.land/faucet](https://gno.land/faucet).
[Gno Faucet Hub](https://faucet.gno.land).

![faucet-hub](../../assets/getting-started/local-setup/interacting-with-gnoland/faucet-hub.png)

Expand All @@ -35,7 +34,7 @@ After inputting your address and solving the captcha, you can check if you have
following `gnokey` command:

```bash
gnokey query bank/balances/<your_gno_address> --remote "https://rpc.gno.land:443"
gnokey query bank/balances/<your_gno_address> --remote "https://rpc.gno.land:443"
```

If the faucet request was successful, you should see something similar to the
Expand All @@ -48,15 +47,16 @@ data: "10000000ugnot"
```

## 2. Visit a realm

For this example, we will use the [Userbook realm](https://gno.land/r/demo/userbook).
The Userbook realm is a simple app that allows users to sign up, and keeps track
of when they signed up. It also displays the currently signed-up users and the block
height at which they have signed up.

![userbook-default](../../assets/getting-started/local-setup/interacting-with-gnoland/userbook-default.png)

> Note: block heights are not correct because of the way the Portal Loop testnet
> works.
> Note: block heights in this case are unreliable because of the way the Portal Loop
> network works.
> Read more [here](../../concepts/portal-loop.md).
To see what functions are available to call on the Userbook realm, click
Expand All @@ -67,7 +67,7 @@ the `[help]` button.
By choosing one of the two `gnokey` commands and inputting your address
(or keypair name) in the top bar, you will have a ready command to paste into your
terminal. For example, the following command will call the `SignUp` function with the
keypair `MyKeypair`:
keypair `MyKey`:

```
gnokey maketx call \
Expand All @@ -79,11 +79,11 @@ gnokey maketx call \
-broadcast \
-chainid "portal-loop" \
-remote "https://rpc.gno.land:443" \
MyKeypair
MyKey
```

To see what each option and flag in this command does, read the `gnokey`
[reference page](../../gno-tooling/cli/gnokey.md).
To see what each option and flag in this command does, check out `gnokey` in the
[tooling section](../../gno-tooling/cli/gnokey/gnokey.md).

## Conclusion

Expand All @@ -92,6 +92,6 @@ That's it! Congratulations on executing your first transaction on a Gno network!
If the previous transaction was successful, you should be able
to see your address on the main page of the Userbook realm.

This concludes the "Local Setup" tutorial. For next steps, see the
This concludes the "Local Setup" section. For next steps, see the
[How-to guides section](../../how-to-guides/how-to-guides.md), where you will
learn how to write your first realm, package, and much more.
2 changes: 1 addition & 1 deletion docs/gno-tooling/cli/faucet/faucet.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The Gno faucet works by designating a single address as a faucet address that wi
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.
the [Working with Key Pairs](../gnokey/working-with-key-pairs.md) guide.

## 2. Start the local chain

Expand Down
Loading

0 comments on commit ed68afa

Please sign in to comment.