CLI
stcd
is an all-in-one Command Line Interface (CLI). It allows you to run Daodst chain nodes, manage wallets and interact with Daodst network through queries and transactions. This introduction will explain how to install the stcd
binary on your system and walk you through some simple examples on how to use stcd.
prerequisites
Go
Daodst is built using Go version 1.20+
. Check your version:
go version
Once the correct version is installed, confirm that your GOPATH
is properly configured by running the following command and adding it to your shell startup script:
export PATH=$PATH:$(go env GOPATH)/bin
jq
Daodst scripts use jq version 1.6+
. Check your version:
jq --version
Install
You can build and install stcd
binaries from source.
Build from source
Clone and build Daodst from source using git
. <tag>
refers to the release tag on Github. Latest Daodst
Version
git clone https://github.com/daodst/blockchain.git
cd blockchain
git fetch
git checkout <tag>
make install
Once the installation is complete, check that the stcd binary was successfully installed:
stcd version
📣 Tips:
If a stcd: command not found
error message is returned, please confirm that you have configured Go correctly.
Run Daodst node
To get familiar with Daodst, you can run a local blockchain node to generate blocks and expose EVM and Cosmos endpoints. This allows you to deploy and interact with smart contracts locally or test core protocol functionality.
Run local node by executing the local_node.sh
script in the base directory of the repository:
./local_node.sh
This script stores node configuration, including local default endpoints under ~/.tmp-stcd/config/config.toml
.
If you have run the script before, this script allows you to override the existing configuration and start a new local node.
Once the node is running, you will see it validating and producing blocks in the local Daodst blockchain:
12:59PM INF executed block height=1 module=state num_invalid_txs=0 num_valid_txs=0 server=node
#...
1:00PM INF indexed block exents height=7 module=txindex server=node
For more information on how to customize your local node, go to the single-node page.
Using stcd
After installing the stcd
binary, you can run commands with:
stcd [command]
There is also a -h
, --help
command available
stcd -h
Multiple node configurations can be maintained concurrently. To specify configuration, use the --home
flag. In the following examples we will use the default configuration of the local node located in ~/.tmp-stcd
.
Manage wallets
You can use the stcd binary to manage your wallet to store private keys and sign transactions via the CLI. To see all keys use:
stcd keys list \
--home ~/.tmp-stcd\
--keyring-backend test
# Example Output:
# - address: dst19xnmslvl0pcmydu4m52h2gf0std5ee5pfgpyuf
# name: dev0
# pubkey: '{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"AzKouyoUL0UUS1qRUZdqyVsTPkCAFWwxx3+BTOw36nKp"}'
# type: local
You can use $NAME
to generate a new key/mnemonic:
stcd keys add [name] \
--home ~/.tmp-stcd \
--keyring-backend test
Export your daodst key as an Ethereum private key for [Metamask] eg):
stcd keys unsafe-export-eth-key [name] \
--home ~/.tmp-stcd\
--keyring-backend test
For more information on available key commands, use the --help
flag
stcd keys -h
📣 Tips: For more information on Keyring and its backend options, click here. :::
Interacting with the network
You can use stcd to query information or submit transactions on the blockchain. Queries and transactions are requests you send to Daodst nodes via Tendermint RPC.
📣 👉 To use the CLI, you need to provide the Tendermint RPC address to the --node
flag.
Find publicly available addresses for testnet and mainnet in the [Networks] page.
Set network configuration
In the local setup, the node is set to tcp://localhost:26657
. You can view your node configuration with:
stcd config\
--home ~/.tmp-stcd
# Example Output
# {
# "chain-id": "daodst_7000-1",
# "keyring-backend": "test",
# "output": "text",
# "node": "tcp://localhost:26657",
# "broadcast-mode": "sync"
# }
You can set up your node configuration to send requests to a different network by changing the endpoint:
stcd config node [tendermint-rpc-endpoint] \
--home ~/.tmp-stcd
here for more node configuration.
Inquire
You can use stcd query
(or stcd q
for short) to query information on the blockchain. Click to view account balance
Addresses stored in the bank module, using:
stcd q bank balances [adress] \
--home ~/.tmp-stcd
# # Example Output:
# balances:
# - amount: "99999000000000000000002500"
# denom: dst
To see other available query commands, use:
# for all Queries
stcd q
# for querying commands in the bank module
stcd q bank
trade
You can submit transactions to the network using stcd tx
. This creates, signs and broadcasts the tx in one command. To use the bank module to send tokens from an account in the keyring to another address, use:
stcd tx bank send [from_key_or_address] [to_address] [amount] \
--home ~/.tmp-stcd \
--fees 50000000000dst \
-b block
# Example Output:
# ...
# txhash: 7BA2618295B789CC24BB13E654D9187CDD264F61FC446EB756EAC07AF3E7C40A
To see other available transaction commands, use:
# for all transaction commands
stcd tx
# for Bank transaction subcommands
stcd tx bank
Now that you know the basics of how to run and interact with the Daodst network, go to Configuration for further customization.