CLI

CLI

Every hush command, its flags and its output.

hush runs the Hush actions from a terminal, with a keypair file as the wallet. It talks to a Solana RPC directly and doesn't use the API. It is part of the @hush/sdk package and is built on the SDK.

bash
hush <command> [options]

Each run signs the unlock message with the keypair and derives your key from it in memory, so the balances and amounts are the same ones the app shows for that wallet.

Point it at a network

The program id is required. Set it and the RPC once in the environment:

bash
export HUSH_RPC_URL=<your Solana RPC URL>
export HUSH_PROGRAM_ID=<the Hush program id>

A first payment

bash
hush deposit --asset usdc --amount 500     # sets up the account when it is missing
hush apply --asset usdc
hush balance --asset usdc
hush send --asset usdc --amount 120 --to <wallet>
hush withdraw --asset usdc --amount 100

Commands

CommandNeedsWhat it does
hush balancePrints the asset's available and pending balance and the number of pending credits, or says the account is not set up. Sends nothing.
hush setupSets up the Hush account for the asset. Says so and sends nothing when it is already set up.
hush deposit--amountDeposits the amount into pending. Sets up the account before it when it is missing. Run apply afterwards.
hush applyFolds pending into available.
hush send--amount, --toSends the amount to the Hush account of the wallet given with --to.
hush withdraw--amountMoves the amount out of the encrypted balance, then burns it and releases the asset to the wallet. Prints the fee.

Every command takes --asset, and acts on SOL without it.

Options

OptionTypeDescription
--assetsol | usdcWhich asset. Default sol.
--amountdecimalIn whole units of the asset, such as 1.5 or 25. At most 9 decimal places for SOL and 6 for USDC.
--towallet addressThe recipient, for send.
--rpcURLThe Solana RPC to use. Default: the HUSH_RPC_URL environment variable, else http://127.0.0.1:8899.
--keypairpathA Solana keypair JSON file to use as the wallet. Default ~/.config/solana/id.json.
--program requiredaddressThe Hush program id. Default: the HUSH_PROGRAM_ID environment variable. One of the two is needed.
--usdc-mintaddressThe USDC mint. Default: USDC's mint on mainnet.
--clusterlocalnet | mainnetDefault: the HUSH_CLUSTER environment variable, else localnet when the RPC is on 127.0.0.1 or localhost, and mainnet otherwise.

Output

balance prints one line. These are two runs captured from a local validator, one for each asset, for a wallet that had deposited 1.3 SOL and never opened USDC:

text
hSOL: available 1.3, pending 0 (0 credits)
hUSDC: not set up

The other commands print one line for each transaction as it confirms: the step's label, padded to 28 characters, then the transaction's signature. The labels are the SDK's step labels, plus Deposit and Release for the two steps the program runs. withdraw ends with a line of the form fee <amount> <asset>.

A command that fails prints one message to standard error and exits with status 1.

Errors

MessageWhen
Pass --program or set HUSH_PROGRAM_ID.No program id was given.
Hush is not initialized on this cluster.The program's config account doesn't exist at this RPC.
--asset is sol or usdc.Another value was passed to --asset.
Not an amount: <text>--amount is missing, isn't a decimal number, or has more decimal places than the asset.
Pass --to <wallet>.send was run without --to.
Set up your Hush account for this asset first.apply, send or withdraw was run on an asset that isn't set up.
This wallet has not opened Hush for this asset yet. Ask them to open Hush.The recipient of a send has no Hush account for the asset.
Transaction <signature> failed: <error>A transaction landed with an error.
Transaction <signature> was not confirmed in time.A transaction wasn't confirmed within 60 seconds.
Commands: balance, setup, deposit, apply, send, withdraw.The command is missing or isn't one of the six.