LinuxCommandLibrary

hsd-cli

Interact with the Handshake blockchain

TLDR

Retrieve information about the current server

$ hsd-cli info
copy

Broadcast a local transaction
$ hsd-cli broadcast [transaction_hex]
copy

Retrieve a mempool snapshot
$ hsd-cli mempool
copy

View a transaction by address or hash
$ hsd-cli tx [address_or_hash]
copy

View a coin by its hash index or address
$ hsd-cli coin [hash_index_or_address]
copy

View a block by height or hash
$ hsd-cli block [height_or_hash]
copy

Reset the chain to the specified block
$ hsd-cli reset [height_or_hash]
copy

Execute an RPC command
$ hsd-cli rpc [command] [args]
copy

SYNOPSIS

hsd-cli [options] <command> [arguments]

Examples:
hsd-cli getblockchaininfo
hsd-cli wallet getbalance
hsd-cli name info hsd

PARAMETERS

--config=<path>
    Specifies an alternative configuration file for hsd-cli settings.

--network=<name>
    Sets the Handshake network to connect to (e.g., main, testnet, simnet, regtest). Defaults to main.

--prefix=<path>
    Defines the data directory prefix for configuration and data storage.

--rpc-host=<host>
    Specifies the RPC host (IP address or hostname) of the hsd node to connect to. Defaults to 127.0.0.1.

--rpc-port=<port>
    Defines the RPC port of the hsd node to connect to. Defaults to 12037.

--api-key=<key>
    Provides the API key for authenticated RPC calls to the hsd node.

--no-auth
    Disables RPC authentication for the connection. Use with caution, especially on public networks.

--ssl
    Enables SSL/TLS for the RPC connection to the hsd node.

--ca-file=<path>
    Specifies the path to the CA certificate file for SSL connections.

--cert-file=<path>
    Specifies the path to the client certificate file for SSL connections.

--key-file=<path>
    Specifies the path to the client key file for SSL connections.

--wallet-id=<id>
    Specifies the ID of the wallet to interact with, primarily for multi-wallet setups.

--wallet-auth
    Enables wallet RPC authentication, using credentials configured for the wallet.

DESCRIPTION

The hsd-cli command is the primary command-line interface for interacting with an hsd full node. It allows users to send commands to a running hsd daemon, facilitating a wide range of operations including
wallet management (e.g., checking balances, sending transactions),
blockchain queries (e.g., retrieving block information, transaction details),
and most notably, managing Handshake's decentralized naming system (e.g., registering names, updating DNS records, bidding on auctions).

It functions as an RPC client, abstracting the complexities of direct RPC calls to the hsd node's API. This tool is essential for developers, miners, and anyone actively participating in or building upon the Handshake blockchain.

CAVEATS

hsd-cli requires a running hsd full node daemon to function. If the daemon is not running or is unreachable, commands will fail.

Proper RPC authentication (via API key or other credentials) is crucial for security, especially when exposing the RPC interface.

The command's behavior is dependent on the hsd node's synchronization status; blockchain queries may return outdated or incomplete information if the node is not fully synced.

RPC COMMAND STRUCTURE

Unlike traditional Linux commands that accept options before arguments, hsd-cli typically uses an RPC-style structure where the first non-option argument is the RPC method name (e.g., getblockchaininfo, wallet, name), followed by method-specific arguments. Sub-commands like wallet or name often have their own sub-methods (e.g., wallet getbalance, name update).

DEFAULT CONNECTION

By default, hsd-cli attempts to connect to an hsd node running on localhost (127.0.0.1) at the default RPC port (12037). These defaults can be overridden using the --rpc-host and --rpc-port options.

HISTORY

The hsd-cli tool is an integral part of the Handshake project, developed alongside the hsd full node implementation. Its creation was driven by the need for a convenient and programmatic way to interact with the Handshake blockchain and its unique decentralized naming system. Since its inception, it has served as the primary interface for developers, miners, and domain owners to manage their Handshake assets, query blockchain data, and participate in name auctions and updates.

SEE ALSO

hsd(1), bitcoin-cli(1), curl(1)

Copied to clipboard