Skip to content

Add stellar network id command to output the network ID #2390

@leighmcculloch

Description

@leighmcculloch

What problem does your feature solve?

Getting the network ID (the SHA-256 hash of the network passphrase) currently requires piping the passphrase through sha256sum manually. For example, in quickstart:

NETWORK_ID=$(printf "$NETWORK_PASSPHRASE" | sha256sum | cut -f 1 -d " ")

This is a common operation needed in scripts and tooling that deal with network setup and transaction signing, and it would be convenient to have it built into the CLI.

Related: #2389

What would you like to see?

Add a stellar network id command that outputs the network ID for a given network. For example:

$ stellar network id --network testnet
cee0302d59844d32bdca915c8203dd44b33fbb7edc19051ea37abedf28ecd472

What alternatives are there?

  • Compute it manually with shell tools: printf "$NETWORK_PASSPHRASE" | sha256sum | cut -f 1 -d " ". This works but requires knowing the passphrase and is easy to get wrong (e.g. trailing newline issues).

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions