Skip to content

Commit

Permalink
docs: inline documentation for ignite chain (ignite#2751)
Browse files Browse the repository at this point in the history
* docs: inline documentation for ignite chain

* moved things around

Co-authored-by: Alex Johnson <[email protected]>
  • Loading branch information
fadeev and Alex Johnson authored Aug 19, 2022
1 parent f542a59 commit d714782
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 12 deletions.
53 changes: 50 additions & 3 deletions ignite/cmd/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,56 @@ import "github.com/spf13/cobra"
// blockchains and so on.
func NewChain() *cobra.Command {
c := &cobra.Command{
Use: "chain [command]",
Short: "Build, initialize and start a blockchain node or perform other actions on the blockchain",
Long: `Build, initialize and start a blockchain node or perform other actions on the blockchain.`,
Use: "chain [command]",
Short: "Build, initialize and start a blockchain node or perform other actions on the blockchain",
Long: `Commands in this namespace let you to build, initialize, and start your
blockchain node locally for development purposes.
To run these commands you should be inside the project's directory so that
Ignite can find the source code. To ensure that you are, run "ls", you should
see the following files in the output: "go.mod", "x", "proto", "app", etc.
By default the "build" command will identify the "main" package of the project,
install dependencies if necessary, set build flags, compile the project into a
binary and install the binary. The "build" command is useful if you just want
the compiled binary, for example, to initialize and start the chain manually. It
can also be used to release your chain's binaries automatically as part of
continuous integration workflow.
The "init" command will build the chain's binary and use it to initialize a
local validator node. By default the validator node will be initialized in your
$HOME directory in a hidden directory that matches the name of your project.
This directory is called a data directory and contains a chain's genesis file
and a validator key. This command is useful if you want to quickly build and
initialize the data directory and use the chain's binary to manually start the
blockchain. The "init" command is meant only for development purposes, not
production.
The "serve" command builds, initializes, and starts your blockchain locally with
a single validator node for development purposes. "serve" also watches the
source code directory for file changes and intelligently
re-builds/initializes/starts the chain, essentially providing "code-reloading".
The "serve" command is meant only for development purposes, not production.
To distinguish between production and development consider the following.
In production, blockchains often run the same software on many validator nodes
that are run by different people and entities. To launch a blockchain in
production, the validator entities coordinate the launch process to start their
nodes simultaneously.
During development, a blockchain can be started locally on a single validator
node. This convenient process lets you restart a chain quickly and iterate
faster. Starting a chain on a single node in development is similar to starting
a traditional web application on a local server.
The "faucet" command lets you send tokens to an address from the "faucet"
account defined in "config.yml". Alternatively, you can use the chain's binary
to send token from any other account that exists on chain.
The "simulate" command helps you start a simulation testing process for your
chain.
`,
Aliases: []string{"c"},
Args: cobra.ExactArgs(1),
}
Expand Down
35 changes: 26 additions & 9 deletions ignite/cmd/scaffold_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,45 @@ func NewScaffoldChain() *cobra.Command {
Short: "Fully-featured Cosmos SDK blockchain",
Long: `Create a new application-specific Cosmos SDK blockchain.
For example, the following command will create a blockchain called "hello" in the "hello/" directory:
For example, the following command will create a blockchain called "hello" in
the "hello/" directory:
ignite scaffold chain hello
A project name can be a simple name or a URL. The name will be used as the Go module path for the project. Examples of project names:
A project name can be a simple name or a URL. The name will be used as the Go
module path for the project. Examples of project names:
ignite scaffold chain foo
ignite scaffold chain foo/bar
ignite scaffold chain example.org/foo
ignite scaffold chain github.com/username/foo
A new directory with source code files will be created in the current directory. To use a different path use the "--path" flag.
Most of the logic of your blockchain is written in custom modules. Each module effectively encapsulates an independent piece of functionality. Following the Cosmos SDK convention, custom modules are stored inside the "x/" directory. By default, Ignite creates a module with a name that matches the name of the project. To create a blockchain without a default module use the "--no-module" flag. Additional modules can be added after a project is created with "ignite scaffold module" command.
Account addresses on Cosmos SDK-based blockchains have string prefixes. For example, the Cosmos Hub blockchain uses the default "cosmos" prefix, so that addresses look like this: "cosmos12fjzdtqfrrve7zyg9sv8j25azw2ua6tvu07ypf". To use a custom address prefix use the "--address-prefix" flag. For example:
A new directory with source code files will be created in the current directory.
To use a different path use the "--path" flag.
Most of the logic of your blockchain is written in custom modules. Each module
effectively encapsulates an independent piece of functionality. Following the
Cosmos SDK convention, custom modules are stored inside the "x/" directory. By
default, Ignite creates a module with a name that matches the name of the
project. To create a blockchain without a default module use the "--no-module"
flag. Additional modules can be added after a project is created with "ignite
scaffold module" command.
Account addresses on Cosmos SDK-based blockchains have string prefixes. For
example, the Cosmos Hub blockchain uses the default "cosmos" prefix, so that
addresses look like this: "cosmos12fjzdtqfrrve7zyg9sv8j25azw2ua6tvu07ypf". To
use a custom address prefix use the "--address-prefix" flag. For example:
ignite scaffold chain foo --address-prefix bar
By default when compiling a blockchain's source code Ignite creates a cache to speed up the build process. To clear the cache when building a blockchain use the "--clear-cache" flag. It is very unlikely you will ever need to use this flag.
By default when compiling a blockchain's source code Ignite creates a cache to
speed up the build process. To clear the cache when building a blockchain use
the "--clear-cache" flag. It is very unlikely you will ever need to use this
flag.
The blockchain is using the Cosmos SDK modular blockchain framework. Learn more about Cosmos SDK on https://docs.cosmos.network`,
The blockchain is using the Cosmos SDK modular blockchain framework. Learn more
about Cosmos SDK on https://docs.cosmos.network
`,
Args: cobra.ExactArgs(1),
RunE: scaffoldChainHandler,
}
Expand Down

0 comments on commit d714782

Please sign in to comment.