NHBCoin
NHBCoin

Using the CLI (nhb-cli)

The nhb-cli is your essential command center for direct on-chain interaction. It connects to a running node via its RPC API to query the state and broadcast new, signed transactions. This guide covers the primary commands.

Explore the CLI commands on GitHub

Generate a Wallet

This command creates a new ECDSA private key (your secret) and saves it to a file named wallet.key in your current directory. It will also display the corresponding public nhb... address.

Example Command
./nhb-cli generate-key
Sample Output
Generated new key and saved to wallet.key
Your public address is: nhb19xcxfznkgtr8je0ry28jts3r2mgldy6zzfaa27

Check Balance

Queries the node for the complete state of any address. This includes liquid balances for both NHBCoin and ZapNHB, the total amount staked, and the current nonce.

Example Command
./nhb-cli balance nhb19xcxfznkgtr8je0ry28jts3r2mgldy6zzfaa27
Sample Output
State for: nhb19xcxfznkgtr8je0ry28jts3r2mgldy6zzfaa27
  Username: 
  NHBCoin:  100000
  ZapNHB:   5000
  Staked:   0 ZapNHB
  Nonce:    0

Stake ZapNHB

Creates and broadcasts a native transaction to lock up a specified amount of your liquid ZapNHB into a staked position. Staking is the prerequisite to becoming a validator candidate.

Example Command
./nhb-cli stake 5000 wallet.key
Sample Output
Successfully sent stake transaction for 5000 ZapNHB.
Check the node logs for confirmation and wait for the next block.

Un-stake ZapNHB

Creates and broadcasts a native transaction to unlock a specified amount of your staked ZapNHB, returning it to your liquid balance.

Example Command
./nhb-cli un-stake 1000 wallet.key
Sample Output
Successfully sent un-stake transaction for 1000 ZapNHB.

Redirect Validator Rewards

Lets a validator redirect its own epoch reward payouts to a different wallet it actually uses day-to-day, without moving its stake or its consensus signing key. Because only the validator's own key can authorize where its rewards go, this is a local signed transaction, not a bare RPC call — it must be run on the validator server itself, using its own local key file (e.g. /etc/nhbchain/validator.key), which should never leave that server. Pass an empty string ("") as the address to clear a previously-set beneficiary redirect.

Example Command
./nhb-cli set-reward-beneficiary nhb1abcyourwalletaddress... /etc/nhbchain/validator.key
Sample Output
Successfully sent set-reward-beneficiary transaction.

Send a Heartbeat

Sends a zero-value native transaction whose sole purpose is to signal on-chain activity. This is the primary way to increase your Engagement Score within the POTSO consensus mechanism. In normal operation a running validator node submits these heartbeats automatically on a regular cadence — this is what keeps a staked validator eligible to join and stay in the active set. Running this command manually is intended for troubleshooting and testing, not routine use.

Example Command
./nhb-cli heartbeat wallet.key
Sample Output
Successfully sent heartbeat transaction.

Deploy a Smart Contract

Deploys EVM bytecode to the network. This command reads a hex-encoded bytecode string from a file and broadcasts it as a contract creation transaction.

Example Command
./nhb-cli deploy ./storage_contract.hex wallet.key
Sample Output
Successfully sent contract deployment transaction.