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).
What problem does your feature solve?
Getting the network ID (the SHA-256 hash of the network passphrase) currently requires piping the passphrase through
sha256summanually. 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 idcommand that outputs the network ID for a given network. For example:What alternatives are there?
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).