Skip to main content

Humans.ai CLI

The command-line interface (CLI) for everything is called humansd. You can use it to manage wallets, run a Humans.ai node, and engage in transactions and queries on the Humans.ai network. The humansd binary installation process and several straightforward humansd usage examples are included in this introduction.

Prerequisites

Go

The Go version 1.23+ was used to create Humans.ai. Verify your version using:

go version

Once you've installed the appropriate version, run the following command and include it in your shell starting script to make sure your 'GOPATH' is appropriately configured:

export PATH=$PATH:$(go env GOPATH)/bin

jq

The 1.6+ version of jq is used by Humans.ai scripts. Verify your copy using:

jq --version

Installation

You can install the most recent binaries by downloading them from the repository, building the humansd binaries from source code, or using Docker.

Download the binaries

  • Navigate to the releases section of the repository;
  • Select the pre-release or preferred release that you want to install on your computer;
  • The matching tar or zip file for your OS can be found in the Assets selection; select it and download it.
  • Extract the files. The bin subfolder of the extracted files contains the humansd binaries.
  • The humansd binaries should be added to your path, for example, by moving them to $(go env GOPATH)/bin

Verify that the humansd binaries have been successfully installed when installation is complete:

humansd version

Build From Source

Use git to clone and compile Humans.ai from source code. A release tag on Github is indicated by the <tag>. Check out the most recent Humans.ai version on the repository's releases page:

git clone https://github.com/humansdotai/humans.git
cd humans
git fetch
git checkout <tag>
make install

Verify that the humansd binaries have been successfully installed after the installation is complete:

humansd version
info

Verify your Go configuration if the error message humansd: command not found appears.

Docker

There are two ways to use Docker with Humans.ai: either create a Docker image that can be used to launch multiple containers that each execute the Humans.ai binary, or create a binary of the Humans.ai daemon inside a dockerized build environment. Visit the dedicated page on working with Docker for details on how to accomplish this.

Run a Humans.ai node

You can run a local blockchain node that generates blocks and exposes EVM and Cosmos APIs to get acquainted with Humans.ai. This enables you to test core protocol functions or deploy and use smart contracts locally.

By running the start.sh script in the repository's base directory, you can start the local node:

./start.sh

Under /.tmp-humansd/config/config.toml, the script keeps track of the node configuration, including the local default endpoints. The script gives you the option to create a new local node and overwrite the current settings if you've already run it.

When your node is operational, you will observe it producing blocks and validating transactions in your local Humans.ai 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

Go to the Single Node page for more details on customizing a local node.

Using humansd

The humansd binary can be installed by using this command:

humansd [command]

-h and --help commands are also available:

humansd -h

Multiple node configurations can be kept simultaneously. Use the --home parameter to specify a setup. In the examples that follow, we'll be using the standard configuration for a local node, which is located in ~/.tmp-humansd.

Manage wallets

The humansd binary allows you to store private keys and sign transactions over CLI while managing your wallets. Use this command to view all keys:

humansd keys list \
--home ~/.tmp-humansd \
--keyring-backend test

# Example Output:
# - address: human198ybhrdouxaqgw3l0f2c54j1h7m2naspf0e7
# name: developer0
# pubkey: '{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"5w7u9n3210ePbM0H2C7cLZhFw8tfKpqK+BTOw36nKp"}'
# type: local

You can use a $NAME to create a new key or mnemonic by using:

humansd keys add [name] \
--home ~/.tmp-humansd \
--keyring-backend test

In order to use with Metamask, for instance, you must export your human key as an Ethereum private key.

humansd keys unsafe-export-eth-key [name] \
--home ~/.tmp-humansd \
--keyring-backend test

Use the -h flag to learn more about the key commands that are available.

humansd keys -h
tip

👉 Click here for additional information about the Keyring and its backend options.

Interact with a Network

On the blockchain, you can submit transactions or query data using humansd. Requests made to a Humans.ai node using the Tendermint RPC are known as queries and transactions.

tip

👉 For the --node flag, you must supply a Tendermint RPC address in order to use the CLI. On the Networks page, look for publicly accessible addresses for the testnet and mainnet.

Set Network Config

The node is configured locally to be tcp://localhost:26657. Your node configuration can be seen using:

humansd config \
--home ~/.tmp-humansd
# Example Output
# {
# "chain-id": "humans_1089-1",
# "keyring-backend": "test",
# "output": "text",
# "node": "tcp://localhost:26657",
# "broadcast-mode": "sync"
# }

By changing the endpoint with, you can configure your node to transmit requests to a different network:

humansd config node [tendermint-rpc-endpoint] \
--home ~/.tmp-humansd
tip

👉 More node configuration information can be found here.

Queries

humansd query (also known as humansd q) is a command used to search for data on the blockchain. Use the following to view the account balances stored by the bank module:

humansd q bank balances [address] \
--home ~/.tmp-humansd
# # Example Output:
# balances:
# - amount: "99999999990000000000002500"
# denom: aheart

Use the following syntax to view other query commands:

# for all Queries
humansd q

# for querying commands in the bank module
humansd q bank

Transactions

humansd tx can be used to send transactions to the network. A single command creates, signs, and transmits a transmission. Using the bank module, send tokens from one account on the keyring to a different address as follows:

humansd tx bank send [from_key_or_address] [to_address] [amount] \
--home ~/.tmp-humansd \
--fees 50000000000aheart \
-b block

# Example Output:
# ...
# txhash: 6K3175021914826057419289742996428435791895436329851820A75137494E

Use the following to view other transaction commands:

# for all transaction commands
humansd tx

# for Bank transaction subcommands
humansd tx bank
tip

👉 After gaining a basic understanding of how to operate and communicate with a Humans.ai network, visit configurations for more customization.