Skip to main content
The thru-cli network command manages named network profiles, letting you configure and switch between different RPC endpoints without editing config files manually.
Network profiles are stored in your CLI configuration at ~/.thru/cli/config.yaml. You can also override the RPC URL for any single command with the --url flag.

Prerequisites

Command Overview

Add Network

Create a new named network profile with an RPC endpoint URL and optional authorization token.
thru-cli network add <NAME> --url <URL> [OPTIONS]
NAME
string
required
Profile name (case-insensitive). Used to reference this network in other commands.
--url
string
required
RPC endpoint URL for this network (e.g., http://localhost:8899 or https://rpc.thru.dev).
--auth-token
string
Optional authorization token included with RPC requests to this endpoint.
Example:
thru-cli network add local --url http://localhost:8899
If a profile with the same name already exists, the command fails. Use network set to modify an existing profile.

Set Default

Set which network profile the CLI uses when no --network or --url flag is provided.
thru-cli network set-default <NAME>
NAME
string
required
Name of an existing network profile to use as the default.
Example:
thru-cli network set-default mainnet
The default network is stored in your config file and persists across CLI sessions. You can always override it per-command with --network <name> or --url <url>.

Update Network

Update the URL or authorization token on an existing network profile.
thru-cli network set <NAME> [OPTIONS]
NAME
string
required
Name of the network profile to update.
--url
string
New RPC endpoint URL.
--auth-token
string
New authorization token. Pass an empty string ("") to clear the token.
Example:
thru-cli network set local --url http://localhost:9000

List Networks

Display all configured network profiles, including which one is set as the default.
thru-cli network list
Example:
thru-cli network list

Remove Network

Delete a network profile from the configuration. If the removed profile was the default, the default is cleared.
thru-cli network rm <NAME>
NAME
string
required
Name of the network profile to remove.
Example:
thru-cli network rm local
If the removed profile is currently the default, the default is cleared and you will need to set a new default or provide --network/--url on subsequent commands.

Per-Command Overrides

Any CLI command accepts these flags to override the network for a single invocation, without changing your saved profiles:
# Use a specific saved profile
thru-cli --network mainnet getversion

# Use an arbitrary URL
thru-cli --url http://localhost:8899 getversion

Common Workflow

1

Add your network profiles

thru-cli network add local --url http://localhost:8899
thru-cli network add testnet --url https://testnet.thru.dev
thru-cli network add mainnet --url https://rpc.thru.dev --auth-token mytoken
2

Set your default

thru-cli network set-default local
3

Run commands against the default

thru-cli getversion
thru-cli getbalance
4

Switch networks when needed

thru-cli --network mainnet getbalance