Deep Dive into Soroban-CLI : soroban config
Tags: soroban, sorobanathon, smartcontract, stellar
Published: 2023-03-19 16:56:56

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
```
Usage Example :

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

```
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
```
Usage Example :

```
$ soroban config identity address TestAcc
GBCU5KI46R5NQBW3S2ILUR6RN6RXZIEAXN4U6JN3YBL42XLDTKZMBS4W
```

- **`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
```
Usage Example :

```
soroban config identity generate TestAcc2
```

- **`ls`**

This subcommand will show all registered identity
Usage : 

```
soroban config identity ls
```
Usage Example :

```
$ soroban config identity ls
TestAcc
TestAcc2
```
- **`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>
```
Usage Example :

```
$ soroban config identity rm TestAcc2
$ soroban config identity ls
TestAcc
```

##`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>
```
Usage Example :

```
$ soroban config network add --rpc-url https://rpc-futurenet.stellar.org:443/ --network-passphrase "Test SDF Future Network ; October 2022" Futurenet 
```

- **`ls`**
This subcommand is used to list all registered network
Usage :
```
soroban config network ls
```
Usage Example :
```
$ soroban config network ls
Futurenet
local
```

- **`rm`**

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

```
soroban config network rm <NAME>
```
Usage Example :

```
$soroban config network rm Futurenet
$soroban config network ls
local
```

##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!