Skip to main content

Most Used Commands

Deploy from a Solidity file
Import an existing on-chain contract into local state
List saved contracts
Delete on Hedera (beneficiary required) or drop local state only

Create: --file vs --default

You must supply --file (path to a .sol file) or --default (erc20 or erc721 built-in template). They are mutually exclusive.

Full Command Reference

Compile a Solidity source (or use a built-in template), deploy the contract to the current network, and run verification where the CLI supports it.
string
required
Smart contract name or alias stored in CLI state.
string
Path to a Solidity file (absolute or relative). Use with --base-path when imports need a root directory.
string(erc20|erc721)
Use a built-in template instead of --file. Mutually exclusive with --file.
string
Base directory for resolving the Solidity file. Defaults to the current directory when using --file (see CLI README for --default behavior).
number
default:"2000000"
Gas limit for contract creation.
string (repeatable)
Admin key credential(s) for the new contract. Pass multiple times for KeyList / ThresholdKey style setups. See hcli contract create --help for accepted formats.
int
M-of-N: how many of the --admin-key values must sign the create flow. Only applies when multiple --admin-key entries are provided.
string
Contract memo.
string
Solidity compiler version to use for compilation.
string (repeatable)
Constructor argument values, in order. Repeat the flag once per argument.
string(local|local_encrypted)
Key manager to use: local or local_encrypted (defaults to config setting).
string
Initial HBAR balance for the contract. Examples: 100 (HBAR) or 100t (tinybars).
string
Auto-renew period: seconds as an integer, or with suffix s, m, h, or d (e.g. 500, 500s, 50m, 2h, 30d).
string
Account ID (0.0.xxx) that pays for contract auto-renewal.
int
Maximum automatic token associations (-1 for unlimited, 0 to disable).
string
Account ID (0.0.xxx) to stake the contract to. Mutually exclusive with --staked-node-id.
number
Node ID to stake the contract to. Mutually exclusive with --staked-account-id.
boolean
Whether to decline staking rewards for this contract.
Examples
List smart contracts stored in CLI state (including metadata such as network and verification flags where available).Example
Import an existing contract from Hedera by 0.0.xxx ID or 0x… EVM address. The CLI reads contract info from the mirror node and stores admin key metadata in local state for later operations.
string
required
Contract ID (0.0.xxx) or EVM address (0x…).
string
Optional local alias for the imported contract.
By default, submits a ContractDeleteTransaction on Hedera and then removes the contract from local state. With --state-only, only local state is cleared (no network transaction).
string
required
Contract ID (0.0.xxx) or local alias.
Remove from local CLI state only. No network delete.
string
Account (ID or alias) that receives remaining HBAR after an on-chain delete. For a network delete, supply exactly one of --transfer-id or --transfer-contract-id. Do not combine with --state-only.
string
Contract (ID or alias) that receives remaining HBAR. For a network delete, supply exactly one of --transfer-id or --transfer-contract-id (never both).
string (repeatable)
Optional signing credential(s) for the network delete. Not allowed with --state-only. If omitted on a network delete, the CLI derives required admin keys from the mirror node and matches KMS keys (including M-of-N). Pass multiple times when several keys must sign.
string(local|local_encrypted)
Key manager used when resolving --admin-key (defaults to config).
Examples
This command uses requireConfirmation. In non-interactive environments, use the root --confirm flag (see Overview → Global Flags) so the CLI does not block on the prompt.
ERC-20 and ERC-721 helper plugins focus on calling deployed contracts. This page covers compile, deploy, import, list, and delete for Solidity sources and built-in erc20 / erc721 templates.