diff --git a/docs/getting-started/local-setup/creating-a-keypair.md b/docs/getting-started/local-setup/creating-a-keypair.md new file mode 100644 index 00000000000..983d732a0fd --- /dev/null +++ b/docs/getting-started/local-setup/creating-a-keypair.md @@ -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). + + + + + + + + + diff --git a/docs/getting-started/local-setup/installation.md b/docs/getting-started/local-setup/installation.md index 58f71f93026..272d0069ee5 100644 --- a/docs/getting-started/local-setup/installation.md +++ b/docs/getting-started/local-setup/installation.md @@ -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 @@ -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: @@ -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. diff --git a/docs/getting-started/local-setup/interacting-with-gnoland.md b/docs/getting-started/local-setup/interacting-with-gnoland.md index e07c839d691..6b4b8213228 100644 --- a/docs/getting-started/local-setup/interacting-with-gnoland.md +++ b/docs/getting-started/local-setup/interacting-with-gnoland.md @@ -10,10 +10,10 @@ 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 @@ -21,8 +21,7 @@ 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) @@ -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/ --remote "https://rpc.gno.land:443" +gnokey query bank/balances/ --remote "https://rpc.gno.land:443" ``` If the faucet request was successful, you should see something similar to the @@ -48,6 +47,7 @@ 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 @@ -55,8 +55,8 @@ 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 @@ -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 \ @@ -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 @@ -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. diff --git a/docs/gno-tooling/cli/faucet/faucet.md b/docs/gno-tooling/cli/faucet/faucet.md index 4d32f86e9ef..b069a19740a 100644 --- a/docs/gno-tooling/cli/faucet/faucet.md +++ b/docs/gno-tooling/cli/faucet/faucet.md @@ -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 diff --git a/docs/gno-tooling/cli/gnokey.md b/docs/gno-tooling/cli/gnokey.md deleted file mode 100644 index bf110faec5f..00000000000 --- a/docs/gno-tooling/cli/gnokey.md +++ /dev/null @@ -1,323 +0,0 @@ ---- -id: gno-tooling-gnokey ---- - -# gnokey - -Used for account & key management and general interactions with the Gnoland blockchain. - -## Generate a New Seed Phrase - -Generate a new seed phrase and add it to your keybase with the following command. - -```bash -gnokey generate -``` - -## Add a New Key - -You can add a new private key to the keybase using the following command. - -```bash -gnokey add {KEY_NAME} -``` - -#### **Options** - -| Name | Type | Description | -|-------------|------------|----------------------------------------------------------------------------------------| -| `account` | UInt | Account number for HD derivation. | -| `dryrun` | Boolean | Performs action, but doesn't add key to local keystore. | -| `index` | UInt | Address index number for HD derivation. | -| `ledger` | Boolean | Stores a local reference to a private key on a Ledger device. | -| `multisig` | String \[] | Constructs and stores a multisig public key (implies `--pubkey`). | -| `nobackup` | Boolean | Doesn't print out seed phrase (if others are watching the terminal). | -| `nosort` | Boolean | Keys passed to `--multisig` are taken in the order they're supplied. | -| `pubkey` | String | Parses a public key in bech32 format and save it to disk. | -| `recover` | Boolean | Provides seed phrase to recover existing key instead of creating. | -| `threshold` | Int | K out of N required signatures. For use in conjunction with --multisig (default: `1`). | - -> **Test Seed Phrase:** source bonus chronic canvas draft south burst lottery vacant surface solve popular case indicate oppose farm nothing bullet exhibit title speed wink action roast - -### Using a ledger device - -You can add a ledger device using the following command - -> [!NOTE] -> Before running this command make sure your ledger device is connected, with the cosmos app installed and open in it. - -```bash -gnokey add {LEDGER_KEY_NAME} --ledger -``` - -## List all Known Keys - -List all keys stored in your keybase with the following command. - -```bash -gnokey list -``` - -## Delete a Key - -Delete a key from your keybase with the following command. - -```bash -gnokey delete {KEY_NAME} -``` - -#### **Options** - -| Name | Type | Description | -|---------|---------|------------------------------| -| `yes` | Boolean | Skips confirmation prompt. | -| `force` | Boolean | Removes key unconditionally. | - - -## Export a Private Key (Encrypted & Unencrypted) - -Export a private key's (encrypted or unencrypted) armor using the following command. - -```bash -gnokey export -``` - -#### **Options** - -| Name | Type | Description | -|---------------|--------|---------------------------------------------| -| `key` | String | Name or Bech32 address of the private key | -| `output-path` | String | The desired output path for the armor file | -| `unsafe` | Bool | Export the private key armor as unencrypted | - - -## Import a Private Key (Encrypted & Unencrypted) - -Import a private key's (encrypted or unencrypted) armor with the following command. - -```bash -gnokey import -``` - -#### **Options** - -| Name | Type | Description | -|--------------|--------|---------------------------------------------| -| `armor-path` | String | The path to the encrypted armor file. | -| `name` | String | The name of the private key. | -| `unsafe` | Bool | Import the private key armor as unencrypted | - - -## Make an ABCI Query - -Make an ABCI Query with the following command. - -```bash -gnokey query {QUERY_PATH} -``` - -#### **Query** - -| Query Path | Description | Example | -|---------------------------|--------------------------------------------------------------------|----------------------------------------------------------------------------------------| -| `auth/accounts/{ADDRESS}` | Returns information about an account. | `gnokey query auth/accounts/g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` | -| `bank/balances/{ADDRESS}` | Returns balances of an account. | `gnokey query bank/balances/g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` | -| `vm/qfuncs` | Returns public facing function signatures as JSON. | `gnokey query vm/qfuncs --data "gno.land/r/demo/boards"` | -| `vm/qfile` | Returns the file bytes, or list of files if directory. | `gnokey query vm/qfile --data "gno.land/r/demo/boards"` | -| `vm/qrender` | Calls .Render(path) in readonly mode. | `gnokey query vm/qrender --data "gno.land/r/demo/boards:"` | -| `vm/qeval` | Evaluates any expression in readonly mode and returns the results. | `gnokey query vm/qeval --data "gno.land/r/demo/boards.GetBoardIDFromName("my_board")"` | -| `vm/store` | (not yet supported) Fetches items from the store. | - | -| `vm/package` | (not yet supported) Fetches a package's files. | - | - -#### **Options** - -| Name | Type | Description | -|----------|-----------|------------------------------------------| -| `data` | UInt8 \[] | Queries data bytes. | - - -## Sign and Broadcast a Transaction - -You can sign and broadcast a transaction with the following command. - -```bash -gnokey maketx {SUB_COMMAND} {ADDRESS or KeyName} -``` - -#### **Subcommands** - -| Name | Description | -|----------|------------------------------| -| `addpkg` | Uploads a new package. | -| `call` | Calls a public function. | -| `send` | The amount of coins to send. | - -### `addpkg` - -This subcommand lets you upload a new package. - -```bash -gnokey maketx addpkg \ - -deposit="1ugnot" \ - -gas-fee="1ugnot" \ - -gas-wanted="5000000" \ - -pkgpath={Registered Realm path} \ - -pkgdir={Package folder path} \ - {ADDRESS} \ - > unsigned.tx -``` - -#### **SignBroadcast Options** - -| Name | Type | Description | -|--------------|---------|----------------------------------------------------------------------------------------| -| `gas-wanted` | Int64 | The maximum amount of gas to use for the transaction. | -| `gas-fee` | String | The gas fee to pay for the transaction. | -| `memo` | String | Any descriptive text. | -| `broadcast` | Boolean | Broadcasts the transaction. | -| `chainid` | String | The chainid to sign for (should only be used with `--broadcast`) | -| `simulate` | String | One of `test` (default), `skip` or `only` (should only be used with `--broadcast`)[^1] | - -#### **makeTx AddPackage Options** - -| Name | Type | Description | -|-----------|--------|---------------------------------------| -| `pkgpath` | String | The package path (required). | -| `pkgdir` | String | The path to package files (required). | -| `deposit` | String | The amount of coins to send. | - -### `call` - -This subcommand lets you call any exported function. - -```bash -# Register -gnokey maketx call \ - -gas-fee="1ugnot" \ - -gas-wanted="5000000" \ - -pkgpath="gno.land/r/demo/users" \ - -send="200000000ugnot" \ - -func="Register" \ - -args="" \ - -args={NAME} \ - -args="" \ - {ADDRESS} \ - > unsigned.tx -``` - -:::warning `call` is a state-changing message - -All exported functions, including `Render()`, can be called in two main ways: -`call` and [`query vm/qeval`](#query). - -With `call`, any state change that happened in the function being called will be -applied and persisted in on the blockchain, and the gas used for this call will -be subtracted from the caller balance. - -As opposed to this, an ABCI query, such as `vm/qeval` will not persist state -changes and does not cost gas, only evaluating the expression in read-only mode. - -::: - -#### **SignBroadcast Options** - -| Name | Type | Description | -|--------------|---------|----------------------------------------------------------------------------------------| -| `gas-wanted` | Int64 | The maximum amount of gas to use for the transaction. | -| `gas-fee` | String | The gas fee to pay for the transaction. | -| `memo` | String | Any descriptive text. | -| `broadcast` | Boolean | Broadcasts the transaction. | -| `chainid` | String | The chainid to sign for (should only be used with `--broadcast`) | -| `simulate` | String | One of `test` (default), `skip` or `only` (should only be used with `--broadcast`)[^1] | - -#### **makeTx Call Options** - -| Name | Type | Description | -|-----------|--------|------------------------------------------------------------------------------------------------------------------------------------------------------| -| `send` | String | The amount of coins to send. | -| `pkgpath` | String | The package path (required). | -| `func` | String | The contract to call (required). | -| `args` | String | An argument of the function being called. Can be used multiple times in a single `call` command to accommodate possible multiple function arguments. | - -:::info -Currently, only primitive types are supported as `-args` parameters. This limitation will be addressed in the future. -Alternatively, see how `maketx run` works. -::: - -### `send` - -This subcommand lets you send a native currency to an address. - -```bash -gnokey maketx send \ - -gas-fee="1ugnot" \ - -gas-wanted="5000000" \ - -send={SEND_AMOUNT} \ - -to={TO_ADDRESS} \ - {ADDRESS} \ - > unsigned.tx -``` - -#### **SignBroadcast Options** - -| Name | Type | Description | -|--------------|---------|----------------------------------------------------------------------------------------| -| `gas-wanted` | Int64 | The maximum amount of gas to use for the transaction. | -| `gas-fee` | String | The gas fee to pay for the transaction. | -| `memo` | String | Any descriptive text. | -| `broadcast` | Boolean | Broadcasts the transaction. | -| `chainid` | String | The chainid to sign for (should only be used with `--broadcast`) | -| `simulate` | String | One of `test` (default), `skip` or `only` (should only be used with `--broadcast`)[^1] | - -#### **makeTx Send Options** - -| Name | Type | Description | -|--------|--------|--------------------------| -| `send` | String | Amount of coins to send. | -| `to` | String | The destination address. | - - -## Sign a Document - -Sign a document with the following command. - -```bash -gnokey sign -``` - -#### **Options** - -| Name | Type | Description | -|------------------|---------|------------------------------------------------------------| -| `txpath` | String | The path to file of tx to sign (default: `-`). | -| `chainid` | String | The chainid to sign for (default: `dev`). | -| `number` | UInt | The account number of the account to sign with (required) | -| `sequence` | UInt | The sequence number of the account to sign with (required) | -| `show-signbytes` | Boolean | Shows signature bytes. | - - -## Verify a Document Signature - -Verify a document signature with the following command. - -```bash -gnokey verify -``` - -#### **Options** - -| Name | Type | Description | -|-----------|--------|------------------------------------------| -| `docpath` | String | The path of the document file to verify. | - -## Broadcast a Signed Document - -Broadcast a signed document with the following command. - -```bash -gnokey broadcast {signed transaction file document} -``` - -[^1]: `only` simulates the transaction as a "dry run" (ie. without committing to - the chain), `test` performs simulation and, if successful, commits the - transaction, `skip` skips simulation entirely and commits directly. diff --git a/docs/gno-tooling/cli/gnokey/full-security-tx.md b/docs/gno-tooling/cli/gnokey/full-security-tx.md new file mode 100644 index 00000000000..bccddb30b8a --- /dev/null +++ b/docs/gno-tooling/cli/gnokey/full-security-tx.md @@ -0,0 +1,134 @@ +--- +id: full-security-tx +--- + +# Making an airgapped transaction + +## Prerequisites + +- **`gnokey` installed.** Reference the + [Local Setup](../../../getting-started/local-setup/installation.md#2-installing-the-required-tools) guide for steps + +## Overview + +`gnokey` provides a way to create a transaction, sign it, and later +broadcast it to a chain in the most secure fashion. This approach, while more +complicated than the standard approach shown [in a previous tutorial](./state-changing-calls.md), +grants full control and provides [airgap](https://en.wikipedia.org/wiki/Air_gap_(networking)) +support. + +By separating the signing and the broadcasting steps of submitting a transaction, +users can make sure that the signing happens in a secure, offline environment, +keeping private keys away from possible exposure to attacks coming from the +internet. + +The intended purpose of this functionality is to provide maximum security when +signing and broadcasting a transaction. In practice, this procedure should take +place on two separate machines controlled by the holder of the keys, one with +access to the internet (`Machine A`), and the other one without (`Machine B`), +with the separation of steps as follows: +1. `Machine A`: Fetch account information from the chain +2. `Machine B`: Create an unsigned transaction locally +3. `Machine B`: Sign the transaction +4. `Machine A`: Broadcast the transaction + +## 1. Fetching account information from the chain + +First, we need to fetch data for the account we are using to sign the transaction, +using the [auth/accounts](./querying-a-network.md#authaccounts) query: + +```bash +gnokey query auth/accounts/ -remote "https://rpc.gno.land:443" +``` + +We need to extract the account number and sequence from the output: + +```bash +height: 0 +data: { + "BaseAccount": { + "address": "g1zzqd6phlfx0a809vhmykg5c6m44ap9756s7cjj", + "coins": "10000000ugnot", + "public_key": null, + "account_number": "468", + "sequence": "0" + } +} +``` + +In this case, the account number is `468`, and the sequence (nonce) is `0`. We +will need these values to sign the transaction later. These pieces of information +are crucial during the signing process, as they are included in the signature +of the transaction, preventing replay attacks. + +## 2. Creating an unsigned transaction locally + +To create the transaction you want, you can use the [`call` API](./state-changing-calls.md#call), +without the `-broadcast` flag, while redirecting the output to a local file: + +```bash +gnokey maketx call \ +-pkgpath "gno.land/r/demo/userbook" \ +-func "SignUp" \ +-gas-fee 1000000ugnot \ +-gas-wanted 2000000 \ +mykey > userbook.tx +``` + +This will create a `userbook.tx` file with a null `signature` field. +Now we are ready to sign the transaction. + +## 3. Signing the transaction + +To add a signature to the transaction, we can use the `gnokey sign` subcommand. +To sign, we must set the correct flags for the subcommand: +- `-tx-path` - path to the transaction file to sign, in our case, `userbook.tx` +- `-chainid` - id of the chain to sign for +- `-account-number` - number of the account fetched previously +- `-account-sequence` - sequence of the account fetched previously + +```bash +gnokey sign \ +-tx-path userbook.tx \ +-chainid "portal-loop" \ +-account-number 468 \ +-account-sequence 0 \ +mykey +``` + +After inputting the correct values, `gnokey` will ask for the password to decrypt +the keypair. Once we input the password, we should receive the message that the +signing was completed. If we open the `userbook.tx` file, we will be able to see +that the signature field has been populated. + +We are now ready to broadcast this transaction to the chain. + +## 4. Broadcasting the transaction + +To broadcast the signed transaction to the chain, we can use the `gnokey broadcast` +subcommand, giving it the path to the signed transaction: + +```bash +gnokey broadcast -remote "https://rpc.gno.land:443" userbook.tx +``` + +In this case, we do not need to specify a keypair, as the transaction has already +been signed in a previous step and `gnokey` is only sending it to the RPC endpoint. + +## Verifying a transaction's signature + +To verify a transaction's signature is correct, you can use the `gnokey verify` +subcommand. We can provide the path to the transaction document using the `-docpath` +flag, provide the key we signed the transaction with, and the signature itself. +Make sure the signature is in the `hex` format. + +```bash +gnokey verify -docpath userbook.tx mykey +``` + +## Conclusion + +That's it! 🎉 + +In this tutorial, you've learned to use `gnokey` for creating maximum-security +transactions in an airgapped manner. diff --git a/docs/gno-tooling/cli/gnokey/gnokey.md b/docs/gno-tooling/cli/gnokey/gnokey.md new file mode 100644 index 00000000000..7344f9b539c --- /dev/null +++ b/docs/gno-tooling/cli/gnokey/gnokey.md @@ -0,0 +1,16 @@ +--- +id: gnokey +--- + +# `gnokey` + +## Overview + +In this section, you will learn how to use the `gnokey` binary. `gnokey` is the +gno.land CLI keychain and client, and it allows you to do 4 main things: +- Manage Gno keypairs +- Send state-changing calls (transactions) +- Query a gno.land network +- Sign and broadcast transactions with [airgap protection](https://en.wikipedia.org/wiki/Air_gap_(networking)) + +Check out the rest of this section to learn how to do all of these. diff --git a/docs/gno-tooling/cli/gnokey/querying-a-network.md b/docs/gno-tooling/cli/gnokey/querying-a-network.md new file mode 100644 index 00000000000..97986237a21 --- /dev/null +++ b/docs/gno-tooling/cli/gnokey/querying-a-network.md @@ -0,0 +1,197 @@ +--- +id: querying-a-network +--- + +# Querying a gno.land network + +## Prerequisites + +- **`gnokey` installed.** Reference the + [Local Setup](../../../getting-started/local-setup/installation.md#2-installing-the-required-tools) guide for steps + +## Overview + +gno.land and `gnokey` support ABCI queries. Using ABCI queries, you can query the state of +a gno.land network without spending any gas. All queries need to be pointed towards +a specific remote address from which the state will be retrieved. + +To send ABCI queries, you can use the `gnokey query` subcommand, and provide it +with the appropriate query. The `query` subcommand allows us to send different +types of queries to a gno.land network. + +Below is a list of queries a user can make with `gnokey`: +- `auth/accounts/{ADDRESS}` - returns information about an account +- `bank/balances/{ADDRESS}` - returns balances of an account +- `vm/qfuncs` - returns the exported functions for a given pkgpath +- `vm/qfile` - returns the list of files for a given pkgpath +- `vm/qeval` - evaluates an expression in read-only mode on and returns the results +- `vm/qrender` - shorthand for evaluating `vm/qeval Render("")` for a given pkgpath + +Let's see how we can use them. + +## `auth/accounts` + +We can obtain information about a specific address using this subquery. To call it, +we can run the following command: + +```bash +gnokey query auth/accounts/g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5 -remote https://rpc.gno.land:443 +``` + +With this, we are asking the Portal Loop network to deliver information about the +specified address. If everything went correctly, we should get output similar to the following: + +```bash +height: 0 +data: { + "BaseAccount": { + "address": "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5", + "coins": "227984898927ugnot", + "public_key": { + "@type": "/tm.PubKeySecp256k1", + "value": "A+FhNtsXHjLfSJk1lB8FbiL4mGPjc50Kt81J7EKDnJ2y" + }, + "account_number": "0", + "sequence": "12" + } +} +``` + +The return data will contain the following fields: +- `height` - the height at which the query was executed. This is currently not + supported and is `0` by default. +- `data` - contains the result of the query. + +The `data` field returns a `BaseAccount`, which is the main struct used in [TM2](../../../concepts/tendermint2.md) +to hold account data. It contains the following information: +- `address` - the address of the account +- `coins` - the list of coins the account owns +- `public_key` - the TM2 public key of the account, from which the address is derived +- `account_number` - a unique identifier for the account on the gno.land chain +- `sequence` - a nonce, used for protection against replay attacks + +## `bank/balances` + +With this query, we can fetch [coin](../../../concepts/stdlibs/coin.md) balances +of a specific account. To call it, we can run the following command: + +```bash +gnokey query bank/balances/g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5 -remote https://rpc.gno.land:443 +``` + +If everything went correctly, we should get an output similar to the following: + +```bash +height: 0 +data: "227984898927ugnot" +``` + +The data field will contain the coins the address owns. + +## `vm/qfuncs` + +Using the `vm/qfuncs` query, we can fetch exported functions from a specific package +path. To specify the path we want to query, we can use the `-data` flag: + +```bash +gnokey query vm/qfuncs --data "gno.land/r/demo/wugnot" -remote https://rpc.gno.land:443 +``` + +The output is a string containing all exported functions for the `wugnot` realm: + +```json +height: 0 +data: [ + { + "FuncName": "Deposit", + "Params": null, + "Results": null + }, + { + "FuncName": "Withdraw", + "Params": [ + { + "Name": "amount", + "Type": "uint64", + "Value": "" + } + ], + "Results": null + }, + // other functions +] +``` + +## `vm/qfile` + +With the `vm/qfile` query, we can fetch files found on a specific package path. +To specify the path we want to query, we can use the `-data` flag: + +```bash +gnokey query vm/qfile -data "gno.land/r/demo/wugnot" -remote https://rpc.gno.land:443 +``` + +The output is a list of all files found within the `wugnot` realm: + +```bash +height: 0 +data: gno.mod +wugnot.gno +z0_filetest.gno +``` + +## `vm/qeval` + +`vm/qeval` allows us to evaluate a call to an exported function without using gas, +in read-only mode. For example: + +```bash +gnokey query vm/qeval -remote https://rpc.gno.land:443 -data "gno.land/r/demo/wugnot.BalanceOf(\"g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5\")" +``` + +This command will return the `wugnot` balance of the above address without using gas. +Properly escaping quotation marks for string arguments is currently required. + +Currently, `vm/qeval` only supports primitive types in expressions. + +## `vm/qrender` + +`vm/qrender` is an alias for executing `vm/qeval` on the `Render("")` function. +We can use it like this: + +```bash +gnokey query vm/qrender --data "gno.land/r/demo/wugnot:" -remote https://rpc.gno.land:443 +``` + +Running this command will display the current `Render()` output of the WUGNOT +realm, which is also displayed by default on the [realm's page](https://gno.land/r/demo/wugnot): + +```bash +height: 0 +data: # wrapped GNOT ($wugnot) + +* **Decimals**: 0 +* **Total supply**: 5012404 +* **Known accounts**: 2 +``` + +:::info Specifying a path to `Render()` + +To call the `vm/qrender` query with a specific path, use the `:` syntax. +For example, the `wugnot` realm provides a way to display the balance of a specific +address in its `Render()` function. We can fetch the balance of an account by +providing the following custom pattern to the `wugnot` realm: + +```bash +gnokey query vm/qrender --data "gno.land/r/demo/wugnot:balance/g125em6arxsnj49vx35f0n0z34putv5ty3376fg5" -remote https://rpc.gno.land:443 +``` + +To see how this was achieved, check out `wugnot`'s `Render()` function. +::: + +## Conclusion + +That's it! 🎉 + +In this tutorial, you've learned to use `gnokey` to query a gno.land +network. diff --git a/docs/gno-tooling/cli/gnokey/state-changing-calls.md b/docs/gno-tooling/cli/gnokey/state-changing-calls.md new file mode 100644 index 00000000000..79a777cca51 --- /dev/null +++ b/docs/gno-tooling/cli/gnokey/state-changing-calls.md @@ -0,0 +1,466 @@ +--- +id: state-changing-calls +--- + +# Making state-changing calls (transactions) + +## Prerequisites + +- **`gnokey` installed.** Reference the + [Local Setup](../../../getting-started/local-setup/installation.md#2-installing-the-required-tools) guide for steps + +## Overview + +In Gno, there are four types of messages that can change on-chain state: +- `AddPackage` - adds new code to the chain +- `Call` - calls a specific path and function on the chain +- `Send` - sends coins from one address to another +- `Run` - executes a Gno script against on-chain code + +A gno.land transaction contains two main things: +- A base configuration where variables such as `gas-fee`, `gas-wanted`, and others + are defined +- A list of messages to execute on the chain + +Currently, `gnokey` supports single-message transactions, while multiple-message +transactions can be created in Go programs, supported by the +[gnoclient](../../../reference/gnoclient/gnoclient.md) package. + +We will need some testnet coins (GNOTs) for each state-changing call. Visit the [Faucet +Hub](https://faucet.gno.land) to get GNOTs for the Gno testnets that are currently live. + +Let's delve deeper into each of these message types. + +## `AddPackage` + +In case you want to upload new code to the chain, you can use the `AddPackage` +message type. You can send an `AddPackage` transaction with `gnokey` using the +following command: + +```bash +gnokey maketx addpkg +``` + +To understand how to use this subcommand better, let's write a simple "Hello world" +[pure package](../../../concepts/packages.md). First, let's create a folder which will +store our example code. + +```bash +└── example/ +``` + +Then, let's create a `hello_world.gno` file under the `p/` folder: + +```bash +cd example +mkdir p/ && cd p +touch hello_world.gno +``` + +Now, we should have the following folder structure: + +```bash +└── example/ +│ └── p/ +│ └── hello_world.gno +``` + +In the `hello_world.gno` file, add the following code: + +```go +package hello_world + +func Hello() string { + return "Hello, world!" +} +``` + +We are now ready to upload this package to the chain. To do this, we must set the +correct flags for the `addpkg` subcommand. + +The `addpkg` subcommmand uses the following flags and arguments: +- `-pkgpath` - on-chain path where your code will be uploaded to +- `-pkgdir` - local path where your is located +- `-broadcast` - enables broadcasting the transaction to the chain +- `-send` - a deposit amount of GNOT to send along with the transaction +- `-gas-wanted` - the upper limit for units of gas for the execution of the + transaction +- `-gas-fee` - amount of GNOTs to pay per gas unit +- `-chain-id` - id of the chain that we are sending the transaction to +- `-remote` - specifies the remote node RPC listener address + +The `-pkgpath` and `-pkgdir` flags are unique to the `addpkg` subcommand, while +`-broadcast`,`-send`, `-gas-wanted`, `-gas-fee`, `-chain-id`, and `-remote` are +used for setting the base transaction configuration. These flags will be repeated +throughout the tutorial. + +Next, let's configure the `addpkg` subcommand to publish this package to the +[Portal Loop](../../../concepts/portal-loop.md) testnet. Assuming we are in +the `example/p/` folder, the command will look like this: + +```bash +gnokey maketx addpkg \ +-pkgpath "gno.land/p//hello_world" \ +-pkgdir "." \ +-send "" \ +-gas-fee 10000000ugnot \ +-gas-wanted 8000000 \ +-broadcast \ +-chainid portal-loop \ +-remote "https://rpc.gno.land:443" +``` + +Once we have added a desired [namespace](../../../concepts/namespaces.md) to upload the package to, we can specify +a keypair name to use to execute the transaction: + +```bash +gnokey maketx addpkg \ +-pkgpath "gno.land/p/examplenamespace/hello_world" \ +-pkgdir "." \ +-send "" \ +-gas-fee 10000000ugnot \ +-gas-wanted 200000 \ +-broadcast \ +-chainid portal-loop \ +-remote "https://rpc.gno.land:443" +mykey +``` + +If the transaction was successful, you will get output from `gnokey` that is similar to the following: + +``` +OK! +GAS WANTED: 200000 +GAS USED: 117564 +HEIGHT: 3990 +EVENTS: [] +TX HASH: Ni8Oq5dP0leoT/IRkKUKT18iTv8KLL3bH8OFZiV79kM= +``` + +Let's analyze the output, which is standard for any `gnokey` transaction: +- `GAS WANTED: 200000` - the original amount of gas specified for the transaction +- `GAS USED: 117564` - the gas used to execute the transaction +- `HEIGHT: 3990` - the block number at which the transaction was executed at +- `EVENTS: []` - [Gno events](../../../concepts/stdlibs/events.md) emitted by the transaction, in this case, none +- `TX HASH: Ni8Oq5dP0leoT/IRkKUKT18iTv8KLL3bH8OFZiV79kM=` - the hash of the transaction + +Congratulations! You have just uploaded a pure package to the Portal Loop network. +If you wish to deploy to a different network, find the list of all network +configurations in the [Network Configuration](../../../reference/network-config.md) section. + +## `Call` + +The `Call` message type is used to call any exported realm function. +You can send a `Call` transaction with `gnokey` using the following command: + +```bash +gnokey maketx call +``` + +:::info `Call` uses gas + +Using `Call` to call an exported function will use up gas, even if the function +does not modify on-chain state. If you are calling such a function, you can use +the [`query` functionality](./querying-a-network.md) for a read-only call which +does not use gas. + +::: + +For this example, we will call the `wugnot` realm, which wraps GNOTs to a +GRC20-compatible token called `wugnot`. We can find this realm deployed on the +[Portal Loop](../../../concepts/portal-loop.md) testnet, under the `gno.land/r/demo/wugnot` path. + +We will wrap `1000ugnot` into the equivalent in `wugnot`. To do this, we can call +the `Deposit()` function found in the `wugnot` realm. As previously, we will +configure the `maketx call` subcommand: + +```bash +gnokey maketx call \ +-pkgpath "gno.land/r/demo/wugnot" \ +-func "Deposit" \ +-send "1000ugnot" \ +-gas-fee 10000000ugnot \ +-gas-wanted 2000000 \ +-broadcast \ +-chainid portal-loop \ +-remote "https://rpc.gno.land:443" \ +mykey +``` + +In this command, we have specified three main things: +- The path where the realm lives on-chain with the `-pkgpath` flag +- The function that we want to call on the realm with the `-func` flag +- The amount of `ugnot` we want to send to be wrapped, using the `-send` flag + +Apart from this, we have also specified the Portal Loop chain ID, `portal-loop`, +as well as the Portal Loop remote address, `https://rpc.gno.land:443`. + +After running the command, we can expect an output similar to the following: +```bash +OK! +GAS WANTED: 2000000 +GAS USED: 489528 +HEIGHT: 24142 +EVENTS: [{"type":"Transfer","attrs":[{"key":"from","value":""},{"key":"to","value":"g125em6arxsnj49vx35f0n0z34putv5ty3376fg5"},{"key":"value","value":"1000"}],"pkg_path":"gno.land/r/demo/wugnot","func":"Mint"}] +TX HASH: Ni8Oq5dP0leoT/IRkKUKT18iTv8KLL3bH8OFZiV79kM= +``` + +In this case, we can see that the `Deposit()` function emitted an +[event](../../../concepts/stdlibs/events.md) that tells us more about what +happened during the transaction. + +After broadcasting the transaction, we can verify that we have the amount of `wugnot` we expect. We +can call the `BalanceOf()` function in the same realm: + +```bash +gnokey maketx call \ +-pkgpath "gno.land/r/demo/wugnot" \ +-func "BalanceOf" \ +-args "" \ +-gas-fee 10000000ugnot \ +-gas-wanted 2000000 \ +-broadcast \ +-chainid portal-loop \ +-remote "https://rpc.gno.land:443" \ +mykey +``` + +If everything was successful, we should get something similar to the following +output: + +``` +(1000 uint64) + +OK! +GAS WANTED: 2000000 +GAS USED: 396457 +HEIGHT: 64839 +EVENTS: [] +TX HASH: gQP9fJYrZMTK3GgRiio3/V35smzg/jJ62q7t4TLpdV4= +``` + +At the top, you will see the output of the transaction, specifying the value and +type of the return argument. + +In this case, we used `maketx call` to call a read-only function, which simply +checks the `wugnot` balance of a specific address. This is discouraged, as +`maketx call` actually uses gas. To call a read-only function without spending gas, +check out the `vm/qeval` query in the [Querying a network](./querying-a-network.md#vmqeval) section. + +## `Send` + +We can use the `Send` message type to access the TM2 [Banker](../../../concepts/stdlibs/banker.md) +directly and transfer coins from one Gno address to another. + +Coins, such as GNOTs, are always formatted in the following way: + +``` + +100ugnot +``` + +For this example, let's transfer some GNOTs. Just like before, we can configure +our `maketx send` subcommand: +```bash +gnokey maketx send \ +-to g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5 \ +-send 100ugnot \ +-gas-fee 10000000ugnot \ +-gas-wanted 2000000 \ +-broadcast \ +-chainid portal-loop \ +-remote "https://rpc.gno.land:443" \ +mykey +``` + +Here, we have set the `-to` & `-send` flags to match the recipient, in this case +the publicly-known `test1` address, and `100ugnot` for the coins we want to send, +respectively. + +To check the balance of a specific address, check out the `bank/balances` query +in the [Querying a network](./querying-a-network.md#bankbalances) section. + +## `Run` + +With the `Run` message, you can write a snippet of Gno code and run it against +code on the chain. For this example, we will use the [Userbook realm](https://gno.land/r/demo/userbook), +which simply allows you to register the fact that you have interacted with it. +It contains a simple `SignUp()` function, which we will call with `Run`. + +To understand how to use the `Run` message better, let's write a simple `script.gno` +file. First, create a folder which will store our script. + +```bash +└── example/ +``` + +Then, let's create a `script.gno` file: + +```bash +cd example +touch script.gno +``` + +Now, we should have the following folder structure: + +```bash +└── example/ +│ └── script.gno +``` + +In the `script.gno` file, first define the package to be `main`. Then we can import +the Userbook realm and define a `main()` function with no return values which will +be automatically detected and run. In it, we can call the `SignUp()` function. + +```go +package main + +import "gno.land/r/demo/userbook" + +func main() { + println(userbook.SignUp()) +} +``` + +Now we will be able to provide this to the `maketx run` subcommand: +```bash +gnokey maketx run \ +-gas-fee 1000000ugnot \ +-gas-wanted 20000000 \ +-broadcast \ +-chainid portal-loop \ +-remote "https://rpc.gno.land:443" \ +mykey ./script.gno +``` + +After running this command, the chain will execute the script and apply any state +changes. Additionally, by using `println`, which is only available in the `Run` +& testing context, we will be able to see the return value of the function called. + +### The power of `Run` + +Specifically, the above example could have been replaced with a simple `maketx call` +call. The full potential of run comes out in three specific cases: +1. Calling realm functions multiple times in a loop +2. Calling functions with non-primitive input arguments +3. Calling methods on exported variables + +Let's look at each of these cases in detail. To demonstrate, we'll make a call +to the following example realm: + +```go +package foo + +import "gno.land/p/demo/ufmt" + +var ( + MainFoo *Foo + foos []*Foo +) + +type Foo struct { + bar string + baz int +} + +func init() { + MainFoo = &Foo{bar: "mainBar", baz: 0} +} + +func (f *Foo) String() string { + return ufmt.Sprintf("Foo - (bar: %s) - (baz: %d)\n\n", f.bar, f.baz) +} + +func NewFoo(bar string, baz int) *Foo { + return &Foo{bar: bar, baz: baz} +} + +func AddFoos(multipleFoos []*Foo) { + foos = append(foos, multipleFoos...) +} + +func Render(_ string) string { + var output string + + for _, f := range foos { + output += f.String() + } + + return output +} +``` + +This realm is deployed to [`gno.land/r/docs/examples/run/foo`](https://gno.land/r/docs/examples/run/foo/package.gno) +on the Portal Loop testnet. + +1. Calling realm functions multiple times in a loop: +```go +package main + +import ( + "gno.land/r/docs/examples/run/foo" +) + +func main() { + for i := 0; i < 5; i++ { + println(foo.Render("")) + } +} +``` + +2. Calling functions with non-primitive input arguments: + +Currently, `Call` only supports primitives for arguments. With `Run`, these +limitations are removed; we can execute a function that takes in a struct, array, +or even an array of structs. + +We are unable to call `AddFoos()` with the `Call` message type, while with `Run`, +we can: + +```go +package main + +import ( + "strconv" + + "gno.land/r/docs/examples/run/foo" +) + +func main() { + var multipleFoos []*foo.Foo + + for i := 0; i < 5; i++ { + newFoo := foo.NewFoo( + "bar"+strconv.Itoa(i), + i, + ) + + multipleFoos = append(multipleFoos, newFoo) + } + + foo.AddFoos(multipleFoos) +} + +``` + +3. Calling methods on exported variables: + +```go +package main + +import "gno.land/r/docs/examples/run/foo" + +func main() { + println(foo.MainFoo.String()) +} +``` + +Finally, we can call methods that are on top-level objects in case they exist, +which is not currently possible with the `Call` message. + +## Conclusion + +That's it! 🎉 + +In this tutorial, you've learned to use `gnokey` for sending multiple types of +state-changing calls to a gno.land chain. diff --git a/docs/getting-started/local-setup/working-with-key-pairs.md b/docs/gno-tooling/cli/gnokey/working-with-key-pairs.md similarity index 75% rename from docs/getting-started/local-setup/working-with-key-pairs.md rename to docs/gno-tooling/cli/gnokey/working-with-key-pairs.md index 23516c44e6c..ba03ca569b4 100644 --- a/docs/getting-started/local-setup/working-with-key-pairs.md +++ b/docs/gno-tooling/cli/gnokey/working-with-key-pairs.md @@ -5,14 +5,16 @@ id: working-with-key-pairs # Working with Key Pairs ## Overview + In this tutorial, you will learn how to manage private user keys, which are required for interacting with the gno.land blockchain. You will understand what mnemonics are, how they are used, and how you can make interaction seamless with Gno. ## Prerequisites -- **`gnokey` installed.** Reference the -[Local Setup](installation.md#2-installing-the-required-tools-) guide for steps + +- **`gnokey` installed.** Reference the + [Local Setup](../../../getting-started/local-setup/installation.md#2-installing-the-required-tools) guide for steps ## Listing available keys `gnokey` works by creating a local directory in the filesystem for storing @@ -31,27 +33,27 @@ Example output: USAGE [flags] [...] -Manages private keys for the node +gno.land keychain & client SUBCOMMANDS - add Adds key to the keybase - delete Deletes a key from the keybase - generate Generates a bip39 mnemonic - export Exports private key armor - import Imports encrypted private key armor - list Lists all keys in the keybase - sign Signs the document - verify Verifies the document signature - query Makes an ABCI query - broadcast Broadcasts a signed document - maketx Composes a tx document to sign + add adds key to the keybase + delete deletes a key from the keybase + generate generates a bip39 mnemonic + export exports private key armor + import imports encrypted private key armor + list lists all keys in the keybase + sign signs the given tx document and saves it to disk + verify verifies the document signature + query makes an ABCI query + broadcast broadcasts a signed document + maketx composes a tx document to sign FLAGS - -config ... config file (optional) - -home $XDG_CONFIG/gno home directory - -insecure-password-stdin=false WARNING! take password from stdin - -quiet=false suppress output during execution - -remote 127.0.0.1:26657 remote node URL + -config ... config file (optional) + -home $XDG_CONFIG/gno home directory + -insecure-password-stdin=false WARNING! take password from stdin + -quiet=false suppress output during execution + -remote 127.0.0.1:26657 remote node URL ``` In this example, the directory where `gnokey` will store working data @@ -97,7 +99,7 @@ To generate the mnemonic phrase in the console, you can run: gnokey generate ``` -![gnokey generate](../../assets/getting-started/local-setup/creating-a-key-pair/gnokey-generate.gif) +![gnokey generate](../../../assets/getting-started/local-setup/creating-a-key-pair/gnokey-generate.gif) ## Adding a random private key If we wanted to add a new private key to the keystore, we can run the following @@ -115,7 +117,7 @@ After you enter the password, the `gnokey` tool will add the key to the keystore and return the accompanying [mnemonic phrase](https://en.bitcoin.it/wiki/Seed_phrase), which you should remember somewhere if you want to recover the key at a future point in time. -![gnokey add random](../../assets/getting-started/local-setup/creating-a-key-pair/gnokey-add-random.gif) +![gnokey add random](../../../assets/getting-started/local-setup/creating-a-key-pair/gnokey-add-random.gif) You can check that the key was indeed added to the keystore, by listing available keys: @@ -124,7 +126,7 @@ keys: gnokey list ``` -![gnokey list](../../assets/getting-started/local-setup/creating-a-key-pair/gnokey-list.gif) +![gnokey list](../../../assets/getting-started/local-setup/creating-a-key-pair/gnokey-list.gif) ## Adding a private key using a mnemonic To add a private key to the `gnokey` keystore [using an existing mnemonic](#generating-a-bip39-mnemonic), @@ -140,7 +142,7 @@ Of course, you can replace `MyKey` with whatever name you want for your key. By following the prompts to encrypt the key on disk, and providing a BIP39 mnemonic, we can successfully add the key to the keystore. -![gnokey add mnemonic](../../assets/getting-started/local-setup/creating-a-key-pair/gnokey-add-mnemonic.gif) +![gnokey add mnemonic](../../../assets/getting-started/local-setup/creating-a-key-pair/gnokey-add-mnemonic.gif) ## Deleting a private key To delete a private key from the `gnokey` keystore, we need to know the name or @@ -175,7 +177,7 @@ Follow the prompts presented in the terminal. Namely, you will be asked to decrypt the key in the keystore, and later to encrypt the armor file on disk. It is worth noting that you can also export unencrypted key armor, using the `--unsafe` flag. -![gnokey export](../../assets/getting-started/local-setup/creating-a-key-pair/gnokey-export.gif) +![gnokey export](../../../assets/getting-started/local-setup/creating-a-key-pair/gnokey-export.gif) ## Importing a private key If you have an exported private key file, you can import it into `gnokey` fairly @@ -195,4 +197,11 @@ encryption password for storing the key in the keystore. After executing the previous command, the `gnokey` keystore will have imported `ImportedKey`. -![gnokey import](../../assets/getting-started/local-setup/creating-a-key-pair/gnokey-import.gif) +![gnokey import](../../../assets/getting-started/local-setup/creating-a-key-pair/gnokey-import.gif) + +## Conclusion + +That's it! 🎉 + +In this tutorial, you've learned to use `gnokey` for managing Gno keypairs. + diff --git a/docs/how-to-guides/connecting-from-go.md b/docs/how-to-guides/connecting-from-go.md index 6f05a891cd2..971007e5cef 100644 --- a/docs/how-to-guides/connecting-from-go.md +++ b/docs/how-to-guides/connecting-from-go.md @@ -15,7 +15,7 @@ For this guide, we will build a small Go app that will: ## Prerequisites - A local gno.land keypair generated using -[gnokey](../getting-started/local-setup/working-with-key-pairs.md) +[gnokey](../gno-tooling/cli/gnokey/working-with-key-pairs.md) ## Setup diff --git a/docs/how-to-guides/deploy.md b/docs/how-to-guides/deploy.md index 620a5664f7c..1e27ccd0cad 100644 --- a/docs/how-to-guides/deploy.md +++ b/docs/how-to-guides/deploy.md @@ -129,7 +129,7 @@ given in the `--gas-wanted` flag to cover the deployment cost. Regardless of whether you're deploying a realm or a package, you will be using `gnokey`'s `maketx addpkg` - the usage of `maketx addpkg` in both cases is identical. To read more about the `maketx addpkg` -subcommand, view the `gnokey` [reference](../gno-tooling/cli/gnokey.md#addpkg). +subcommand, view the `gnokey` [reference](../gno-tooling/cli/gnokey/state-changing-calls.md#addpackage). ::: diff --git a/docs/reference/gnoclient/gnoclient.md b/docs/reference/gnoclient/gnoclient.md index 0c6c0d87308..672a3772bb7 100644 --- a/docs/reference/gnoclient/gnoclient.md +++ b/docs/reference/gnoclient/gnoclient.md @@ -14,7 +14,7 @@ APIs for common functionality. - Use local keystore to sign & broadcast transactions containing any type of Gno message - Sign & broadcast transactions with batch messages -- Use [ABCI queries](../../gno-tooling/cli/gnokey.md#make-an-abci-query) in +- Use [ABCI queries](../../gno-tooling/cli/gnokey/querying-a-network.md) in your Go code ## Installation @@ -30,5 +30,5 @@ To see the full reference documentation for the `gnoclient` package, we recommen visiting the [`gnoclient godoc page`](https://gnolang.github.io/gno/github.com/gnolang/gno@v0.0.0/gno.land/pkg/gnoclient.html). For a tutorial on how to use the `gnoclient` package, check out -["How to connect a Go app to gno.land"](../../how-to-guides/connecting-from-go.md) +["How to connect a Go app to gno.land"](../../how-to-guides/connecting-from-go.md).