DEV Community

darkvallen
darkvallen

Posted on

Deep Dive into Soroban-CLI : soroban config

Hi there! This is the second post of the "Deep Dive into Soroban-CLI" series where we'll explore the soroban-cli in depth. Soroban-CLI is a command-line tool for interacting with soroban smart contracts on the Stellar network. Soroban-CLI provides a set of subcommands that can be used to perform various tasks related to smart contract development and deployment on the Stellar network.

Previously i already explained usage and usage example of each soroban contract subcommands, and in this post i will explaining soroban config subcommands.

soroban config Subcommands

The soroban config subcommand is used to read and modify your Soroban-CLI configuration that are related to identity and network configuration.

There's only 2 subcommands for soroban config :

  • identity
  • network

soroban config identity Subcommands

The soroban config identity subcommand is used to manage identifiers used by Soroban-CLI for any operation that needed identifier such as deploying,invoking contract,and more. Here is the soroban config identity subcommands :

  • add

This subcommand used to add a new identifier.
Usage :

soroban config identity add [OPTIONS] <NAME>

ARGS:
    <NAME>    Name of identity

OPTIONS:
        --secret-key     Add using secret_key
        --seed-phrase    Add using 12 word seed phrase to generate secret_key
        --global         Use global config
Enter fullscreen mode Exit fullscreen mode

Usage Example :

$ soroban config identity add --secret-key TestAcc
Type a secret key: 

Enter fullscreen mode Exit fullscreen mode

Note : When typing secret key it won't be visible (or you could paste it too)

  • address

This subcommand will show Public key of registered identity.
Usage :

soroban config identity address [OPTIONS] <NAME>

ARGS:
    <NAME>    Name of identity to lookup

OPTIONS:
        --hd-path <HD_PATH>    If identity is a seed phrase use this hd path, default is 0
Enter fullscreen mode Exit fullscreen mode

Usage Example :

$ soroban config identity address TestAcc
GBCU5KI46R5NQBW3S2ILUR6RN6RXZIEAXN4U6JN3YBL42XLDTKZMBS4W
Enter fullscreen mode Exit fullscreen mode
  • generate

This subcommand will generate a new identity with its public key automatically.
Usage :

soroban config identity generate [OPTIONS] <NAME>

ARGS:
    <NAME>    Name of identity

OPTIONS:
    -s, --seed <SEED>    Optional seed to use when generating seed phrase. Random otherwise
        --global         Use global config
Enter fullscreen mode Exit fullscreen mode

Usage Example :

soroban config identity generate TestAcc2
Enter fullscreen mode Exit fullscreen mode
  • ls

This subcommand will show all registered identity
Usage :

soroban config identity ls
Enter fullscreen mode Exit fullscreen mode

Usage Example :

$ soroban config identity ls
TestAcc
TestAcc2
Enter fullscreen mode Exit fullscreen mode
  • rm

This subcommand will remove the identifier with the given name of the identifier. Removing identities is useful to revoke access or clean up unused identifiers.
Usage :

soroban config identity rm  <NAME>
Enter fullscreen mode Exit fullscreen mode

Usage Example :

$ soroban config identity rm TestAcc2
$ soroban config identity ls
TestAcc
Enter fullscreen mode Exit fullscreen mode

soroban config network subcommands

The soroban config network subcommand is used to manage network configuration used by Soroban-CLI for any operation that needed network identifier such as deploying,invoking contract,and more. Here is the soroban config identity subcommands :

  • add

This subcommand is used to add a new network identifier.
Usage :

soroban config network add --rpc-url <RPC_URL> --network-passphrase <NETWORK_PASSPHRASE> <NAME>
Enter fullscreen mode Exit fullscreen mode

Usage Example :

$ soroban config network add --rpc-url https://rpc-futurenet.stellar.org:443/ --network-passphrase "Test SDF Future Network ; October 2022" Futurenet 
Enter fullscreen mode Exit fullscreen mode
  • ls This subcommand is used to list all registered network Usage :
soroban config network ls
Enter fullscreen mode Exit fullscreen mode

Usage Example :

$ soroban config network ls
Futurenet
local
Enter fullscreen mode Exit fullscreen mode
  • rm

This subcommand is used to remove a network with given name of the network.
Usage :

soroban config network rm <NAME>
Enter fullscreen mode Exit fullscreen mode

Usage Example :

$soroban config network rm Futurenet
$soroban config network ls
local
Enter fullscreen mode Exit fullscreen mode

Closing

The soroban config subcommands provides capability to manage your Soroban-CLI configuration that are related to identity and network configuration. By using these subcommands, you can easily manage identity and network configuration. I will explain the other main subcommands in the next post of this series. Happy Sorobaning!

Oldest comments (0)