Skip to content

Comments

Add stellar network id to return the network id.#2407

Open
fnando wants to merge 4 commits intomainfrom
stellar-network-id
Open

Add stellar network id to return the network id.#2407
fnando wants to merge 4 commits intomainfrom
stellar-network-id

Conversation

@fnando
Copy link
Member

@fnando fnando commented Feb 20, 2026

What

# Defaults to testnet, as every other command
$ stellar network id
cee0302d59844d32bdca915c8203dd44b33fbb7edc19051ea37abedf28ecd472

# Respects default network
$ stellar network use local
ℹ️ The default network is set to `local`

$ stellar network id
baefd734b8d3e48472cff83912375fedbc7573701912fe308af730180f97d74a

# Explicit usage
$ stellar network id --network testnet
cee0302d59844d32bdca915c8203dd44b33fbb7edc19051ea37abedf28ecd472

# Formatted JSON
$ stellar network id --output json-formatted
{
  "id": "baefd734b8d3e48472cff83912375fedbc7573701912fe308af730180f97d74a",
  "network_passphrase": "Standalone Network ; February 2017"
}

# One-line JSON
$ stellar network id --output json
{"id":"baefd734b8d3e48472cff83912375fedbc7573701912fe308af730180f97d74a","network_passphrase":"Standalone Network ; February 2017"}

Why

Implement #2390.

Known limitations

N/A

@fnando fnando self-assigned this Feb 20, 2026
Copilot AI review requested due to automatic review settings February 20, 2026 17:24
@fnando fnando added enhancement New feature or request cli Related to Soroban CLI labels Feb 20, 2026
@fnando fnando added this to DevX Feb 20, 2026
@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Feb 20, 2026
@fnando fnando moved this from Backlog (Not Ready) to Needs Review in DevX Feb 20, 2026
@fnando fnando force-pushed the stellar-network-id branch from eb17dee to f0c8ff9 Compare February 20, 2026 17:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new stellar network id command that outputs the network ID (SHA-256 hash of the network passphrase), implementing issue #2390. This command addresses a common pain point where users had to manually compute the network ID using shell tools like sha256sum, which was error-prone.

Changes:

  • Adds a new stellar network id subcommand with support for plain text and JSON output formats
  • Integrates the command into the network module with proper error handling
  • Includes a basic integration test to verify the command works with testnet
  • Updates the CLI documentation with the new command usage

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
cmd/soroban-cli/src/commands/network/mod.rs Registers the new id subcommand in the network module enum and error handling
cmd/soroban-cli/src/commands/network/id.rs Implements the network ID command with SHA-256 hashing and multiple output formats
cmd/crates/soroban-test/tests/it/integration/network.rs Adds integration test to verify the network ID command works correctly
FULL_HELP_DOCS.md Documents the new command including options and usage examples

@fnando fnando force-pushed the stellar-network-id branch from 12683ef to 3bf299d Compare February 20, 2026 20:14
@leighmcculloch
Copy link
Member

# Formatted JSON
$ stellar network id --output json-formatted
{
  "id": "baefd734b8d3e48472cff83912375fedbc7573701912fe308af730180f97d74a",
  "network_passphrase": "Standalone Network ; February 2017"
}

Maybe this command should be stellar network info that returns a bundle of information. Or, we should add another command stellar network passphrase that returns just the phassphrase text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Related to Soroban CLI enhancement New feature or request

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

3 participants