-
Notifications
You must be signed in to change notification settings - Fork 667
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
SDK docs ref cli #2741
Merged
Merged
SDK docs ref cli #2741
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,104 @@ | ||
//! # Command Line Arguments | ||
//! # Substrate CLI | ||
//! | ||
//! Let's see some examples of typical CLI arguments used when setting up and running a | ||
//! Substrate-based blockchain. We use the [`substrate-node-template`](https:/substrate-developer-hub/substrate-node-template) | ||
//! on these examples. | ||
//! | ||
//! Notes: | ||
//! #### Checking the available CLI arguments | ||
//! ```bash | ||
//! ./target/debug/node-template --help | ||
//! ``` | ||
//! - `--help`: Displays the available CLI arguments. | ||
//! | ||
//! - Command line arguments of a typical substrate based chain, and how to find and learn them. | ||
//! - How to extend them with your custom stuff. | ||
//! #### Starting a Local Substrate Node in Development Mode | ||
//! ```bash | ||
//! ./target/release/node-template \ | ||
//! --dev | ||
//! ``` | ||
//! - `--dev`: Runs the node in development mode, using a pre-defined development chain | ||
//! specification. | ||
//! This mode ensures a fresh state by deleting existing data on restart. | ||
//! | ||
//! #### Generating Custom Chain Specification | ||
//! ```bash | ||
//! ./target/debug/node-template \ | ||
//! build-spec \ | ||
//! --disable-default-bootnode \ | ||
//! --chain local \ | ||
//! > customSpec.json | ||
//! ``` | ||
//! | ||
//! - `build-spec`: A subcommand to generate a chain specification file. | ||
//! - `--disable-default-bootnode`: Disables the default bootnodes in the node template. | ||
//! - `--chain local`: Indicates the chain specification is for a local development chain. | ||
//! - `> customSpec.json`: Redirects the output into a customSpec.json file. | ||
//! | ||
//! #### Converting Chain Specification to Raw Format | ||
//! ```bash | ||
//! ./target/debug/node-template build-spec \ | ||
//! --chain=customSpec.json \ | ||
//! --raw \ | ||
//! --disable-default-bootnode \ | ||
//! > customSpecRaw.json | ||
//! ``` | ||
//! | ||
//! - `--chain=customSpec.json`: Uses the custom chain specification as input. | ||
//! - `--disable-default-bootnode`: Disables the default bootnodes in the node template. | ||
//! - `--raw`: Converts the chain specification into a raw format with encoded storage keys. | ||
//! - `> customSpecRaw.json`: Outputs to customSpecRaw.json. | ||
//! | ||
//! #### Starting the First Node in a Private Network | ||
//! ```bash | ||
//! ./target/debug/node-template \ | ||
//! --base-path /tmp/node01 \ | ||
//! --chain ./customSpecRaw.json \ | ||
//! --port 30333 \ | ||
//! --ws-port 9945 \ | ||
//! --rpc-port 9933 \ | ||
//! --telemetry-url "wss://telemetry.polkadot.io/submit/ 0" \ | ||
//! --validator \ | ||
//! --rpc-methods Unsafe \ | ||
//! --name MyNode01 | ||
//! ``` | ||
//! | ||
//! - `--base-path`: Sets the directory for node data. | ||
//! - `--chain`: Specifies the chain specification file. | ||
//! - `--port`: TCP port for peer-to-peer communication. | ||
//! - `--ws-port`: WebSocket port for RPC. | ||
//! - `--rpc-port`: HTTP port for JSON-RPC. | ||
//! - `--telemetry-url`: Endpoint for sending telemetry data. | ||
//! - `--validator`: Indicates the node’s participation in block production. | ||
//! - `--rpc-methods Unsafe`: Allows potentially unsafe RPC methods. | ||
//! - `--name`: Sets a human-readable name for the node. | ||
//! | ||
//! #### Adding a Second Node to the Network | ||
//! ```bash | ||
//! ./target/release/node-template \ | ||
//! --base-path /tmp/bob \ | ||
//! --chain local \ | ||
//! --bob \ | ||
//! --port 30334 \ | ||
//! --rpc-port 9946 \ | ||
//! --telemetry-url "wss://telemetry.polkadot.io/submit/ 0" \ | ||
//! --validator \ | ||
//! --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nodes should find each other using mdns. Maybe we should only say that this command needs to be used if they don't find each other. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, I've added the comment |
||
//! ``` | ||
//! | ||
//! - `--base-path`: Sets the directory for node data. | ||
//! - `--chain`: Specifies the chain specification file. | ||
//! - `--bob`: Initializes the node with the session keys of the "Bob" account. | ||
//! - `--port`: TCP port for peer-to-peer communication. | ||
//! - `--rpc-port`: HTTP port for JSON-RPC. | ||
//! - `--telemetry-url`: Endpoint for sending telemetry data. | ||
//! - `--validator`: Indicates the node’s participation in block production. | ||
//! - `--bootnodes`: Specifies the address of the first node for peer discovery. Nodes should find | ||
//! each other using mDNS. This command needs to be used if they don't find each other. | ||
//! | ||
//! --- | ||
//! | ||
//! > If you are interested in learning how to extend the CLI with your custom arguments, you can | ||
//! > check out the [Customize your Substrate chain CLI](https://www.youtube.com/watch?v=IVifko1fqjw) | ||
//! > seminar. | ||
//! > Please note that the seminar is based on an older version of Substrate, and [Clap](https://docs.rs/clap/latest/clap/) | ||
//! > is now used instead of [StructOpt](https://docs.rs/structopt/latest/structopt/) for parsing | ||
//! > CLI arguments. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should link to this Rust type to avoid any repetition or inaccurate info.
In other words, there should only be one source of truth for what
--dev
means, which is here. A short paraphrasing is okay, but let's link to it.Same can be applied for technically every other arg mentioned here. Please make sure at least the important ones are linked to the proper Rust type, and that the Rust type is well documented.