Skip to main content
The thru 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

Create a new named network profile

Set Default

Choose which profile to use by default

Update

Modify an existing network profile

List

Show all configured profiles

Remove

Delete a network profile

Add Network

Create a new named network profile with an RPC endpoint URL and optional authorization token.
thru 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 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 network set-default $NAME
NAME
string
required
Name of an existing network profile to use as the default.
Example:
thru 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 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 network set local --url http://localhost:9000

List Networks

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

Remove Network

Delete a network profile from the configuration. If the removed profile was the default, the default is cleared.
thru network rm $NAME
NAME
string
required
Name of the network profile to remove.
Example:
thru 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 --network mainnet getversion

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

Common Workflow

1

Add your network profiles

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

Set your default

thru network set-default local
3

Run commands against the default

thru getversion
thru getbalance
4

Switch networks when needed

thru --network mainnet getbalance