CLI supports 2 execution modes:
- Interactive:
- In this mode CLI reads commands from terminal interactively.
- To start this mode just run
indy-cli-rs
without params.
- Batch:
- In this mode all commands will be read from a text file or pipe and executed in series.
- To start this mode run
indy-cli-rs <path-to-text-file>
. - Batch mode supports the same commands as interactive mode.
- Note that by default if some command finishes with an error batch execution will be interrupted.
- To prevent this start command with
-
. - For example,
-wallet create test
. In this case the result of this command will be ignored.
- To prevent this start command with
- To make a comment in the batch script start the line with the
#
symbol.
Command format
indy-cli-rs> [<group>] <command> [[<main_param_name>=]<main_param_value>] [<param_name1>=<param_value1>] ... [<param_nameN>=<param_valueN>]
Print list of groups with group help:
indy-cli-rs> help
Print list of group commands with command help:
indy-cli-rs> <group> help
Example:
indy-cli-rs> wallet help
Print command help, list of command param and help for each param:
indy-cli-rs> <group> <command> help
Example:
indy-cli-rs> wallet create help
Print about and license info:
indy-cli-rs> about
Exit from CLI:
indy-cli-rs> exit
Change command prompt:
indy-cli-rs> prompt <new_prompt>
Example:
indy-cli-rs> prompt my
Print content of file:
indy-cli-rs> show [<file_path>]
Example:
indy-cli-rs> show /path/to/file.txt
indy-cli-rs> wallet <command>
Create new wallet and attach to CLI:
indy-cli-rs> wallet create <wallet name> key [key_derivation_method=<key_derivation_method>] [storage_type=<storage_type>] [storage_config={config json}]
// Example - Create Sqlite wallet with `wallet1` name, `key1` storage key, default key derivation methon (argon2m), and empty config/credentials
indy-cli-rs> wallet create wallet1 key=key1
// Example - Create Postgres wallet with `wallet_pstg` name, `key1` storage key, default key derivation methon (argon2m), and provided postgres config/credentials
indy-cli-rs> wallet create wallet_pstg key=key1 storage_type=postgres_storage storage_config={"url":"localhost:5432"} storage_credentials={"account":"postgres","password":"mysecretpassword","admin_account":"postgres","admin_password":"mysecretpassword"}
Attach existing wallet to Indy CLI:
indy-cli-rs> wallet attach <wallet name> [storage_type=<storage_type>] [storage_config={config json}]
// Example - Attach `wallet1` wallet to CLI
indy-cli-rs> wallet attach wallet1
Open the wallet with specified name and make it available for commands that require wallet. If there was opened wallet it will be closed:
indy-cli-rs> wallet open <wallet name> key [key_derivation_method=<key_derivation_method>] [rekey] [rekey_derivation_method=<rekey_derivation_method>]
// Example - Open Sqlite wallet with `wallet1` name, `key1` key, default key derivation methon (argon2m), and empty config/credentials
indy-cli-rs> wallet open wallet1 key=key1
// Example - Open Postgres wallet with `wallet_pstg` name, `key1` key, default key derivation methon (argon2m), and provided postgres config/credentials
indy-cli-rs> wallet open wallet_pstg key=key1 storage_credentials={"account":"postgres","password":"mysecretpassword","admin_account":"postgres","admin_password":"mysecretpassword"}
Close the opened wallet
indy-cli-rs> wallet close
Delete the wallet
indy-cli-rs> wallet delete <wallet name> key [key_derivation_method=<key_derivation_method>]
// Example - Delete `wallet1` wallet
indy-cli-rs> wallet delete wallet1 key=key1
Detach wallet from Indy CLI
indy-cli-rs> wallet detach <wallet name>
// Example - Detach `wallet1` wallet from CLI
indy-cli-rs> wallet detach wallet1
List all attached wallets with corresponded status (indicates opened one):
indy-cli-rs> wallet list
Exports opened wallet to the specified file.
indy-cli-rs> wallet export export_path=<path-to-file> export_key=[<export key>] [export_key_derivation_method=<export_key_derivation_method>]
Example: Export opened wallet into `/Users/indy-cli-rs/backup` file
indy-cli-rs> wallet export export_path=/Users/indy-cli-rs/backup export_key=key
Create new wallet and then import content from the specified file.
indy-cli-rs> wallet import <wallet name> key=<key> [key_derivation_method=<key_derivation_method>] export_path=<path-to-file> export_key=<key used for export> [storage_type=<storage_type>] [storage_config={config json}]
Example: Import wallet from `/Users/indy-cli-rs/backup` file
indy-cli-rs> wallet import wallet_imported export_path=/Users/indy-cli-rs/backup export_key=key
indy-cli-rs> pool <subcommand>
Create name pool (network) configuration
indy-cli-rs> pool create [name=]<pool name> gen_txn_file=<gen txn file path>
Example: Create `pool1` pool with genesist transactions from `/home/gen_txns` file
indy-cli-rs> pool create pool1 gen_txn_file=/home/gen_txns
Connect to Indy nodes pool and make it available for operation that require pool access. If there was pool connection it will be disconnected.
indy-cli-rs> pool connect [name=]<pool name> [protocol-version=<version>] [timeout=<timeout>] [extended-timeout=<timeout>] [pre-ordered-nodes=<node names>]
Example: Connect to `pool1` pool
indy-cli-rs> pool connect pool1
Refresh a local copy of a pool ledger and updates pool nodes connections.
indy-cli-rs> pool refresh
Set protocol version that will be used for ledger requests. One of: 1, 2. Unless command is called the default protocol version 2 is used.
indy-cli-rs> pool set-protocol-version [protocol-version=]<version>
Example: Set `2` protocol version
indy-cli-rs> pool set-protocol-version 2
Disconnect from Indy nodes pool
indy-cli-rs> pool disconnect
List all created pools configurations with status (indicates connected one)
indy-cli-rs> pool list
indy-cli-rs> did <subcommand>
Create and store my DID in the opened wallet. Requires opened wallet.
indy-cli-rs> did new [did=<did>] [seed=<UTF-8, base64 or hex string>] [metadata=<metadata string>] [<method>=<did method name>]
Example: Create a new random DID
indy-cli-rs> did new
Example: Create a new deterministic DID from the provided Seed value
indy-cli-rs> did new seed=
List my DIDs stored in the opened wallet as table (did, verkey, metadata). Requires wallet to be opened.:
indy-cli-rs> did list
Use the DID as identity owner for commands that require identity owner:
indy-cli-rs> did use [did=]<did>
Example: Use `MYDID000000000000000000001` DID as the active
indy-cli-rs> did use MYDID000000000000000000001
Rotate keys for used DID. Sends NYM to the ledger with updated keys. Requires opened wallet and connection to pool:
indy-cli-rs> did rotate-key [seed=<UTF-8, base64 or hex string>] [resume=<bool>]
Example: Rotate key to a random one
indy-cli-rs> did rotate-key
Example: Rotate key to a new deterministic one from the provided Seed value
indy-cli-rs> did rotate-key seed=00000000000000000000000000000My2
Update DID stored in the wallet to make fully qualified, or to do other DID maintenance:
indy-cli-rs> did qualify did=<did> method=<method>
Example: Qualify the did to be `indy` prefixed
indy-cli-rs> did qualify did=VsKV7grR1BUE29mG2Fm2kX method=indy
Update metadata for DID stored in the wallet:
indy-cli-rs> did set-metadata did=<did> metadata=<metadata>
Example: Qualify the did to be `indy` prefixed
indy-cli-rs> did qualify did=VsKV7grR1BUE29mG2Fm2kX metadata="Test DID"
indy-cli-rs> ledger <subcommand>
Send NYM transaction
ledger nym did=<did-value> [verkey=<verkey-value>] [role=<role-value>] [sign=<true or false>] [send=<true or false>] [endorser=<endorser did>]
Send GET_NYM transaction
ledger get-nym did=<did-value> [send=<true or false>]
Send ATTRIB transaction
ledger attrib did=<did-value> [hash=<hash-value>] [raw=<raw-value>] [enc=<enc-value>] [sign=<true or false>] [send=<true or false>] [endorser=<endorser did>]
Send GET_ATTRIB transaction
ledger get-attrib did=<did-value> [raw=<raw-value>] [hash=<hash-value>] [enc=<enc-value>] [send=<true or false>]
Send SCHEMA transaction
ledger schema name=<name-value> version=<version-value> attr_names=<attr_names-value> [sign=<true or false>] [send=<true or false>] [endorser=<endorser did>]
ledger get-schema did=<did-value> name=<name-value> version=<version-value> [send=<true or false>]
Send CRED_DEF transaction
ledger cred-def schema_id=<schema_id-value> signature_type=<signature_type-value> [tag=<tag>] primary=<primary-value> [revocation=<revocation-value>] [sign=<true or false>] [send=<true or false>] [endorser=<endorser did>]
Send GET_CRED_DEF transaction
ledger get-cred-def schema_id=<schema_id-value> signature_type=<signature_type-value> origin=<origin-value> [send=<true or false>]
Send NODE transaction
ledger node target=<target-value> alias=<alias-value> [node_ip=<node_ip-value>] [node_port=<node_port-value>] [client_ip=<client_ip-value>] [client_port=<client_port-value>] [blskey=<blskey-value>] [blskey_pop=<blskey-proof-of-possession>] [services=<services-value>] [sign=<true or false>] [send=<true or false>]
Send GET_VALIDATOR_INFO transaction to get info from all nodes
ledger get-validator-info [nodes=<node names>] [timeout=<timeout>]
Send POOL_UPGRADE transaction
ledger pool-upgrade name=<name> version=<version> action=<start or cancel> sha256=<sha256> [timeout=<timeout>] [schedule=<schedule>] [justification=<justification>] [reinstall=<true or false (default false)>] [force=<true or false (default false)>] [package=<package>] [sign=<true or false>] [send=<true or false>]
Send POOL_CONFIG transaction
ledger pool-config writes=<true or false (default false)> [force=<true or false (default false)>] [sign=<true or false>] [send=<true or false>]
Send POOL_RESTART transaction
ledger pool-restart action=<start or cancel> [datetime=<datetime>] [nodes=<node names>] [timeout=<timeout>]
Send custom transaction with user defined json body and optional signature
ledger custom [txn=]<txn-json-value> [sign=<true|false>]
Send AUTH_RULE transaction
ledger auth-rule txn_type=<txn type> action=<add or edit> field=<txn field> [old_value=<value>] [new_value=<new_value>] constraint=<{constraint json}> [sign=<true or false>] [send=<true or false>]
Send GET_AUTH_RULE transaction
ledger get-auth-rule [txn_type=<txn type>] [action=<ADD or EDIT>] [field=<txn field>] [old_value=<value>] [new_value=<new_value>] [send=<true or false>]
Add multi signature by current DID to transaction
ledger sign-multi txn=<txn_json>
Save stored into CLI context transaction to a file.
ledger save-transaction file=<path to file>
Read transaction from a file and store it into CLI context.
ledger load-transaction file=<path to file>
Request to add a new version of Transaction Author Agreement to the ledger.
ledger txn-author-agreement [text=<agreement content>] [file=<file with agreement>] version=<version> [ratification-timestamp=<timestamp>] [retirement-timestamp=<timestamp>] [sign=<true or false>] [send=<true or false>]
Disable All Transaction Author Agreements on the ledger.
ledger disable-all-txn-author-agreements [sign=<true or false>] [send=<true or false>]
Request to add new acceptance mechanisms for transaction author agreement.
ledger txn-acceptance-mechanisms [aml=<acceptance mechanisms>] [file=<file with acceptance mechanisms>] version=<version> [context=<some context>] [sign=<true or false>] [send=<true or false>]
Get a list of acceptance mechanisms set on the ledger.
ledger get-acceptance-mechanisms [timestamp=<timestamp>] [version=<version>] [send=<true or false>]
indy-cli-rs> pool create sandbox gen_txn_file=/etc/sovrin/sandbox.txn
indy-cli-rs> pool connect sandbox
pool(sandbox):indy-cli-rs> pool list
sandbox|indy-cli-rs> wallet create alice_wallet key
sandbox|indy-cli-rs> wallet open alice_wallet key
pool(sandbox):wallet(alice_wallet):indy-cli-rs> wallet list
sandbox|indy-cli-rs> wallet create wallet_pstg key storage_type=postgres_storage storage_config={"url":"localhost:5432"} storage_credentials={"account":"postgres","password":"mysecretpassword","admin_account":"postgres","admin_password":"mysecretpassword"}
sandbox|indy-cli-rs> wallet open wallet_pstg key storage_credentials={"account":"postgres","password":"mysecretpassword","admin_account":"postgres","admin_password":"mysecretpassword"}
pool(sandbox):wallet(alice_wallet):indy-cli-rs> did new
pool(sandbox):wallet(alice_wallet):indy-cli-rs> did use PDwYxJ7hSXdM2PCz3yX16z
pool(sandbox):wallet(alice_wallet):did(PDw...16z):indy-cli-rs> did list
pool(sandbox):wallet(alice_wallet):indy-cli-rs> did new seed=SEED0000000000000000000000000001 metadata="Alice DID"
pool(sandbox):wallet(alice_wallet):indy-cli-rs> did use Av63wJYM7xYR4AiygYq4c3
pool(sandbox):wallet(alice_wallet):did(Av6...4c3):indy-cli-rs> did list
pool(sandbox):wallet(alice_wallet):did(Av6...4c3):indy-cli-rs> ledger nym did=PDwYxJ7hSXdM2PCz3yX16z verkey=~JpZc1EarKfUwSpUTJ3ii3N
pool(sandbox):wallet(alice_wallet):did(Av6...4c3):indy-cli-rs> ledger get-nym did=MYDID000000000000000000001
pool(sandbox):wallet(alice_wallet):did(Av6...4c3):indy-cli-rs> ledger schema name=Alice_Schema version=1.0 attr_names=firstname,surname
pool(sandbox):wallet(alice_wallet):did(Av6...4c3):indy-cli-rs> ledger schema name=Alice_Schema version=1.0 attr_names=firstname,surname endorser=EndorserDID000000000000001 send=false
pool(sandbox):wallet(alice_wallet):did(Av6...4c3):indy-cli-rs> ledger load-transaction file=txn.json
pool(sandbox):wallet(alice_wallet):did(Av6...4c3):indy-cli-rs> ledger sign-multi
pool(sandbox):wallet(alice_wallet):did(Av6...4c3):indy-cli-rs> ledger save-transaction file=txn.json
pool(sandbox):wallet(alice_wallet):did(Av6...4c3):indy-cli-rs> ledger load-transaction file=txn.json
pool(sandbox):wallet(alice_wallet):did(Av6...4c3):indy-cli-rs> ledger custom context
sandbox|indy-cli-rs> wallet open alice_wallet key rekey=endorser rekey_derivation_method=argon2i
indy-cli-rs /path/to/script-file
indy-cli-rs --config /path/to/config.json
indy-cli-rs --logger-config /path/to/logger.yml