CLI Management
The Command Line Interface (CLI) is a core component of Stablecoin Studio and essential for developers aiming to streamline stablecoin management. This guide takes you from installing the SDK and CLI to customizing your config file and initiating stablecoin creation via CLI commands. Whether you're just getting started or already familiar with stablecoin management, this documentation provides the resources to navigate and optimize your stablecoin operations effectively.
Table of Contents
Prerequisites
Install Stablecoin Studio
Open a new terminal and navigate to your preferred directory where you want your Stablecoin Studio project to live. Clone the repo using this command:
git clone https://github.com/hashgraph/stablecoin-studio.gitInstall the npm package globally:
npm install -g @hashgraph/stablecoin-npm-cliConfigure CLI
To use the CLI correctly, it is necessary to generate a configuration file where the default network, their associated accounts, and the factory contract ID will be included. These parameters can be modified later on.
Create a config file
From the root of the cli directory, start the command line tool and create a configuration file using the wizard command:
cd stablecoin-studio/cli
accelerator wizardThe first time you execute the wizard command in your terminal, if you haven't added your default configuration path, the interface will prompt you to "Write your config path." To use the default configuration path, hit enter. This will walk you through the prompts where you will input your configuration settings and create your hsca-config-yaml file.
Let's go over the configuration details:
defaultNetwork
This sets the default network the application will connect to when it starts. It’s essential for defining the environment where transactions will occur (e.g., testnet for testing, mainnet for production). We will be using testnet for this tutorial.
defaultNetwork: testnetnetworks
This property contains a list of Hedera networks that the application can connect to. Each entry specifies the name of a network and a list of consensus nodes, allowing you to switch between different Hedera environments easily.
networks:
- name: mainnet
consensusNodes: []
- name: previewnet
consensusNodes: []
- name: testnet
consensusNodes: []accounts
This property holds the credentials for various Hedera accounts. Each account has an accountId, a privateKey, and a network association. This is critical for performing transactions, as the private key is used to sign them. The alias field provides a user-friendly identifier for the account and importedTokens can store any tokens imported into this account. You can use the Hedera Developer Portal to create the default testnet account.
accounts:
- accountId: YOUR ACCOUNT ID
privateKey:
key: >-
YOUR PRIVATE KEY
type: ED25519
network: testnet
alias: main
importedTokens: []mirrors
This property lists the available Hedera mirror nodes for each network. Mirror nodes hold historical data and can be queried for transactions, records, etc. The selected field indicates whether the mirror node is the default one to be used.
mirrors:
- name: HEDERA
network: testnet
baseUrl: https://testnet.mirrornode.hedera.com/api/v1
selected: true
- name: HEDERA
network: previewnet
baseUrl: https://previewnet.mirrornode.hedera.com/api/v1
selected: true
- name: HEDERA
network: mainnet
baseUrl: https://mainnet.mirrornode.hedera.com/api/v1
selected: truerpcs
This property specifies the RPC (Remote Procedure Call) servers available for connecting to Hedera services. RPCs are essential for querying smart contracts, among other functionalities. Similar to mirror nodes, the selected field indicates the default RPC to use.
rpcs:
- name: HASHIO
network: testnet
baseUrl: https://testnet.hashio.io/api
selected: true
- name: HASHIO
network: previewnet
baseUrl: https://previewnet.hashio.io/api
selected: true
- name: HASHIO
network: mainnet
baseUrl: https://mainnet.hashio.io/api
selected: truelogs
Here, you can specify the path where log files will be stored (path) and the level of logging detail you want (level). For example, setting the level to ERROR will only log error events.
logs:
path: ./logs
level: ERRORfactories
This property lists factory contract IDs (id) and their associated network. Factories are smart contracts that can create other contracts. By listing them here, the application knows which factories it can interact with on each network.
factories:
- id: 0.0.636690
network: testnetFactory contracts
We provide default contract addresses for factories that we have deployed for anyone to use. They are updated whenever a new version is released.
FactoryAddress
0.0.14455068
Testnet
FactoryAddress
0.0.XXXXXX
Previewnet
A factory contract is a specialized type of smart contract designed to generate another smart contract. It serves as a template or blueprint for creating multiple instances of other contracts with similar features but possibly different initial states and parameters.
For example, the
ERC20Factoryis a contract that facilitates the deployment of new ERC20 tokens. The factory uses theEIP1167standard for simply and cheaply cloning contract functionality.
Deploy custom factory contract (optional)
If you want to deploy your own factory contract with custom logic tailored to your specific needs, check out the /contracts folder README for a comprehensive guide.
CLI Flow

Start CLI
Start the CLI tool using the wizard command:
accelerator wizardWhen the CLI is started with the configuration file properly configured, the first action will be to select the account you want to operate with. The list of configured accounts belonging to the default network indicated in the configuration file is displayed by default.
If there are no accounts in the file for the default network, a warning message will be displayed and a list of all the accounts in the file will be displayed.

Main Menu
The main menu will be displayed once you select an account you want to operate with. Choose one of the stablecoin management menu options listed and follow the prompts in your interface. Let's review each option to give you a better understanding of what's available to you:
Create Stablecoin
Start the CLI tool using the wizard command:
accelerator wizardSelect "Create a new stablecoin" and proceed through the prompts to fill in the details of your new stablecoin.


Operate Stablecoin
Start the CLI using the wizard command:
accelerator wizardSelect the "Operate with an existing stablecoin" option and proceed through the prompts to operate your stablecoin.

🪙 Here is a list of stablecoin operations.
Configure Proof of Reserve (PoR)
Start the CLI using the wizard command:
accelerator wizardSelect the "Create a new stablecoin" option, then proceed through the prompts.

Additional Resources
Last updated
Was this helpful?

