Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: official documentation #1046

Merged
merged 74 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
d8f1599
Add base Docusaurus setup
zivkovicmilos Aug 9, 2023
0c84b03
Remove docs README
zivkovicmilos Aug 9, 2023
b473202
Add content for the Overview
zivkovicmilos Aug 10, 2023
b4e3f7c
Update Installation doc
zivkovicmilos Aug 10, 2023
57a9e7b
Update the Create a private key section
zivkovicmilos Aug 10, 2023
a10d126
Update the Create a private key section
zivkovicmilos Aug 10, 2023
955042a
Update the Premining Balances tutorial
zivkovicmilos Aug 11, 2023
630be8f
Update the Running a Faucet tutorial
zivkovicmilos Aug 11, 2023
badb5d9
Update the Setting up a Local Chain doc
zivkovicmilos Aug 15, 2023
c7f611d
Update the Browsing Gno Source code doc
zivkovicmilos Aug 15, 2023
8845314
Add guide on creating a simple Realm
zivkovicmilos Sep 4, 2023
e93b74b
Add guide on creating a simple Package
zivkovicmilos Sep 4, 2023
019650a
Add guide on running tests
zivkovicmilos Sep 4, 2023
3a40dd4
Merge branch 'master' into feature/official-docs
zivkovicmilos Oct 3, 2023
da1fe7b
feat: add grc20 + grc721 guides (#16)
waymobetta Oct 8, 2023
c940c2c
feat: index from dev portal (#18)
r3v4s Oct 10, 2023
e2343c6
feat: add contents from portal (#19)
dongwon8247 Oct 10, 2023
a324ce5
feat: add howto - deploy & write-simple-dapp (#17)
leohhhn Oct 10, 2023
ab9c39a
initial explaination doc for gno modules (#20)
harry-hov Oct 11, 2023
db983b9
style: customize doc styles (#21)
alexiscolin Oct 12, 2023
22c0cde
Drop some docs temporarily
zivkovicmilos Oct 12, 2023
23a747f
Reorganize the docs, so they are framework agnostic
zivkovicmilos Oct 12, 2023
cfc4459
Clean up config
zivkovicmilos Oct 12, 2023
38d9a12
Merge branch 'master' into feature/official-docs
zivkovicmilos Oct 12, 2023
679fa08
Update docs/explanation/gno-language.md
zivkovicmilos Oct 17, 2023
7842672
Update docs/explanation/gno-language.md
zivkovicmilos Oct 17, 2023
4ec69ee
Update docs/explanation/gno-modules.md
zivkovicmilos Oct 17, 2023
7ae2920
Update docs/explanation/gno-modules.md
zivkovicmilos Oct 17, 2023
9f7ab77
Update docs/explanation/gno-test.md
zivkovicmilos Oct 17, 2023
4ba996d
Update docs/explanation/gno-tooling/cli/gnofaucet.md
zivkovicmilos Oct 17, 2023
67f73b8
Update docs/how-to-guides/Interact-with-gnoland.md
zivkovicmilos Oct 17, 2023
21283a8
Update docs/explanation/realms.md
zivkovicmilos Oct 17, 2023
35942e6
Update docs/explanation/realms.md
zivkovicmilos Oct 17, 2023
cd33a9c
Update docs/getting-started/working-with-key-pairs.md
zivkovicmilos Oct 17, 2023
ee0a7ff
Update docs/explanation/tendermint2.md
zivkovicmilos Oct 17, 2023
acaf2aa
Update docs/explanation/realms.md
zivkovicmilos Oct 17, 2023
d004bb1
Merge branch 'master' into feature/official-docs
zivkovicmilos Oct 21, 2023
6d3e57c
Rephrase sentence
zivkovicmilos Oct 21, 2023
531642c
Rephase Ethereum section
zivkovicmilos Oct 21, 2023
db5eda0
Fix typo
zivkovicmilos Oct 21, 2023
e4ee8a0
Update docs/explanation/gno-language.md
leohhhn Oct 31, 2023
43384c5
Update docs/explanation/gno-language.md
leohhhn Oct 31, 2023
b6089ba
Update docs/explanation/gno-language.md
leohhhn Oct 31, 2023
458598d
Update docs/explanation/gno-modules.md
leohhhn Oct 31, 2023
40fa990
Rephrase gno-language.md sentence
zivkovicmilos Nov 8, 2023
00cbe6d
Drop common params doc
zivkovicmilos Nov 8, 2023
6bf83af
Improve gnofaucet.md
zivkovicmilos Nov 8, 2023
3603681
Add disclaimer for Adena
zivkovicmilos Nov 8, 2023
7254544
Swap test3 for staging
zivkovicmilos Nov 8, 2023
72e20b1
Update docs/getting-started/setting-up-a-local-chain.md
zivkovicmilos Nov 8, 2023
ecdb870
Merge branch 'feature/official-docs' of https://github.com/zivkovicmi…
zivkovicmilos Nov 8, 2023
969e914
Add form GUI explanation
zivkovicmilos Nov 8, 2023
e89d450
Rename file
zivkovicmilos Nov 8, 2023
1e627ef
Rename installation to local setup
zivkovicmilos Nov 8, 2023
fba2029
Add link to Gnolang
zivkovicmilos Nov 8, 2023
824816e
Rename Packages to Pure Packages
zivkovicmilos Nov 8, 2023
ef941e0
Add disclaimer for chain id
zivkovicmilos Nov 8, 2023
e8f1460
Update tm2 doc
zivkovicmilos Nov 8, 2023
d6ee4da
Add code embed support
zivkovicmilos Nov 8, 2023
43d4dba
Rename lang shorthand
zivkovicmilos Nov 8, 2023
b949947
Update docs/explanation/gno-modules.md
zivkovicmilos Nov 8, 2023
7da892e
Update docs/explanation/gno-modules.md
zivkovicmilos Nov 8, 2023
2206eac
Rephrase
zivkovicmilos Nov 8, 2023
4b6fa24
Update docs/explanation/gno-modules.md
zivkovicmilos Nov 8, 2023
3c67978
Update docs/explanation/gno-modules.md
zivkovicmilos Nov 8, 2023
f888653
Update docs/explanation/gno-modules.md
zivkovicmilos Nov 8, 2023
b1ac173
Remove duplicate compatibility doc
zivkovicmilos Nov 8, 2023
6b68949
Merge branch 'master' into feature/official-docs
zivkovicmilos Nov 8, 2023
8ba08b8
Add devrels to own the docs
zivkovicmilos Nov 8, 2023
90922f5
Fix hanging references
zivkovicmilos Nov 9, 2023
408f0fa
Update docs/explanation/gnovm.md
zivkovicmilos Nov 9, 2023
9073308
Update docs/explanation/gnovm.md
zivkovicmilos Nov 9, 2023
34de86c
Merge branch 'master' into feature/official-docs
zivkovicmilos Nov 9, 2023
5e9b9d2
Merge branch 'feature/official-docs' of https://github.com/zivkovicmi…
zivkovicmilos Nov 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
id: from-go-to-gno
---

# From Go to Gno

## Runtime comparison
Expand Down Expand Up @@ -69,5 +73,5 @@ TODO

## See also

- [go-gno-compatibility.md](./go-gno-compatibility.md)
- [go-gno-compatibility.md](../reference/go-gno-compatibility.md)
- ["go -> gno" presentation by Zack Scholl](https://github.com/gnolang/workshops/tree/main/presentations/2023-06-26--go-to-gno--schollz)
33 changes: 33 additions & 0 deletions docs/explanation/gno-language.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
id: gno-language
---

# The Gno Language

Gnolang (Gno) is an interpretation of the widely-used Golang (Go) programming language for blockchain created by Cosmos co-founder Jae Kwon in 2021 to mark a new era in smart contracting. Gno is almost identical to Go, so Go developers can quickly start using it, with minimal effort. For example, Gno comes with blockchain-specific standard libraries, but any code that doesn’t use blockchain-specific logic can run in Go with minimal processing. Libraries that don’t make sense in the blockchain context, such as network or operating-system access, are not available in Gno. Otherwise, Gno loads and uses many standard libraries that power Go, so most of the parsing of the source code is the same.
zivkovicmilos marked this conversation as resolved.
Show resolved Hide resolved
leohhhn marked this conversation as resolved.
Show resolved Hide resolved

Under the hood, the Gno code is parsed into an abstract syntax tree (AST) and the AST itself is used in the interpreter, rather than bytecode as in many virtual machines such as Java, Python, or Wasm. This makes even the GnoVM accessible to any Go programmer. The novel design of the intuitive GnoVM interpreter allows Gno to freeze and resume the program by persisting and loading the memory state automatically. Gno is deterministic, auto-persisted, and auto-Merkle-ized, allowing (smart contract) programs to be succinct, as the programmer doesn’t have to serialize and deserialize objects to persist them into a database (unlike programming applications with the Cosmos SDK).
leohhhn marked this conversation as resolved.
Show resolved Hide resolved

## How Gno Differs from Go

The composable nature of Go/Gno allows for type-checked interactions between contracts, making Gno.land safer and more powerful, as well as operationally cheaper and faster. Smart contracts on Gno.land are light, simple, more focused, and easily interoperable—a network of interconnected contracts rather than siloed monoliths that limit interactions with other contracts.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and easily interoperable—a network of interconnected contracts

missing a word?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rephrased:

40fa990


## Gno Inherits Go’s Built-in Security Features

Go supports secure programming through exported/non-exported fields, enabling a “least-authority” design. It is easy to create objects and APIs that expose only what should be accessible to callers while hiding what should not be simply by the capitalization of letters, thus allowing a succinct representation of secure logic that can be called by multiple users.

Another major advantage of Go is that the language comes with an ecosystem of great tooling, like the compiler and third-party tools that statically analyze code. Gno inherits these advantages from Go directly to create a smart contract programming language that provides embedding, composability, type-check safety, and garbage collection, helping developers to write secure code relying on the compiler, parser, and interpreter to give warning alerts for common mistakes.

## Gno vs Solidity

The most widely-adopted smart contract language today is Ethereum’s EVM-compatible Solidity. With bytecode built from the ground up and Turing complete, Solidity opened up a world of possibilities for decentralized applications (dApps) and there are currently more than 10 million contracts deployed on Ethereum. However, Solidity provides limited tooling and its EVM has a stack limit and computational inefficiencies.

Solidity is designed for one purpose only (writing smart contracts) and is bound by the limitations of the EVM. In addition, developers have to learn several languages if they want to understand the whole stack or work across different ecosystems. Gno aspires to exceed Solidity on multiple fronts (and other smart contract languages like CosmWasm or Substrate) as every part of the stack is written in Gno. It’s easy for developers to understand the entire system just by studying a relatively small code base.
zivkovicmilos marked this conversation as resolved.
Show resolved Hide resolved

## Gno Is Essential for the Wider Adoption of Web3

Gno makes imports as easy as they are in web2 with runtime-based imports for seamless dependency flow comprehension, and support for complex structs, beyond primitive types. Gno is ultimately cost-effective as dependencies are loaded once, enabling remote function calls as local, and providing automatic and independent per-realm state persistence.

Using Gno, developers can rapidly accelerate application development and adopt a modular structure by reusing and reassembling existing modules without building from scratch. They can embed one structure inside another in an intuitive way while preserving localism, and the language specification is simple, successfully balancing practicality and minimalism.

The Go language is so well designed that the Gno smart contract system will become the new gold standard for smart contract development and other blockchain applications. As a programming language that is universally adopted, secure, composable, and complete, Gno is essential for the broader adoption of web3 and its sustainable growth.
leohhhn marked this conversation as resolved.
Show resolved Hide resolved
47 changes: 47 additions & 0 deletions docs/explanation/gno-modules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
id: gno-modules
---

# Gno Modules

The packages and realms containing `gno.mod` file can be reffered as Gno modules. `gno.mod` file is introduced to enhance local testing and handle dependency management while testing Gno packages/realms locally. While it primarily serves local development and testing purposes, blockchain do not recognize or utilize this file directly.
zivkovicmilos marked this conversation as resolved.
Show resolved Hide resolved

## What Is the gno.mod File for?
leohhhn marked this conversation as resolved.
Show resolved Hide resolved

`gno.mod` file is a critical for local testing and development. Its primary purposes include:
zivkovicmilos marked this conversation as resolved.
Show resolved Hide resolved

- **Local Dependency Management**: The gno.mod file allows you to manage local dependencies effectively when developing God Modules. This facilitates testing and iterative development.

- **Module Sorting while Publishing**: Additionally, the gno.mod file is used to sort and automatically publish modules that are located within the `/examples` directory to the blockchain when the chain starts.

- **Configuration and Metadata (Potential Future Use)**: While the gno.mod file is currently used for specifying dependencies, it's worth noting that in the future, it might also serve as a container for additional configuration and metadata related to Gno Modules. This could include information such as module descriptions, veriosn, authorship details, or licensing information. (See: https://github.com/gnolang/gno/issues/498)
zivkovicmilos marked this conversation as resolved.
Show resolved Hide resolved

## Gno Modules and Subdirectories

It's important to note that Gno Modules do not include subdirectories. Each directory within your project is treated as an individual Gno Module, and each should contain its own gno.mod file, even if it's located within an existing Gno Module directory.

thehowl marked this conversation as resolved.
Show resolved Hide resolved
## Available gno Commands

The gno command-line tool provides several commands to work with the gno.mod file and manage dependencies in Gno Modules:

- `gno mod init`: Initializes a new `gno.mod` file. Allowing you to specify dependencies.

- **gno mod download**: Downloads the dependencies specified in the gno.mod file. This command fetches the required dependencies from chain and ensures they are available for local testing and development.

- **gno mod tidy**: This command helps maintain the cleanliness of the gno.mod file by removing any unused dependencies and automatically adds any dependencies that are required but not yet listed in the gno.mod file. It ensures that your gno.mod file remains up-to-date and free from unnecessary clutter, eliminating the need for manual maintenance.
zivkovicmilos marked this conversation as resolved.
Show resolved Hide resolved

## Sample `gno.mod` file

```
module gno.land/p/demo/sample

require (
gno.land/p/demo/avl v0.0.0-latest
gno.land/p/demo/testutils v0.0.0-latest
)

```

- **`module gno.land/p/demo/sample`**: Specifies the package/realm import path.

- **`require` Block**: Lists the required dependencies. Here using the latest available versions of "gno.land/p/demo/avl" and "gno.land/p/demo/testutils". These dependencies should be specified with the version "v0.0.0-latest" since as of now on-chain packages do not support versioning.
zivkovicmilos marked this conversation as resolved.
Show resolved Hide resolved
82 changes: 82 additions & 0 deletions docs/explanation/gno-test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
id: gno-test
---

# Gno Test

There are two methods for testing a realm or package during the development phase:

1. Calling the realm/package after deploying it on a local network (or testnet).
2. Using the `test` option within the [`gno`](./gno-tooling/cli/gno.md) CLI.

While the first method is recommended for its accuracy and similarity to the actual deployment environment, it is more efficient to initially utilize the second method for composing test cases and then proceed to the first method if no errors are detected.

This section will teach you how to use the second method.

Writing test cases in Gnolang is similar to that of Golang, with general rules as the following:

* Test file naming conventions must be adhered to (ex: `xxx_test.gno`).
* Test functions must start with `Test`.
* The `t *testing.T` argument must be included in each test function.
* The `testing` package must be imported.
* Tests must be run with the `gno test` command.

Let's write a sample code and test it.

```go
// contract.gno

package demo

func Hello(name string) string {
return "Hello " + name + "!"
}
```

This is a simple code that returns the string-typed argument in a specific format.

Next, we'll write a test case that looks like the following:

```go
// contract_test.gno

package demo

import "testing"

func Test(t *testing.T) {
{
got := Hello("People")
expected := "Hello People!"
if got != expected {
t.Fatalf("expected %q, got %q.", expected, got)
}
}
{
got := Hello("")
expected := "Hello People!"
if got != expected {
t.Fatalf("expected %q, got %q.", expected, got)
}
}
}
```

Two conditions exist in the test case above.

1. "Hello People!" should be returned when calling `Hello("People")`.
2. "Hello People!" should be returned when calling `Hello("")`.

Upon examination of our realm code and the associated test results, the initial condition exhibited the desired behavior; however, an error was identified in the second condition. Despite the expected outcome of "Hello" being returned, the test case incorrectly specified that the expected output should be "Hello People!" instead.

Replacing the second test case with the following will successfully fix the issue and allow the test to pass.

```go
{
got := Hello("")
expected := "Hello !"
if expected != got {
t.Fatalf("expected %q, got %q.", expected, got)
}
}
```
16 changes: 16 additions & 0 deletions docs/explanation/gno-tooling/cli/common-params.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
id: gno-tooling-common-params
---

# Common Parameters

Below is a list of common parameters.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure about the file's usefulness. Shouldn't we keep it as a section within a binary document instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped as part of:

#1046 (comment)


| Name | Description | Default |
| ------------------------- | ------------------------------------ | ---------------------------------------- |
| `home` | The home directory. | `GNO_HOME` or the user's home directory. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check with latest changes if it's still appropriate?

cc @thehowl @gfanton

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gfanton wants to change this in #1233 to GNOHOME.

plus, some issues:

  • home is actually not a "frequent" flag as far as I can see (we only have it in gnokey, and maybe gnofaucet?). and even then, I tend to think that for this one we should have a long-term plan of not having it as a flag, and instead just use the env variable value.
  • "the user's home directory" is wrong, "the subdirectory .gno in the user's config directory" is right

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've thought about this a bit, and I think we should probably just drop the common params doc, since it has a huge risk of going outdated. I am considering doing the same for all "tools" in the tooling section (their --help outputs are the most up-to-date documentation anyways)

00cbe6d

| `remote` | The remote node URL. | `127.0.0.1:26657` |
| `quiet` | For parsing output. | `false` |
zivkovicmilos marked this conversation as resolved.
Show resolved Hide resolved
| `insecure-password-stdin` | INSECURE! Takes password from stdin. | `false` |


66 changes: 66 additions & 0 deletions docs/explanation/gno-tooling/cli/gno.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
id: gno-tooling-gno
---

# gno

`gno` is a handy tool for developing and prototyping Gno packages and realms. You may use `gno` to use the GnoVM without an actual blockchain to build or test realms in a local environment.

## Run `gno` Commands

The following command will run `gno`.

```bash
gno {SUB_COMMAND}
```

**Subcommands**

| Name | Description |
| ------------ | ------------------------------------------ |
| `build` | Builds a gno package. |
| `test` | Tests a gno package. |
| `precompile` | Precompiles a `.gno` file to a `.go` file. |
| `repl` | Starts a GnoVM REPL. |

### `build`

#### **Options**

| Name | Type | Description |
| --------- | ------- | ---------------------------------------------- |
| `verbose` | Boolean | Displays extended information. |
| go-binary | String | Go binary to use for building (default: `go`). |

### `test`

#### **Options**

| Name | Type | Description |
| ------------ | ------------- | ------------------------------------------------------------------ |
| `verbose` | Boolean | Displays extended information. |
| `root-dir` | String | Clones location of github.com/gnolang/gno (gno tries to guess it). |
| `run` | String | Test name filtering pattern. |
| `timeout` | time.Duration | The maximum execution time in ns. |
| `precompile` | Boolean | Precompiles a `.gno` file to a `.go` file before testing. |

### `precompile`

#### **Options**

| Name | Type | Description |
| ----------- | ------- | --------------------------------------------------------------- |
| `verbose` | Boolean | Displays extended information. |
| `skip-fmt` | Boolean | Skips the syntax checking of generated `.go` files. |
| `go-binary` | String | The go binary to use for building (default: `go`). |
| `go-binary` | String | The gofmt binary to use for syntax checking (default: `gofmt`). |
| `output` | String | The output directory (default: `.`). |

### `repl`

#### **Options**

| Name | Type | Description |
| ---------- | ------- | ------------------------------------------------------------------ |
| `verbose` | Boolean | Displays extended information. |
| `root-dir` | String | Clones location of github.com/gnolang/gno (gno tries to guess it). |
53 changes: 53 additions & 0 deletions docs/explanation/gno-tooling/cli/gnofaucet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
id: gno-tooling-gnofaucet
---

# gnofaucet

`gnofaucet` is a server for distributing GNOT, the gas currency of Gnoland, to specific addresses in a local chain. Interact with the `gnofaucet` from an address with an empty balance in your locally built testnet to fuel it with GNOT to pay for transactions.

## Run `gnofaucet` Commands

Enable the faucet using the following command.

```bash
gnofaucet serve
```

#### **Options**

| Name | Type | Description |
| ------------------------- | ------- | ------------------------------------------------------------------------------------ |
| `chain-id` | String | The id of the chain (required). |
| `gas-wanted` | Int64 | The maximum amount of gas to use for the transaction (default: `50000`) |
| `gas-fee` | String | The gas fee to pay for the transaction. |
| `memo` | String | Any descriptive text (default: `""`) |
| `test-to` | String | Test address (optional) 부연설명 필요 |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

부연설명 필요

Is this in the code?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like typo from our dev portal, we can get rid of it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed:

6bf83af

| `send` | String | Coins to send (default: `"1000000ugnot"`). |
| `captcha-secret` | String | The secret key for the recaptcha. If empty, the captcha is disabled (default: `""`). |
| `is-behind-proxy` | Boolean | Uses X-Forwarded-For IP for throttling (default: `false`). |
| `insecure-password-stdin` | Boolean | INSECURE! Takes password from stdin (default: `false`). |

## Example

### Step 1. Create an account named `test1` with the test seed phrase below.

```bash
gnokey add test1 --recover
```

> **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

### **Step 2. Run `gnofaucet`**

```bash
gnofaucet serve test1 --chain-id dev --send 500000000ugnot
```

### **Step 3. Receive GNOTs from the faucet**

```bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a form, I suggest prioritizing opening the browser as the first option before suggesting the curl method.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added:

969e914

curl --location --request POST 'http://localhost:5050' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'toaddr={address to receive}'
```
Loading
Loading